网络dhcp功能

网络dhcp功能

把linux配置成路由器

dhcp分配信息包括:

ip地址

子网掩码

网关

dns

dhcp租约时间

dhcp服务安装

yum install dhcp -y
cat >  /etc/dhcp/dhcpd.conf <<EOF
subnet 172.16.1.0 netmask 255.255.255.0 {
rango 172.16.1.26 172.16.1.200;
option domain-name-servers 223.5.5.5;
option routers 172.16.1.12;
option broadcast-address 172.16.1.255;
default-local-time 3600;
max-lease-time 7200;
}
EOF
systemctl start dncpd  
netstat -lnutp |grep dhcp  67端口
systemctl enable dncpd

cat > /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
TYPE=Ethernet
BOOTPROTO=dhcp
NAME=eth0
DEVICE=eth0
ONBOOT=yes
EOF

systemctl restart network
ip addr 
ping 223.5.5.5
posted @ 2021-03-07 23:14  上善若水~小辉  阅读(134)  评论(0编辑  收藏  举报