DHCP实验

src:

dhcp-4.3.5

http://www.linuxfromscratch.org/blfs/view/svn/basicnet/dhcp.html

[root@svr5 桌面]# service dhcpd restart      //启动服务

关闭 dhcpd:     [确定]

正在启动 dhcpd: [确定]

[root@svr5 桌面]# chkconfig dhcpd on         //保证服务开机启动

[root@svr5 桌面]# netstat -anptu | grep dhcp //该有dhcpd的进程,UDP的67端口

udp 0 0 0.0.0.0:67 0.0.0.0:* 4144/dhcp


重启网卡可以重新获取原先配置的ip:

ifdown  ifup


release以后,DHCP将重新获取ip:


/usr/sbin/dhclient -r


DHCP server 参考配置:vim /etc/dhcp/dhcpd.conf

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#   see 'man 5 dhcpd.conf'
#
default-lease-time 7200;
max-lease-time 14400;
subnet 192.168.17.0 netmask 255.255.255.0 {      # 子网
option routers 192.168.17.95;                                # 路由设置为server本机的ip
option domain-name "desktop.zyd";
option domain-name-servers 202.106.0.20,8.8.8.8;
range 192.168.17.50 192.168.17.100;                   # 必须在子网范围内
}


客户端请求分配ip:

/usr/sbin/dhclient -d eth0

client发送option60: vim /etc/dhclient.conf

interface  "eth0" {
       send vendor-class-identifier "\0224\001\006HHZZFF\002\003STB\003\bTWSZ950G\004\0041.08\005\004";
#注解:上面即PC机作为DHCP Client时,要求携带DHCP Option 60,值可以根据不同客户需求设置不同的值
       request subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-name-servers, host-name, netbios-name-servers, netbios-scope;
#注解:上面即DHCP Option 55中的相关内容。可以设置不同的参数集合
}


查看服务端已经分配出去的IP地址信息

# cat /var/lib/dhcpd/dhcpd.leases


openssl

https://www.openssl.org/source/

https://github.com/openssl/openssl



你可能感兴趣的:(Network)