动态NAT的配置

TOP 图如上图
 
 
R1 的配置:
Press Enter to Start
 
 
Router>
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R1
R1(config)#int e0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#ip nat inside
R1(config-if)#no shut
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
R1(config-if)#int s0
R1(config-if)#ip add 192.168.2.5 255.255.255.252
R1(config-if)#ip nat outside
R1(config-if)#clock rate 1000000
R1(config-if)#no shut
%LINK-3-UPDOWN: Interface Serial0, changed state to up
%LINK-3-UPDOWN: Interface Serial0, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to down
R1(config-if)#encapsulation hdlc
R1(config-if)#exit
R1(config)#access-list 1 permit 192.168.1.0 0.0.0 .255 // 设置允许访问的内部 IP 地址列表
R1(config)#ip nat pool ssss 202.101.1.1 202.101.2.10 netmask 255.255.255.0 // 配置全局 IP 地址池 ssss
R1(config)# ip nat inside source list 1 pool ssss overload // 蓝色部分 和静态的 NAT 是一样的,只是内部地址改为 list 1, 而内部全局地址孜为了 pool ssss
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#network 192.168.1.0
R1(config-router)#network 192.168.2.4
R1(config-router)#end
%LINK-3-UPDOWN: Interface Serial0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0, changed state to up
 
R2 的配置:
 
 
Press Enter to Start
 
 
Router>
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R2
R2(config)#int e0
R2(config-if)#ip add 202.101.6.1 255.255.255.0
R2(config-if)#no shut
%LINK-3-UPDOWN: Interface Ethernet0, changed state to up
R2(config-if)#int s0
R2(config-if)#ip add 192.168.2.6 255.255.255.252
R2(config-if)#no shut
%LINK-3-UPDOWN: Interface Serial0, changed state to up
R2(config-if)#exit
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#network 192.168.2.4
R2(config-router)#network 202.101.6.0
R2(config-router)#end
R2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
// 配置 R2 telnet
R2(config)#line vty 0 4
R2(config-line)#login
R2(config-line)#password cisco
R2(config-line)#end
 
R1 R2 上查看 NAT 信息:
1 R1#sh ip nat translations
Pro  Inside global     Inside local      Outside local      Outside global
icmp202.101.1.1:9392      192.168.1.2:9392      202.101.6.1:9392       202.101.6.1:9392
icmp202.101.1.1:9393      192.168.1.2:9393      202.101.6.1:9393       202.101.6.1:9393
icmp202.101.1.1:9394      192.168.1.2:9394      202.101.6.1:9394       202.101.6.1:9394
icmp202.101.1.1:9395      192.168.1.2:9395      202.101.6.1:9395       202.101.6.1:9395
icmp202.101.1.1:9396      192.168.1.2:9396      202.101.6.1:9396       202.101.6.1:9396
 
 
icmp202.101.1.1:9392      192.168.1.2:9392      202.101.6.2:9392       202.101.6.2:9392
icmp202.101.1.1:9393      192.168.1.2:9393      202.101.6.2:9393       202.101.6.2:9393
icmp202.101.1.1:9394      192.168.1.2:9394      202.101.6.2:9394       202.101.6.2:9394
icmp202.101.1.1:9395      192.168.1.2:9395      202.101.6.2:9395       202.101.6.2:9395
icmp202.101.1.1:9396      192.168.1.2:9396      202.101.6.2:9396       202.101.6.2:9396
 
 
icmp202.101.1.1:9392      192.168.1.3:9392      202.101.6.1:9392       202.101.6.1:9392
icmp202.101.1.1:9393      192.168.1.3:9393      202.101.6.1:9393       202.101.6.1:9393
icmp202.101.1.1:9394      192.168.1.3:9394      202.101.6.1:9394       202.101.6.1:9394
icmp202.101.1.1:9395      192.168.1.3:9395      202.101.6.1:9395       202.101.6.1:9395
icmp202.101.1.1:9396      192.168.1.3:9396      202.101.6.1:9396       202.101.6.1:9396
2 、用 host 1 telnet R2 ,然后查看 users:
   telnet 202.101.6.1
   show users
 

你可能感兴趣的:(职场,配置,动态,NAT,休闲)