《RHEL5dhcp中继.doc》由会员分享,可在线阅读,更多相关《RHEL5dhcp中继.doc(5页珍藏版)》请在金锄头文库上搜索。
1、RHEL5下的DHCP服务和DHCP中继rootlocalhost # rpm -q dhcppackage dhcp is not installed ( 查看dhcp包没有安装)rootlocalhost # mount /dev/cdrom /mnt (挂载光盘并安装dhcp包)mount: block device /dev/cdrom is write-protected, mounting read-onlyrootlocalhost # rpm -ivh /mnt/Server/dhcp-3.0.5-3.el5.i386.rpmwarning: /mnt/Server/dhcp-
2、3.0.5-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186Preparing. # 100% 1:dhcp # 100%rootlocalhost # vi /etc/dhcpd.conf (编辑dhcp配置文件,建两个作用域)# DHCP Server Configuration file.# see /usr/share/doc/dhcp*/dhcpd.conf.sample#ddns-update-style interim;default-lease-time 21600;max-lease-time 43
3、200;option domain-name ;option domain-name-servers 192.168.0.20;subnet 192.168.0.0 netmask 255.255.255.0 range 192.168.0.100 192.168.0.200; option subnet-mask 255.255.255.0; option routers 192.168.0.254;subnet 172.16.0.0 netmask 255.255.0.0 range 172.16.0.100 172.16.0.200; option subnet-mask 255.255
4、.0.0; option routers 172.16.0.254;/etc/dhcpd.conf 19L, 522C (保存退出)rootlocalhost # service dhcpd start (启动dhcp服务)Starting dhcpd: OK rootlocalhost # netstat -nupl (查看当前的UDP端口侦听)Active Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nameudp 0 0 0.0
5、.0.0:943 0.0.0.0:* 1615/rpc.statdudp 0 0 0.0.0.0:946 0.0.0.0:* 1615/rpc.statdudp 0 0 0.0.0.0:67 0.0.0.0:* 3438/dhcpd udp 0 0 0.0.0.0:111 0.0.0.0:* 1590/portmapudp 0 0 0.0.0.0:631 0.0.0.0:* 1850/cupsd客户端获取到的IP信息如下:rootlocalhost # cat /var/lib/dhcpd/dhcpd.leases (查看租约文件)lease 192.168.0.200 starts 5 20
6、08/11/14 10:18:35;ends 5 2008/11/14 16:18:35;binding state active;next binding state free;hardware ethernet 00:03:ff:44:1a:b9;uid 001000003377D032271;client-hostname dc;rootlocalhost # chkconfig -level 35 dhcpd on (设置dhcp服务在35级别自动启动)DHCP中继的实现:ogin as: root (使用管理员用户登陆)root192.168.0.254s password:Last
7、 login: Fri Nov 14 04:33:18 2008 from 192.168.0.2rootlocalhost # mount /dev/cdrom /mnt (挂载光盘并安装dhcp包)mount: block device /dev/cdrom is write-protected, mounting read-onlyrootlocalhost # rpm -ivh /mnt/Server/dhcp-3.0.5-3.el5.i386.rpmwarning: /mnt/Server/dhcp-3.0.5-3.el5.i386.rpm: Header V3 DSA signat
8、ure: NOKEY, key ID 37017186Preparing. # 100% 1:dhcp # 100%rootlocalhost # rpm -ql dhcp |grep /etc (查看dhcp包包含在/etc目录下的文件信息)/etc/dhcpd.conf/etc/rc.d/init.d/dhcpd/etc/rc.d/init.d/dhcrelay/etc/sysconfig/dhcpd/etc/sysconfig/dhcrelayrootlocalhost # vi /etc/sysconfig/dhcrelay (编辑/etc/sysconfig/dhcrelay 文件并
9、启用中继功能)# Command line options hereINTERFACES=eth0 eth1 (定义在那个网卡上启用中继功能)DHCPSERVERS=192.168.0.20 (定义dhcp服务器的IP)rootlocalhost # service dhcrelay start (启用中继服务)Starting dhcrelay: Internet Systems Consortium DHCP Relay Agent V3.0.5-RedHatCopyright 2004-2006 Internet Systems Consortium.All rights reserve
10、d.For info, please visit http:/www.isc.org/sw/dhcp/Listening on LPF/eth1/00:03:ff:4d:1a:b9Sending on LPF/eth1/00:03:ff:4d:1a:b9Listening on LPF/eth0/00:03:ff:42:1a:b9Sending on LPF/eth0/00:03:ff:42:1a:b9Sending on Socket/fallback OK rootlocalhost # netstat -unpl (查看UDP端口的侦听信息)Active Internet connect
11、ions (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nameudp 0 0 0.0.0.0:646 0.0.0.0:* 1742/rpc.statdudp 0 0 0.0.0.0:649 0.0.0.0:* 1742/rpc.statdudp 0 0 0.0.0.0:67 0.0.0.0:* 3139/dhcrelayudp 0 0 0.0.0.0:111 0.0.0.0:* 1717/portmapudp 0 0 0.0.0.0:631 0.0.0.0:* 1977/cupsdrootlocalhost # chkconfig -level 35 dhcrelay on (设置dhcp中继服务在35级别自动启用)