`

linux probe 十五

 
阅读更多

DHCP可以为局域网里分配IP地址。也可以分配网卡信息,网关,子网掩码。

作用域,一个完整的IP地址网段。

租用域-排除范围=地址池

默认租约时间21600 也就是6小时,最大租约时间43200 也就是12小时。当为网卡分配ip6个小时以后,会DHCP服务会检查网卡是否还在线,如果不在线将此IP放入回收池。12小时以后会再次检查网卡是否在线,如果不在线就将彻底回收

 

192.168.10.0/24 作用域

192.168.10.20-192.168.10.220 地址池。地址池比作用域小或等

编辑虚拟机,虚拟网络编辑器。不选 使用本机DHCP服务器分配ip地址。

yum install dhcp

vim /etc/dhcp/dhcpd.conf 配置文件的内容是空的,可以参考/usr/share/doc/dhcp*/dhcpd.conf.example

 

ddns-update-style none; 禁用动态dns

ignore client-updates;不接受用户的更新

subnet 192.168.10.0 netmask 255.255.255.0{

range 192.168.10.20 192.168.10.200;

option subnet-mask 255.255.255.0;为用户分配的子网掩码

option routers 192.168.10.1; 网关地址

option domain-name-servers 8.8.8.8 dns解析服务器

default-lease-time 21600;

max-lease-time 43200;

}

wq!

iptables -F

systemctl start bind

service iptables save

启用另外一个虚拟机

nm-connection-editor

网卡设置为dhcp

cat /etc/dhcp/dhcpd.conf 

cat /var/log/message 查看dhcp的日志。

vim /etc/dhcp/dhcpd.conf

subnet 192.168.10.0 netmask 255.255.255.0{

range 192.168.10.20 192.168.10.200;

option subnet-mask 255.255.255.0;为用户分配的子网掩码

option routers 192.168.10.1; 网关地址

option domain-name-servers 8.8.8.8 dns解析服务器

default-lease-time 21600;

max-lease-time 43200;

host boss{ 为老板的网卡绑定到固定ip

hardware ethernet xxxxxxxxxxx

fixed-address 192.168.10.88;

}

}

wq!

systemctl restart dhcpd

systemctl enabled dhcpd

 

 

openldap 轻量级目录访问协议。可以当成数据库使用。使用特点:存储短小信息。读取频次高,不能多次修改。

yum install -y openldap openldap-clients openldap-servers migrationtools 安装opengldap的主程序,客户端,服务端,迁移工具。

vim /etc/hosts

192.168.10.10 www.linuxprobe.com

wq!

ping www.inuxprobe.com

slappasswd -s linuxprobe -n > /etc/openldap/passwd 将明文加密成字符串, -n代表导出。

openssl req - new -x509 -nodes -out /etc/openldap/certs/cert.pem -keyout /etc/openldap/certs/priv.pem -days 365使用openssl生成一对非对称秘钥,req代表注册,-new代表新建 -509代表证书协议,-nodes是一个节点,-out输出,cert.pem表示公钥,priv.pem代表私钥,有效期是365天。

填写先关信息,国家,省份,地区,组织名称,主机名称:www.linuxprobe.com

cd /etc/openldap/certs

chown ldap:ldap *

chmod 600 *

cp /usr/share/openldap-servers/DB_CONFIG.example  /var/lib/ldap/DB_CONFIG

cd /var/lib/ldap

slaptest 测试,可以自动生成数据库。

ls

chown ldap:ldap

id ladp

systemctl restart slapd 

systemctl enable slapd

如果ldap中没有组织架构的时候用ldapadd添加 。ldapmodify修改

cd /etc/openldap/schema/ .ldif 是模板文件 

ldapadd -Y EXTERNAL -H ldapi:/// -D "cn=config" -f cosine.ldif先导入一个目录架构模板,然后再在这个模板基础之上进行修改。

ldapadd -Y EXTERNAL -H ldapi:/// -D "cn=config" -f nis.ldif先导入一个目录架构模板,然后再在这个模板基础之上进行修改。

vim /etc/openldap/changes.ldif

dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcSuffix
olcSuffix: dc=linuxprobe,dc=com

dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootDN
olcRootDN: cn=Manager,dc=linuxprobe,dc=com

dn: olcDatabase={2}hdb,cn=config
changetype: modify
replace: olcRootPW
olcRootPW: 此处输入之前生成的密码(如{SSHA}v/GJvGG8SbIuCxhfTDVhkmWEuz2afNIR)

dn: cn=config
changetype: modify
replace: olcTLSCertificateFile
olcTLSCertificateFile: /etc/openldap/certs/cert.pem

dn: cn=config
changetype: modify
replace: olcTLSCertificateKeyFile
olcTLSCertificateKeyFile: /etc/openldap/certs/priv.pem

dn: cn=config
changetype: modify
replace: olcLogLevel
olcLogLevel: -1

dn: olcDatabase={1}monitor,cn=config
changetype: modify
replace: olcAccess
olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth" read by dn.base="cn=Manager,dc=linuxprobe,dc=com" read by * none

ldapmodify -Y EXTERNAL -H ldapi:/// -f /etc/openldap/changes.ldif

vim /etc/openldap/base.ldif

 

[root@linuxprobe ~]# vim /etc/openldap/base.ldif
dn: dc=linuxprobe,dc=com
dc: linuxprobe 第一个部门
objectClass: top
objectClass: domain

dn: ou=People,dc=linuxprobe,dc=com
ou: People  第二个部门
objectClass: top
objectClass: organizationalUnit

dn: ou=Group,dc=linuxprobe,dc=com
ou: Group  第三个部门
objectClass: top
objectClass: organizationalUnit

 ldapadd -x -w linuxprobe -D cn=Manager,dc=linuxprobe,dc=com -f /etc/openldap/base.ldif 将上面新建的三个部门配置文件导入。

useradd -d /home/ldap zhaosi 

cd /usr/share/migrationtools  迁移工具将我们的明文信息导成加密文本,把系统中的用户信导成ldap可以使用的文本。

vim /usr/share/migrationtools/migrate_common.ph

71行#DEFAULT_MAIL_DOMAIN="linuxprobe.com";默认域

74行#DEFAULT_BASE = "dc=linuxprobe,de=com"; 默认域

vim passwd

从这里查询cat /etc/passwd

zhaosi:x:1001:1001::/home/ldap:/bin/bash

wq!

vim grouip 新建

从这里查询cat /etc/group 

zhaosi:x:1001:

wq!

./migrate_password.pl passwd users.ldif 将原来的纯文本文件,转换成ldap格式的文件。

./migrate_group.pl group groups.ldif

ldapadd -x -w linuxprobe -D cn=Manager,dc=linuxprobe,dc=com -f users.ldif  dc代表域,linuxprobe.com这个域格式上需要用两个dc表示。cn代表组

ldapadd -x -w linuxprobe -D cn=Manager,dc=linuxprobe,dc=com -f groups.ldif  dc代表域,linuxprobe.com这个域格式上需要用两个dc表示。cn代表组

ldapsearce -x cn=zhaosi -b dc=linuxprobe,dc=com 可以搜索都刚刚创建的用户和组

yum install httpd

cd /etc/openldap/certs

cp cert.pem /var/www/html

systemctl restart httpd

systemct. enable httpd

iptables -F

service iptables save

使用http协议把公钥传输到各个客户端

vim /etc/exports 用nfs协议共享用于家目录数据

/home/ldap 192.168.10.20(rw,sync,root_squash) 只允许192.168.10.20这台ip访问到共享目录,如果使用*就代表哦所有网段都能访问。root_squash比喻外国元首不能来中国发指令

systemctl restart rpcbind

system enable rpcbind

iptables -F

service iptables save

切换到20服务器

yum install openldap-clients nss-pam-ldapd authconfgtk pam_krb5

 

systeml-config-authentication

添DN 和Server 和cert.pem http://www.lincxprobe.com/cert.pem

10服务器

chmod -Rf 777 /var/www/html

id zhaosi

20服务器

vim /home/ldap

vim /etc/fstab

192.168.10.10:/home/ldap /home/ldap nfs defaults 0 0 

wq!

mount -a 

df -h

su zhaosi

分享到:
评论

相关推荐

    Linux I2C总线分析(主要是probe的方式)

    "Linux I2C总线分析(主要是probe的方式)" Linux I2C总线分析是指Linux操作系统中I2C总线的工作机制和结构。I2C总线是串行总线,它可以实现多个设备之间的数据交换。Linux I2C总线分析可以分为三个组成部分:I2C...

    你了解Embeded linux中的probe.docx

    在嵌入式Linux系统中,`probe`是一个关键机制,用于连接硬件设备(device)与驱动程序(device_driver)。在Linux内核加载过程中,probe机制允许内核发现并初始化硬件设备,确保驱动程序能正确地识别和管理这些设备...

    ucProbe.zip

    6. **跨平台**:ucProbe支持Windows、Linux和Mac OS操作系统,满足不同开发环境的需求。 7. **源码级调试**:通过集成的GDB调试服务器,ucProbe能实现源码级别的调试,这对于理解代码执行流程和查找错误至关重要。 ...

    详解Linux驱动中,probe函数何时被调用

    在Linux驱动程序中,`probe`函数是设备驱动的核心部分,用于初始化和配置硬件设备。这个函数的调用时机和过程是设备驱动模型中的关键环节。当我们在编写驱动时,通常会定义一个`probe`函数,该函数会在特定条件下被...

    Linux_I2C总线驱动分析(主要是probe的方式)

    probe 是 I2C 设备驱动中非常重要的一个步骤,在 probe 中,我们需要根据设备的地址等信息来探测设备,并注册设备驱动。这一步骤非常重要,因为它决定了设备驱动的生命周期。 在 Linux 中,I2C 设备驱动的实现主要...

    probe_basic:LinuxCNC机器控件的用户界面

    文献资料安装开发安装QtPyVCP使用文档资源 (#hazzy)(隔离) (#qtpyvcp:matrix.org)(桥接) (桥接) (桥接)依存关系 Python 2.7 PyQt5或PySide2 Probe Basic是使用LinuxCNC Debian 9 x64(拉伸) 和Ubuntu ...

    浅谈Linux设备驱动.pdf

    Linux 设备驱动程序浅谈 Linux 设备驱动程序是指用于操作系统和硬件设备之间的交互接口。它是一个小程序,包含有关硬件设备的信息,用于管理计算机的硬件资源。 Linux 设备驱动程序扮演沟通的角色,把硬件的功能...

    qmi_wwan.rar_V2 _linux lte_linux qmi_qmi_qmi_wwan

    标题中的"qmi_wwan.rar_V2_linux lte_linux qmi_qmi_qmi_wwan"揭示了这个压缩包是关于Linux系统下用于3G和4G(LTE)无线广域网(WWAN)设备的驱动程序。这里的关键词"V2"表示这是驱动的第二个版本,通常意味着比之前...

    util-linux-ng-2.17源码(含fdisk)

    util-linux-ng-2.17.2/shlibs/blkid/src/probe.c [code] util-linux-ng-2.17.2/shlibs/blkid/src/read.c [code] util-linux-ng-2.17.2/shlibs/blkid/src/resolve.c [code] util-linux-ng-2.17.2/shlibs/blkid/src...

    linux_driver.rar_linux pcie 驱动_linux驱动pcie_pcie driver_pcie linu

    - 编写识别设备的`probe`函数,通过比较设备ID(Vendor ID和Device ID)来确定是否支持该设备。 - 注册中断处理程序,处理来自PCIe设备的中断。 - 初始化设备,包括分配资源、设置寄存器、加载固件等。 - 实现...

    qt+gstreamer中如何使用probe(探针)获取帧数据

    在Qt与GStreamer结合开发图像处理应用时,`probe`是一个强大的工具,它允许我们对数据流进行实时分析和操作。...在Linux环境下,这样的技术可以广泛应用于各种图像处理和计算机视觉任务,如视频分析、对象检测等。

    linux usb驱动

    在Linux系统中,USB(通用串行总线)驱动是连接外部设备,如键盘、鼠标、打印机、手机、存储设备等的关键组件。USB驱动程序属于内核的一部分,它负责管理和控制USB设备,使得操作系统能够识别并正确地与这些设备交互...

    RX8025驱动-STM+Linux

    在Linux操作系统中,为了与硬件进行交互,需要适配相应的驱动程序。本篇文章将深入探讨RX8025在STM和Linux环境下的驱动实现以及常见问题。 首先,STM32系列微控制器是意法半导体公司推出的一种基于ARM Cortex-M内核...

    Linux系统下MTD/CFI驱动介绍

    "Linux系统下MTD/CFI驱动介绍" 在Linux系统下,MTD/CFI驱动是Flash存储器的驱动程序。MTD是Memory Technology Device的缩写,是Linux系统下的Flash存储器驱动接口。CFI是Common Flash Interface的缩写,是一个工业...

    at24cxx.rar_AT24Cxx linux_at24c02 linux_at24c02驱动_linux at24c02_

    当内核启动并加载驱动后,会扫描设备树,寻找匹配的平台设备,并调用驱动的probe方法(即初始化函数)。驱动程序在接收到探测请求后,可以通过I²C总线的`i2c_transfer()`函数进行读写操作,实现对AT24C02的访问。 ...

    Zynq-Linux-Timer中断源码加参考文档

    在Zynq-Linux中,axi-timer的初始化过程主要涉及`xilinx_axi_timer_probe()`函数,该函数注册了硬件定时器,并设置初始计数值和中断处理函数。 2. **中断处理**: axi-timer的中断处理函数在`drivers/clk/xilinx/`...

    xenbus_probe.rar_Corporation

    《IBM Corporation Linux驱动程序探索——以xenbus_probe为例》 在开源的世界里,IBM Corporation以其深厚的技术底蕴和对Linux的贡献而闻名。本篇将深入探讨IBM为Linux内核提供的一个关键组件——xenbus_probe,这...

    linux建立MTD分区

    - 在NorFlash芯片被正确识别之后,Linux内核会通过调用`cfi_probe()`函数来初始化芯片。这一步通常发生在驱动加载的过程中。 - `cfi_probe()`函数会根据NorFlash的具体规格配置相应的参数,并设置好读写等操作接口...

    Linux网卡驱动学习笔记

    #### 五、小结 本文详细介绍了Linux网卡驱动中DM9000的工作原理和技术细节。通过对关键概念的理解和关键函数的解析,读者可以更加深入地了解Linux网络子系统的工作机制以及如何编写高效的网络设备驱动。未来的研究...

Global site tag (gtag.js) - Google Analytics