NAT实战——设置动态NAT

动态NAT

拓扑图如下:

在这里插入图片描述

实验步骤

1、设置三层交换机sw

sw#conf t 
Enter configuration commands, one per line.  End with CNTL/Z.
sw(config)#no ip routing 
sw(config)#

2、设置路由R1

R1#conf t 
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f 0/1
R1(config-if)#ip add 192.168.20.1 255.255.255.0         //仅设置IP地址与子网掩码
R1(config-if)#no shut 
*Mar  1 00:00:54.063: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:00:55.063: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#int f 0/0
R1(config-if)#ip add 192.168.100.1 255.255.255.0          //仅设置IP地址与子网掩码
R1(config-if)#no shut 
R1(config-if)#ex 
*Mar  1 00:01:08.423: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:01:09.423: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config)#

3、对三台PC机进行设置

PC1

PC1> 
PC1> ip 192.168.20.20 192.168.20.1
Checking for duplicate address...
PC1 : 192.168.20.20 255.255.255.0 gateway 192.168.20.1

PC1>

PC2

PC2> 
PC2> ip 192.168.20.30 192.168.20.1 
Checking for duplicate address...
PC1 : 192.168.20.30 255.255.255.0 gateway 192.168.20.1

PC2> 

PC3

PC3> 
PC3> ip 192.168.100.10 192.168.100.1
Checking for duplicate address...
PC1 : 192.168.100.10 255.255.255.0 gateway 192.168.100.1

PC3>
注意:此时理论上是已经可以做到全网互通的,具体见下图。如果无法连接请自行检查命令。

为满足实验要求,下面将正式进行动态NAT的设置。

R1

R1(config)#
R1(config)#ip access-list standard zhy                          //设置命名访问控制列表
R1(config-std-nacl)#permit 192.168.20.0 0.0.0.255 
R1(config)#ip nat pool test 12.0.0.10 12.0.0.20 netmask 255.255.255.0        //设置公网地址池
R1(config)#
*Mar  1 00:09:46.123: %LINEPROTO-5-UPDOWN: Line protocol on Interface NVI0, changed state to up
R1(config)#ip nat inside source list zhy pool test                  //实现网络地址转换
 
R1(config)#int f 0/1
R1(config-if)#ip nat inside                          //启用内部NAT
R1(config-if)#int f 0/0
R1(config-if)#ip nat outside                         //启用外部NAT
R1(config-if)#ex 

验证结果

在这里插入图片描述

以上就是动态NAT的地址转换,不需要手动进行指定,他自动转换的都是区间范围内的地址

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值