博客统计信息

51cto博客之星
用户名:hackerjx
文章数:61
评论数:538
访问量:357895
无忧币:2009
博客积分:3387
博客等级:7
注册日期:2008-05-18

如何配置DHCP中继服务
2009-10-23 10:51:16
版权声明:原创作品,如需转载,请与作者联系。否则将追究法律责任。
通过本实验掌握如何给不同网段配置DHCP,掌握DHCP中继配置,了解ip help-address 作用,了解Cisco 路由器的DHCP的配置。也许你会配置DHCP,可是可能遇到的情况是很顺利,有时你的DHCP服务器,和你DHCP 客户端,并不是在同一个网段,而是需要DHCP 给不同的网段主机分配地址。



实验拓扑:
 
image
实验过程:
第一步: 对路由器R1进行预配置
Router(config)#no ip do lo
Router(config)#line con 0
Router(config-line)#no exec-t
Router(config-line)#logg syn
Router(config-line)#host R1
R1(config)#do sh ip int bri
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 unassigned YES unset administratively down down
Serial0/0 unassigned YES unset administratively down down
Ethernet1/0 unassigned YES unset administratively down down
Serial1/0 unassigned YES unset administratively down down
R1(config)#int e0/0
//配置接口的下描述信息
R1(config-if)#description Connection to R2_E0/0
R1(config-if)#ip add 12.0.0.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#end
R1(config)#int e1/0
R1(config-if)#description Connection to PC1
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#
*Mar 1 00:32:04.807: %LINK-3-UPDOWN: Interface Ethernet1/0, changed state to up
*Mar 1 00:32:05.807: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet1/0, changed state to up
R1(config-if)#*Mar 1 00:09:16.631: %SYS-5-CONFIG_I: Configured from console by console
R1#conf t
*Mar 1 00:09:17.499: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
//配置远程登录的用户名和密码,如果用户的级别为15,远程登录之后可以直接进入特权模式下
R1(config)#username admin privilege 15 password admin
R1(config)#line vty 0 4
R1(config-line)#login local
R1(config-line)#end
R1#
R1#
第二步: 对路由器R2进行预配置
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R2
R2(config)#no ip do lo
R2(config)#line con 0
R2(config-line)#no exec-t
R2(config-line)#logg syn
R2(config-line)#int e0/0
R1(config-if)#description Connection to R1_E0/0
R2(config-if)#ip add 12.0.0.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
*Mar 1 00:10:09.331: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar 1 00:10:10.331: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
R2(config)#username admin privilege 15 password admin
R2(config)#line vty 0 15
R2(config-line)#login local
R2(config-line)#end
*Mar 1 00:10:21.363: %SYS-5-CONFIG_I: Configured from console by console
R2#ping 12.0.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.0.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms
R2#
第三步:在R1运行动态路由协议,配置DHCP
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
//配置动态路由协议,保证两个不同的网段可以相互通信
R1(config)#router rip
R1(config-router)#ver 2
R1(config-router)#no au
R1(config-router)#net 12.0.0.1
R1(config-router)#net 192.168.1.1
R1(config-router)#exit
//开启DCHP服务
R1(config)#service dhcp
R1(config)#no ip dhcp conflict logging
R1(config)#ip dhcp pool PC1_Subnet
R1(dhcp-config)#network 192.168.1.0 /24
R1(dhcp-config)#default-router 192.168.1.1
R1(dhcp-config)#domain-name cisco.com
R1(dhcp-config)#dns-server 218.30.19.40 61.134.1.4
R1(dhcp-config)#option 150 ip 192.168.1.10
R1(dhcp-config)#lease 7
R1(dhcp-config)#exit
R1(config)#ip dhcp excluded-address 192.168.1.1
R1(config)#ip dhcp excluded-address 192.168.1.10
R1(config)#ip dhcp pool PC2_Subnet
R1(dhcp-config)#network 172.16.1.0 /24
R1(dhcp-config)#default-router 172.16.1.1
R1(dhcp-config)#domain-name norvel.com
R1(dhcp-config)#dns-server 218.30.19.40 61.134.1.4
R1(dhcp-config)#option 150 ip 172.16.1.10
R1(dhcp-config)#lease 7
R1(dhcp-config)#exit
R1(config)#ip dhcp excluded-address 172.16.1.1
R1(config)#ip dhcp excluded-address 172.16.1.10
R1#show run | b ip dhcp
no ip dhcp conflict logging
ip dhcp excluded-address 192.168.1.1
ip dhcp excluded-address 192.168.1.10
ip dhcp excluded-address 172.16.1.1
ip dhcp excluded-address 172.16.1.10
ip dhcp pool PC1_Subnet
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
domain-name cisco.com
dns-server 218.30.19.40 61.134.1.4
option 150 ip 192.168.1.10
lease 7
ip dhcp pool PC2_Subnet
network 172.16.1.0 255.255.255.0
default-router 172.16.1.1
domain-name norvel.com
dns-server 218.30.19.40 61.134.1.4
option 150 ip 172.16.1.10
lease 7
R1(config)#
第四步:在R2运行动态路由协议,配置辅助地址
R1#telnet 12.0.0.2
Trying 12.0.0.2 ... Open
User Access Verification
Username: admin
Password:
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int e1/0
R2(config-if)#ip ad 172.16.1.1 255.255.255.0
R2(config-if)#no sh
R2(config-if)#router rip
R2(config-router)#ver 2
R2(config-router)#no au
R2(config-router)#net 12.0.0.2
R2(config-router)#net 172.16.1.1
R2(config-router)#exit
R2(config)#int e1/0
//配置DHCP中继地址
R2(config-if)#ip helper-address 12.0.0.1
R2(config-if)#
R1#sh ip int bri
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 12.0.0.1 YES manual up up
Serial0/0 unassigned YES unset administratively down down
Ethernet1/0 192.168.1.1 YES manual up up
Serial1/0 unassigned YES unset administratively down down
第五步:在PC1PC2上查看获得IP地址信息
开始-运行-cmd-ipconfig /all
如图: PC2
image
如图:PC1
image
第六步:查看交换机IP地址池和动态绑定信息
R1#show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address Client-ID/ Lease expiration Type
Hardware address/
User name
172.16.1.2 0100.8045.2984.f2 Mar 08 1993 12:52 AM Automatic
192.168.1.2 0100.16d3.249f.fd Mar 08 1993 12:51 AM Automatic
R1#
R1#show ip dhcp pool
Pool PC1_Subnet :
Utilization mark (high/low) : 100 / 0
Subnet size (first/next) : 0 / 0
Total addresses 254
Leased addresses 1
Pending event none
1 subnet is currently in the pool :
Current index IP address range Leased addresses
192.168.1.3 192.168.1.1 - 192.168.1.254 1
Pool PC2_Subnet :
Utilization mark (high/low) : 100 / 0
Subnet size (first/next) : 0 / 0
Total addresses : 254
Leased addresses : 1
Pending event : none
1 subnet is currently in the pool :
Current index IP address range Leased addresses
172.16.1.3 172.16.1.1 - 172.16.1.254 1
R1#
R1#sh ip ro
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
R 172.16.1.0 [120/1] via 12.0.0.2, 00:00:24, Ethernet0/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, Ethernet0/0
C 192.168.1.0/24 is directly connected, Ethernet1/0
R1#debug ip dhcp server events
R1#
*Mar 1 01:12:33.367: DHCPD: assigned IP address 172.16.1.2 to client 0100.8045.2984.f2.
R1#telnet 12.0.0.2
Trying 12.0.0.2 ... Open
User Access Verification
Username: admin
Password:
R2#sh run int e1/0
interface Ethernet1/0
ip address 172.16.1.1 255.255.255.0
ip helper-address 12.0.0.1
half-duplex
第七步:测试全网互联互通
C:\ping 172.16.1.1
Pinging 172.16.1.1 with 32 bytes of data:
Reply from 172.16.1.1: bytes=32 time=2ms TTL=255
Reply from 172.16.1.1: bytes=32 time=2ms TTL=255
Ping statistics for 172.16.1.1:
Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 2ms, Average = 2ms
Control-C
^C
C:\ping 12.0.0.2
Pinging 12.0.0.2 with 32 bytes of data:
Reply from 12.0.0.2: bytes=32 time=2ms TTL=255
Ping statistics for 12.0.0.2:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 2ms, Average = 2ms
Control-C
^C
C:\ping 12.0.0.1
Pinging 12.0.0.1 with 32 bytes of data:
Reply from 12.0.0.1: bytes=32 time=2ms TTL=254
Reply from 12.0.0.1: bytes=32 time=2ms TTL=254
Ping statistics for 12.0.0.1:
Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 2ms, Average = 2ms
Control-C
^C
C:\ping 192.168.1.1
Pinging 192.168.1.1 with 32 bytes of data:
Reply from 192.168.1.1: bytes=32 time=3ms TTL=254
Ping statistics for 192.168.1.1:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 3ms, Maximum = 3ms, Average = 3ms
Control-C
^C
C:\ping 192.168.1.2
Pinging 192.168.1.2 with 32 bytes of data:
Reply from 192.168.1.2: bytes=32 time=5ms TTL=126
Ping statistics for 192.168.1.2:
Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 5ms, Maximum = 5ms, Average = 5ms
Control-C
^C

本文出自 “王万利的博客” 博客,转载请与作者联系!

分享至
更多
一键收藏,随时查看,分享好友!
365550107、qwe669306710
2人
了这篇文章
类别:Cisco技术圈()┆阅读()┆评论() ┆ 推送到技术圈返回首页

文章评论

 <<   1   2   >>   页数 ( 1/2 )  
2009-10-27 11:18:59
写的很不错哦
博主回复:
2009-10-28 00:36:23
谢谢不客气。

2009-10-28 00:18:46
好牛。。
博主回复:
2009-10-28 13:18:28
你的文章也不错哦。

2009-10-28 11:46:31
博主說說你用的哪個模擬器吧,啥版本的.
博主回复:
2009-10-28 13:19:37
你好,我这是真实环境

2009-10-28 13:08:57
配置过程很详细~
博主回复:
2009-10-28 13:20:05
是吗,看完了有什么问题吗?

2009-10-28 14:14:33
如果模擬器中沒有IP HELP-ADDRESS個這命令,不知如何才能達到本實驗的效果.
博主回复:
2009-10-28 16:27:13
你用的是什么模拟器?
Cisco Packet Tracert 5.0
你用2811路由器,在接口下就可以支持ip-helper address

2009-10-28 17:10:51
ip helper-address ,很关键的命令.

2009-10-29 19:24:54
大致看了下,没有发现什么问题。

哪天有空了我再做一边试试。
博主回复:
2009-10-29 20:12:32
好的,等你来提问。

2009-11-05 10:58:20
好牛,都是推荐的,博主牛人啊
博主回复:
2009-11-05 11:30:30
不敢不敢,欢迎大侠前来指导。

2009-11-07 23:51:19
你的dhcp relay写的确实详细,但是现实的网络环境中可能不会这样的吧,呵呵,尤其这样的环境,企业网用的比较多,势必会涉及三层switch,或许还有添加dhcp snooping,arp inspection,这些可以添加上去做个复杂点的,呵呵。
博主回复:
2009-11-07 23:57:27
是啊,一个企业环境中是复杂的,要求是多变的,一台设备上不可能只有1条配置。感想你来支持,后续的博客中我会加一些工程案例,会涉及到这些需求。
欢迎大家及时来批评指正。

2009-11-13 23:20:19
哈哈 很强 写的很好
博主回复:
2009-11-14 00:40:36
谢谢支持。欢迎常来交流心得体会

2009-11-17 14:48:30
写的非常好 如果网络中存在 多个vlan 那么应该在int vlan下打上中继吧?
博主回复:
2009-11-17 19:44:03
感谢您的支持!
不同VLAN之间相互通信并且通过DHCP 获得IP地址。
请看http://hackerjx.blog.51cto.com/383839/215389

2010-01-05 09:19:42
很详细!!!我是个网络初学者,现在什么都不懂,不过我会努力的!怎样才能学好网络呢,楼主有什么好建议,呵呵,谢谢楼主!!!!!
博主回复:
2010-01-05 22:38:04
1,制定一个学习的计划,按照自己的学习方向努力
2,有一个系统的,科学的学习课程科目
3,多与别人交流。

2010-11-22 22:05:18
看看,正在学这个。

2010-11-22 22:57:10
配置后能得到IP地址,但R1pingPC2时不能通,R2ping PC1时也ping 不通,路由都学到了。几个网段都有。问一下这是怎么回事。

2010-11-22 22:57:21
配置后能得到IP地址,但R1pingPC2时不能通,R2ping PC1时也ping 不通,路由都学到了。几个网段都有。问一下这是怎么回事。

 <<   1   2   >>   页数 ( 1/2 )  

发表评论            

【技术门诊】专家解析:软考重点难点及应试技巧
昵  称:
登录  快速注册
验证码:

请点击后输入验证码博客过2级,无需填写验证码

内  容: