PAT的应用实例

一、拓扑图

1、拓扑图

在这里插入图片描述

2、原理

  ①、内网的IP地址,到了Router1的外网端口后,经过NAT的IP地址转换,将IP包头中的源IP地址(私有),转换为自己的公网IP地址。
  ②、在IP进行转换后,路由器随机产生端口号,替换源帧中,TCP/UDP包头中,源PC主机上的端口号,即:
在这里插入图片描述

  在NAT地址转换表中产生如下记录:
在这里插入图片描述

3、要求

  实现多台内网PC同时访问外网(动态PAT),由外网访问内网服务器(静态PAT)

二、路由设置

1、开启端口,配置路由表

  ①、开启端口,配置IP

	Router1:configure  terminal
			interface f0/0
			ip address 192.168.1.254  255.255.255.0  
			no shutdown
			exit
			interface  f0/1
			ip address 100.0.0.1  255.255.255.0
			no shutdown
			exit
	Router2:configure  terminal
			interface f0/0
			ip address 100.0.0.111  255.255.255.0  
			no shutdown
			exit
			interface  f0/1
			ip address 200.0.0.1  255.255.255.0
			no shutdown
			exit
	Router3:configure  terminal
			interface f0/0
			ip address 200.0.0.2  255.255.255.0  
			no shutdown
			exit
			interface  f0/1
			ip address 203.0.0.254  255.255.255.0
			no shutdown
			exit
			

  ②、配置路由表

	Router1:configure terminal
			ip route 0.0.0.0  0.0.0.0  100.0.0.111
	Router2:configure terminal
			ip route 203.0.0.0  255.255.255.0  200.0.0.2
			exit
	Router3:configure terminal
			ip route 100.0.0.0  255.255.255.0  200.0.0.1
			exit

2、动态PAT设置

  ①、设置内外网端口

	Router1:configure terminal
			interface f0/0
			ip nat inside
			exit
			interface f0/1
			ip nat outside
            exit

  ②、定义内部地址池

	Router1:configure terminal
			access-list 1  permit 192.168.0.0  0.0.255.255
			exit

  ③、做PAT动态映射

	Router1:configure terminal
			ip nat inside source list 1 int f0/1 overload
			exit

3、静态PAT设置

  ①、静态PAT端口转换

	Router1:configure terminal
			 ip nat inside source static tcp 192.168.1.3 80  100.0.0.2 80
			 ip nat inside source static tcp 192.168.1.4 21  100.0.0.2 21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

风云小虾米

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值