网络_动态NAT_端口NAT_静态NAT

一、动态NAT

在这里插入图片描述
拓扑如图,配置好接口的地址,R1和R2配置静态路由,R3无静态路由
步骤:
1、编写ACL规则表明内网需要转换地址的网段
2、建立NAT地址池
3、R2各接口标明内网外网范围
4、开启动态NAT

R2(config)#access-list 1 permit 12.0.0.0 0.0.0.255
R2(config)#access-list 1 permit host 1.1.1.1 
R2(config)#ip nat pool DTNAT 22.0.0.10 22.0.0.30 netmask 255.255.255.0
R2(config)#int f0/0
R2(config-if)#ip nat inside 
R2(config-if)#int f1/0
R2(config-if)#ip nat outside 
R2(config)#ip nat inside source list 1 pool DTNAT

查看命令:

show ip nat translations  //查看NAT翻转表
show ip nat statistics //查看NAT状态
debug ip nat  //调试NAT翻转

在R1带源ping外网然后在R2查看信息
在这里插入图片描述

二、端口NAT

继续动态NAT的拓扑
端口NAT配置

R2(config)#ip nat pool ADDNAT 22.0.0.1 22.0.0.1 netmask 255.255.255.0
R2(config)#int f0/0
R2(config-if)#ip nat inside 
R2(config-if)#int f1/0
R2(config-if)#ip nat outside 
R2(config)#ip nat inside source list 1 pool ADDNAT overload
       或者下面这条配置命令
       R2(config)#ip nat source list 1 int  f1/0 overload

在这里插入图片描述

三、静态NAT

在这里插入图片描述
拓扑如图,在各个接口配置好如图地址
静态NAT配置方法:
方法一(最不安全):内网IP-公网IP
R2(config)#ip nat inside source static 172.16.1.4 23.1.1.40
R2(config)#ip nat inside source static 172.16.1.5 23.1.1.50

方法二(常规):内网IP+PORT - 公网IP+PORT
R2(config)#ip nat inside source static tcp 172.16.1.4 23 23.1.1.40 23
R2(config)#ip nat inside source static tcp 172.16.1.4 80 23.1.1.40 80

方法三(安全):内网IP+PORT - 公网IP+PORT
R2(config)#ip nat inside source static tcp 172.16.1.4 23 23.1.1.40 2323
方法一:
R2配置:

R2(config)#int f0/0
R2(config-if)#ip nat inside 
R2(config-if)#int f2/0
R2(config-if)#ip nat inside 
R2(config-if)#int f1/0
R2(config-if)#ip nat outside
R2(config)#ip nat inside source static 172.16.0.1 22.0.0.10 //将内部服务器的地址转换为22.0.0.10

R4配置:

R4(config)#ip route 0.0.0.0 0.0.0.0 172.16.0.2 //设置默认路由
R4(config)#line vty 0 15 
R4(config-line)#no login 
R4(config-line)#privilege level 15

在这里插入图片描述
R3pingR4,R3远程登陆R4
在这里插入图片描述
方法二:
R2

R2(config)#ip nat inside source static tcp 172.16.0.1 23  22.0.0.20 23   
R2(config)#ip nat inside source static tcp 172.16.0.1 80  22.0.0.20 80
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值