本实验使用PT来完成DHCP,NAT,DNS的一个实验集合,个人感觉很好玩的一个实验,虽然实验很简单,但是能够明确的表达出DHCP运行的过程,以及DNS运作同时还有NAT的转换。好了,开始:
实验拓扑
配置要点
PC0使用动态获取地址:
路由器DHCP的相关配置:
ip dhcp excluded-address 192.168.1.1 192.168.1.10
ip dhcp pool A
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
dns-server 172.16.10.2
看下两个路由器的路由表:
R1#show ip route
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial0/3/0
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.10.0 is directly connected, FastEthernet0/1
C 192.168.1.0/24 is directly connected, FastEthernet0/0
S* 0.0.0.0/0 [1/0] via 12.1.1.2
R2#show ip route
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial0/3/0
C 202.102.224.0/24 is directly connected, FastEthernet0/0
R1上做了NAT:
ip nat pool A 12.1.1.1 12.1.1.1 netmask 255.255.255.0
ip nat inside source list 1 pool A overload
ip classless
ip route 0.0.0.0 0.0.0.0 12.1.1.2
access-list 1 permit 192.168.1.0 0.0.0.255
所以PC0可以和Server1通信:
PC>ping 202.102.224.68
Pinging 202.102.224.68 with 32 bytes of data:
Reply from 202.102.224.68: bytes=32 time=94ms TTL=126
Reply from 202.102.224.68: bytes=32 time=93ms TTL=126
Reply from 202.102.224.68: bytes=32 time=94ms TTL=126
Reply from 202.102.224.68: bytes=32 time=94ms TTL=126
Ping statistics for 202.102.224.68:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 93ms, Maximum = 94ms, Average = 93ms
查看R1的dubug信息:
R1#debug ip nat
IP NAT debugging is on
NAT: s=192.168.1.11->12.1.1.1, d=202.102.224.68 [17]
NAT*: s=202.102.224.68, d=12.1.1.1->192.168.1.11 [27]
最后看下Server0设置:
前边截图可以看到,PC0的DNS指向Server0,最后访问一下www.google.com:
看下Server1上的设置:
很好玩吧!
本文出自 “没兴趣” 博客,转载请与作者联系!