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

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

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

目 录CONTENT

文章目录

CCNA实验:配置NAT动态映射

2023-04-04 星期二 / 0 评论 / 0 点赞 / 68 阅读 / 4060 字

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

.


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

R3(config)#int s3/1
R3(config-if)#ip add 131.1.1.1 255.255.255.0
R3(config-if)#no sh
R3(config-if)#exit
R3(config)#router ospf 1
R3(config-router)#net 0.0.0.0 0.0.0.0 area 0
R3(config-router)#

第二步:在R1定义NAT的inside 和outside
R1(config)#int s1/2
R1(config-if)#ip nat inside
R1(config-if)#int s1/3
R1(config-if)#ip nat outside
R1(config-if)#^Z

第三步:在R1上定义转换
R1(config)#access-list 1 permit 192.168.0.0 0.0.0.255
//定义要被转换的ip地址
R1(config)#ip nat pool NAT 131.1.1.5 131.1.1.10 netmask 255.255.255.0
//定义转换后的ip 地址池
R1(config)#ip nat inside source list 1 pool NAT
//将access-list与pool进行关连

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 = 36/63/80 ms
R2#
第五步:打开R1的debug查看R2 ping的结果、
R1#
00:07:26: NAT: s=192.168.0.2->131.1.1.5, d=131.1.1.3 [5]
00:07:26: NAT
: s=131.1.1.3, d=131.1.1.5->192.168.0.2 [5]
00:07:26: NAT: s=192.168.0.2->131.1.1.5, d=131.1.1.3 [6]
00:07:26: NAT
: s=131.1.1.3, d=131.1.1.5->192.168.0.2 [6]
00:07:26: NAT: s=192.168.0.2->131.1.1.5, d=131.1.1.3 [7]
00:07:26: NAT
: s=131.1.1.3, d=131.1.1.5->192.168.0.2 [7]
00:07:26: NAT: s=192.168.0.2->131.1.1.5, d=131.1.1.3 [8]
00:07:26: NAT
: s=131.1.1.3, d=131.1.1.5->192.168.0.2 [8]
00:07:26: NAT: s=192.168.0.2->131.1.1.5, d=131.1.1.3 [9]
00:07:26: NAT
: s=131.1.1.3, d=131.1.1.5->192.168.0.2 [9]
第六步:在R1上再进行测试
R1#p
Protocol [ip]:
Target IP address: 131.1.1.3
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 192.168.0.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
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 = 24/34/64 ms
R1#
00:09:01: NAT: s=192.168.0.1->131.1.1.6, d=131.1.1.3 [0]
00:09:01: NAT: s=131.1.1.3, d=131.1.1.6->192.168.0.1 [0]
00:09:01: NAT: s=192.168.0.1->131.1.1.6, d=131.1.1.3 [1]
00:09:01: NAT
: s=131.1.1.3, d=131.1.1.6->192.168.0.1 [1]
00:09:01: NAT: s=192.168.0.1->131.1.1.6, d=131.1.1.3 [2]
00:09:01: NAT: s=131.1.1.3, d=131.1.1.6->192.168.0.1 [2]
00:09:01: NAT: s=192.168.0.1->131.1.1.6, d=131.1.1.3 [3]
00:09:01: NAT
: s=131.1.1.3, d=131.1.1.6->192.168.0.1 [3]
00:09:01: NAT: s=192.168.0.1->131.1.1.6, d=131.1.1.3 [4]
00:09:01: NAT*: s=131.1.1.3, d=131.1.1.6->192.168.0.1 [4]
R1#
第七步:查看R1的转换
R1#sh ip nat translations
Pro Inside global Inside local Outside local Outside global
--- 131.1.1.5 192.168.0.2 --- ---
--- 131.1.1.6 192.168.0.1 --- ---
R1#

.

广告 广告

评论区