CCNA实验:配置NAT静态映射(nat静态映射作用)

网友投稿 313 2022-09-22


CCNA实验:配置NAT静态映射(nat静态映射作用)

R2(config)#int s2/1R2(config-if)#ip add 192.168.0.2 255.255.255.0R2(config-if)#no shR2(config-if)#exitR2(config)#router ospf 1R2(config-router)#net 0.0.0.0 0.0.0.0 area 0R2(config-router)#

R3(config)#int s3/1R3(config-if)#ip add 131.1.1.3 255.255.255.0R3(config-if)#no shR3(config-if)#exitR3(config)#^ZR3(config)#router ospf 1R3(config-router)#net 0.0.0.0 0.0.0.0 area 0

第二步:在R1上定义NAT的静态映射R1(config)#int s1/2R1(config-if)#ip nat inR1(config-if)#ip nat inside R1(config)#int s1/3R1(config-if)#ip nat outsideR1(config-if)#第三步:在R1上定义NAT的静态映射R1(config)#ip nat inside source static 192.168.0.2 131.1.1.1R1(config)#exit第四步:在R2上进行pingR2#sh ip rouCodes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate defaultU - per-user static route, o - ODRT - traffic engineered route

Gateway of last resort is not set

131.1.0.0/24 is subnetted, 1 subnetsO 131.1.1.0 [110/128] via 192.168.0.1, 00:09:10, Serial2/1C 192.168.0.0/24 is directly connected, Serial2/1R2#ping 131.1.1.3

Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 131.1.1.3, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 48/72/104 msR2# 第五步:在R2ping的同时打开R1的nat过程R1#debug ip nat detailed IP NAT detailed debugging is onR1#00:21:08: NAT: i: icmp (192.168.0.2, 243) -> (131.1.1.3, 243) [5]00:21:08: NAT: o: icmp (131.1.1.3, 243) -> (131.1.1.1, 243) [5]00:21:08: NAT: i: icmp (192.168.0.2, 244) -> (131.1.1.3, 244) [6]00:21:08: NAT: o: icmp (131.1.1.3, 244) -> (131.1.1.1, 244) [6]00:21:08: NAT: i: icmp (192.168.0.2, 245) -> (131.1.1.3, 245) [7]00:21:08: NAT: o: icmp (131.1.1.3, 245) -> (131.1.1.1, 245) [7]00:21:08: NAT: i: icmp (192.168.0.2, 246) -> (131.1.1.3, 246) [8]00:21:08: NAT: o: icmp (131.1.1.3, 246) -> (131.1.1.1, 246) [8]00:21:08: NAT: i: icmp (192.168.0.2, 247) -> (131.1.1.3, 247) [9]00:21:08: NAT: o: icmp (131.1.1.3, 247) -> (131.1.1.1, 247) [9]

R1#debug ip natIP NAT debugging is onR1#00:22:21: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [10]//可以看到源地址是由192.168.0.2转换为131.1.1.100:22:21: NAT: s=131.1.1.3, d=131.1.1.1->192.168.0.2 [10]00:22:21: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [11]00:22:21: NAT: s=131.1.1.3, d=131.1.1.1->192.168.0.2 [11]00:22:21: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [12]00:22:21: NAT: s=131.1.1.3, d=131.1.1.1->192.168.0.2 [12]00:22:21: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [13]00:22:21: NAT: s=131.1.1.3, d=131.1.1.1->192.168.0.2 [13]00:22:21: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [14]00:22:21: NAT: s=131.1.1.3, d=131.1.1.1->192.168.0.2 [14]R1#

R1#sh ip nat statistics Total active translations: 1 (1 static, 0 dynamic; 0 extended)Outside interfaces:Serial1/3Inside interfaces: Serial1/2Hits: 30 Misses: 0Expired translations: 0Dynamic mappings:R1#

R1#sh ip nat translations Pro Inside global Inside local Outside local Outside global--- 131.1.1.1 192.168.0.2 --- ---R1#第六步:在R3上pingR2的192.168.0.2接口

R3#ping 192.168.0.2

Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.0.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 4/57/108 msR3#第七步:在R1上进行debug ip nat查看转换过程R1#00:26:47: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [5]00:26:47: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [6]00:26:47: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [7]00:26:47: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [8]00:26:47: NAT*: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [9]R1#


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:CCNA实验:配置NAT动态映射
下一篇:解决SpringBoot运行Test时报错:SpringBoot Unable to find
相关文章

 发表评论

暂时没有评论,来抢沙发吧~