GNS3中的NAT配置

这里写图片描述

静态NAT配置:
SW1:
sw1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
sw1(config)#no ip routing
sw1(config)#

R1:
R1#conf t
R1(config)#int f0/0
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#duplex full
R1(config-if)#speed 100
R1(config-if)#exit
R1(config)#int f0/1
R1(config-if)#ip add 10.0.0.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#ip route 0.0.0.0 0.0.0.0 10.0.0.2
R1(config)#int f0/0
R1(config-if)#ip nat inside
R1(config-if)#exit
R1(config)#int f0/1
R1(config-if)#ip nat outside
R1(config-if)#exit
R1(config)#ip nat inside source static 192.168.10.10 8.8.8.8

R2:
R2#conf t
R2(config)#int f0/0
R2(config-if)#ip add 10.0.0.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#int loopback 1
R2(config-if)#ip add 6.6.6.6 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#ip route 8.8.8.8 255.255.255.255 10.0.0.1
R2(config)#

ping命令的结果:
这里写图片描述

动态NAT的配置:
R1:
R1#conf t
R1(config)#int f0/0
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#duplex full
R1(config-if)#speed 100
R1(config-if)#exit
R1(config)#int f0/1
R1(config-if)#ip add 10.0.0.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#ip route 0.0.0.0 0.0.0.0 10.0.0.2
R1(config)#int f0/0
R1(config-if)#ip nat inside
R1(config-if)#exit
R1(config)#int f0/1
R1(config-if)#ip nat outside
R1(config-if)#exit
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#access-list 1 permit 192.168.10.0 0.0.0.255
R1(config)#ip nat pool shaw 10.0.0.6 10.0.0.6 prefix-length 24
R1(config)#ip nat inside source list 1 pool shaw

R2:
R2#conf t
R2(config)#int f0/0
R2(config-if)#ip add 10.0.0.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#int loopback 1
R2(config-if)#ip add 6.6.6.6 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit

ping命令的结果:
这里写图片描述

  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值