动态
NAT
的配置:
Router 0
的配置:
Router>en
Router#configure terminal
Router(config)#int f0/0
Router(config-if)#ip add 10.1.1.1 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#int f0/1
Router(config-if)#ip add 2.2.2.1 255.0.0.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#router rip
Router(config-router)#network 10.0.0.0
Router(config-router)#network 2.0.0.0
Router(config-router)#end
Router#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
C 2.0.0.0/8 is directly connected, FastEthernet0/1
R 3.0.0.0/8 [120/1] via 2.2.2.2, 00:00:08, FastEthernet0/1
C 10.0.0.0/8 is directly connected, FastEthernet0/0
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#ip nat pool zhiduan 2.2.2.3 2.2.2.4 ne
Router(config)#ip nat pool zhiduan 2.2.2.3 2.2.2.4 netmask 255.0.0.0
Router(config)#access-list 1 permit 10.1.1.2 0.0.0.0
Router(config)#access-list 1 permit 10.1.1.3 0.0.0.0
Router(config)#ip nat inside source list 1 pool zhiduan
Router(config)#int f0/0
Router(config-if)#ip nat inside
Router(config-if)#int f0/1
Router(config-if)#ip nat outside
Router(config-if)#end
Router#ping 3.3.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 47/59/63 ms
Router#
Router#show ip nat translations
Pro Inside global Inside local Outside local Outside global
--- 2.2.2.4 10.1.1.2 --- ---
--- 2.2.2.3 10.1.1.3 --- ---
Router#
<PAT
的配置
>
Router#configure terminal
Router(config)#ip nat inside source list 1 pool zhiduan ?
overload Overload an address translation
<cr>
Router(config)#ip nat inside source list 1 pool zhiduan overload
Router(config)#end
Router#clear ip nat translation *
再次
ping
测试
Router#show ip nat translations
Pro Inside global Inside local Outside local Outside global
icmp 2.2.2.4:4 10.1.1.2:4 3.3.3.2:4 3.3.3.2:4
icmp 2.2.2.4:5 10.1.1.3:5 3.3.3.2:5 3.3.3.2:5
Router#
Router 1
的配置:
Router>en
Router#configure terminal
Router(config)#int f0/0
Router(config-if)#ip add 3.3.3.1 255.0.0.0
Router(config-if)#no shut
Router(config-if)#int f0/1
Router(config-if)#ip add 2.2.2.2 255.0.0.0
Router(config-if)#no shut
Router(config-if)#exit
Router(config)#router rip
Router(config-router)#network 2.0.0.0
Router(config-router)#network 3.0.0.0
Router(config-router)#end
Router#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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
C 2.0.0.0/8 is directly connected, FastEthernet0/1
C 3.0.0.0/8 is directly connected, FastEthernet0/0
R 10.0.0.0/8 [120/1] via 2.2.2.1, 00:00:19, FastEthernet0/1
Router#ping 2.2.2.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 78/90/94 ms
Router#ping 2.2.2.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 63/84/94 ms
Router#