
R1:
no ip routing(不做路由协议了,可以把R1看成是一台电脑)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
interface Serial0
ip address 192.168.10.1 255.255.255.0
ip default-gateway 192.168.10.5
R2:
interface Serial0
ip address 192.168.10.5 255.255.255.0
ip nat inside(定义内部端口)
clockrate 64000
interface Serial1
ip address <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />23.1.1.2 255.255.255.0
ip nat outside(定义外部端口)
clockrate 64000
ip nat pool ABC 23.1.1.2 23.1.1.2 netmask 255.255.255.0(告诉路由器外网地址范围)
access-list 1 permit 192.168.10.0 0.0.0.255(告诉路由器内网地址范围)
ip nat inside source list 1 pool ABC overload(将内网地址和外网地址做转换)(注意:“overload”,其转换方式是复用动态地址转换)
ip route 0.0.0.0 0.0.0.0 23.1.1.3(做默认路由指向外网)
R3:
interface Loopback1
ip address 2.2.2.2 255.0.0.0
interface Serial1
ip address 23.1.1.3 255.255.255.0
R1#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/65/72 ms
R2#sh ip nat trans
Pro Inside global Inside local Outside local Outside global
icmp 23.1.1.2:3896 192.168.10.1:3896 2.2.2.2:3896 2.2.2.2:3896
icmp 23.1.1.2:3897 192.168.10.1:3897 2.2.2.2:3897 2.2.2.2:3897
icmp 23.1.1.2:3898 192.168.10.1:3898 2.2.2.2:3898 2.2.2.2:3898
icmp 23.1.1.2:3899 192.168.10.1:3899 2.2.2.2:3899 2.2.2.2:3899
icmp 23.1.1.2:3900 192.168.10.1:3900 2.2.2.2:3900 2.2.2.2:3900
转载于:https://blog.51cto.com/xinyue651/278010