侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

CCNA实验:配置PAT端口映射

2023-04-04 星期二 / 0 评论 / 0 点赞 / 79 阅读 / 2805 字

第一步:配置R1、R2、R3的接口R1(config)#int s1/3R1(config-if)#ip add 131.1.1.1 255.255.255.0R1(config-if)#no shR

.


第一步:配置R1、R2、R3的接口
R1(config)#int s1/3
R1(config-if)#ip add 131.1.1.1 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int s1/2
R1(config-if)#ip add 192.168.0.1 255.255.255.0
R1(config-if)#no sh
R1(config)#router ospf 1
R1(config-router)#net 0.0.0.0 0.0.0.0 area 0

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

R3(config)#int s3/1
R3(config-if)#ip add 131.1.1.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#^Z
R3(config)#router ospf 1
R3(config-router)#network 0.0.0.0 0.0.0.0 area 0
第二步:在R1上定义NAT的inside 和outside
R1(config)#int s1/2
R1(config-if)#ip nat ins
R1(config-if)#int s1/3
R1(config-if)#ip nat out
R1(config-if)#
第三步:在R1上定义PAT转换
R1(config)#access-list 1 permit 192.168.0.0 0.0.0.255
R1(config)#ip nat inside source list 1 interface s1/3 overload
R1(config)#
第四步:在R2上ping测试
R2#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 = 60/80/108 ms
第五步:在R1上进行nat查看
R1#debug ip nat
IP NAT debugging is on
R1#
00:10:05: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [0]
00:10:05: NAT: s=131.1.1.3, d=131.1.1.1->192.168.0.2 [0]
00:10:05: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [1]
00:10:05: NAT
: s=131.1.1.3, d=131.1.1.1->192.168.0.2 [1]
00:10:05: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [2]
00:10:05: NAT: s=131.1.1.3, d=131.1.1.1->192.168.0.2 [2]
00:10:06: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [3]
00:10:06: NAT
: s=131.1.1.3, d=131.1.1.1->192.168.0.2 [3]
00:10:06: NAT: s=192.168.0.2->131.1.1.1, d=131.1.1.3 [4]
00:10:06: NAT*: s=131.1.1.3, d=131.1.1.1->192.168.0.2 [4]
R1#

R1#sh ip nat translations
Pro Inside global Inside local Outside local Outside global
icmp 131.1.1.1:1993 192.168.0.2:1993 131.1.1.3:1993 131.1.1.3:1993
icmp 131.1.1.1:1992 192.168.0.2:1992 131.1.1.3:1992 131.1.1.3:1992
icmp 131.1.1.1:1991 192.168.0.2:1991 131.1.1.3:1991 131.1.1.3:1991
icmp 131.1.1.1:1990 192.168.0.2:1990 131.1.1.3:1990 131.1.1.3:1990
icmp 131.1.1.1:1989 192.168.0.2:1989 131.1.1.3:1989 131.1.1.3:1989
R1#
//现在可以看到转换后的效果是转换为131.1.1.3 的不同的端口

.

广告 广告

评论区