linux dhcp配置 dhcp多网段配置
原创
©著作权归作者所有:来自51CTO博客作者lxl900512的原创作品,请联系作者获取转载授权,否则将追究法律责任
Dhcp安装配置
方法一:
1、Yum –y install dhcp
方法二:
挂载光盘:
Mkdir –p /home/cd
mount /dev/cdrom /home/cd
cd /home/cd/
ls | grep dhcp
rpm –ivh dhcp……….rpm
2、查看默认的配置文件及路径:
Cat /etc/dhcpd.conf
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
Cp:是否覆盖?/etc/dhcpd.conf?y
# vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
shared-network xiaolong {
option domain-name-servers 202.96.134.33,8.8.8.8;
default-lease-time 21600;
max-lease-time 43200;
option time-offset -18000;
subnet 192.168.10.0 netmask 255.255.255.0 {
option routers 192.168.10.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.10.30 192.168.10.220;
}
subnet 192.168.20.0 netmask 255.255.255.0 {
option routers 192.168.20.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.20.30 192.168.20.220;
}
}
eth0 Link encap:Ethernet HWaddr 00:0C:29:4E:65:44
inet addr:192.168.10.1 Bcast:192.168.3.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:505089 errors:0 dropped:0 overruns:0 frame:0
TX packets:13462 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:62108907 (59.2 MiB) TX bytes:1827624 (1.7 MiB)
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:4E:65:44
inet addr:192.168.20.1 Bcast:192.168.3.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth0:2 Link encap:Ethernet HWaddr 00:0C:29:4E:65:44
inet addr:192.168.30.1 Bcast:192.168.3.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
3、运用在那个网卡/etc/sysconfig/dhcpd配置
# vi /etc/sysconfig/dhcpd
# Command line options here
DHCPDARGS= (”eth0 eth1”)
4、启动服务:
# service dhcpd start
# netstat -anpu | grep dhcpd
udp 0 0 0.0.0.0:67 0.0.0.0:* 2934/dhcpd
5、查看地址获取:
# tail -50 /var/lib/dhcpd/dhcpd.leases
6、DHCP中继:
1、开启路由转发:
# vi /etc/sysctl.conf
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
#sysctl –p
2、设置允许DHCP中继数据的接口及DHCP服务器的IP地址:
# vi /etc/sysconfig/dhcrelay
# Command line options here
INTERFACES="eth0 eth1"
DHCPSERVERS="192.168.1.1"
3、启动中继程序:
Service dhcrelay start
Chkconfig –level 35 dhcrelay on
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
DHCP单网卡多网段配置
Linux DHCP单网卡多网段
职场 DHCP 休闲 单网卡 多网段 -
PXE 跨网段 DHCP 选项配置
1.066 启动服务器主机名2.067启动文件名
职场 DHCP 休闲 pxe 跨网段 -
配置Linux DHCP
Linux下配置DHCP(动态地址分配服务)的过程
Linux 职场 DHCP 休闲