笔记 NAT转换 、 NAPT

发布时间:2024-07-19 点击:86
系统运维
nat配置思路:
1、配置内网和外网设备的ip地址
2、配置网关设备上的默认路由
ip route 0.0.0.0 0.0.0.0 100.1.1.4
3、配置 isp 边的网络(内网启用igp – rip )
isp:
router rip
version 2
no auto-summary
network 200.1.1.0
network 100.0.0.0
passive-interface gi1/0
r5:
router rip
version 2
no auto-summary
network 200.1.1.0
3、在网关设备上配置 nat 边界
interface fa0/0
ip nat inside
interface gi1/0
ip nat outside
4、配置 nat 转换条目
ip nat inside source static 192.168.10.1 100.1.1.3
5、验证、测试、保存
show ip route
show ip nat translation
debug ip nat
pc-1:
ping 200.1.1.5
==============================================================
静态nat:
在这种类型的nat中,私有地址与公有地址的对应关系是 1:1 , 不节省ip地址;
在动态nat的一种类型中 —- pnat(port nat) ,
所形成的私有地址与公有地址的对应关系是:n:1 ,节省ip地址;
本质是:
使用同一个公网ip地址的,不同的,端口号,来对应内网不同的私有主机
配置思路:
1、确定 nat 边界
2、确定需要进行 nat 转换的私有地址空间
工具 -匹配感兴趣的流量 内网中 所有 数据包源ip 为192.168.10.x 的 ip数据包 规则1: 192.168.10. 0 0 . 0 . 0.255 -->通配符 //按照这个规则,可以抓住所有源ip地址 为 192.168.10.x 的所有数据包; 工具,称之为 acl - access control list :访问控制列表 acl: 规则 - 匹配感兴趣流量的; 动作 - permit / deny 事件 - 需要对“感兴趣流量”做的事情。 access-list 1 permit 192.168.10.0 0.0.0.255 3、针对私有地址,配置对应的 nat 转换条目 gw(config)# ip nat inside source list 1 interface gi1/0 4、验证、测试、保存 show ip nat statistics //查看 nat 的简要配置信息; show ip access-list // 查看配置好的 acl ; show ip nat translation // 查看 nat 的核心工作表 - nat表 gw#debug ip nat pc-1/2: ping 200.1.1.5================================================================
在边界网关上,如果事事了nat ,那么:
1、当流量从inside到outside时,先查路由表,再查nat表; 2、当流量从outside到inside时,先查nat表,再查路由表; 所以,我们可以在 outside 主动向 inside 发起流量,前提是我们得保证
边界网关上面是有 nat 条目的,
当然该条目不能是由内网流量触发的,而应该是永久存在的静态nat条目。
我们将这种配置称之为:nat的高级应用。
代表1:
端口映射
gw(config)#ip nat inside source static tcp 192.168.10.1 23 100.1.1.3 123456测试:
1、首先配置好 pc-1 的远程访问密码;
2、其次配置好 gw 的远程访问密码;
3、最后,在 r5 上进行测试:
telnet 100.1.1.3 123456
================================================================
华为nat (分类与思科完全相同)
静态nat :私有地址与公有地址是 1:1 ,不节省ip地址;
动态nat :私有地址与公有地址是 多:1 , 节省ip地址;
-普通“动态nat”
-pat/pnat/napt/端口复用
静态nat配置:
1、启动nat功能
#在任意端口上启用都可以
例如:
interface gi0/0/1
nat static enable –>启动静态nat功能
2、配置nat转换条目(两种配置方式)
1# 可以在全局下配置
nat static global 100.1.1.3 inside 192.168.10.1
2# 可以在接口下配置(必须是数据包的出端口) nat static global 100.1.1.3 inside 192.168.10.1 3、验证、测试、保存 display nat static <isp>terminal monitor <isp>terminal debugging <isp>debugging ip icmp <gw>debugging nat all pnat的配置:
1、定义感兴趣的流量
acl 2000
rule 5 permit 192.168.10.0 0.0.0.255
2、在流量的出端口配置nat interface gi0/0/1 nat outbound 2000 -->在该端口上发送出去,并且被 acl 2000 匹配的流量,其中的源ip地址转换为该 接口的ip地址;3、验证、测试、保存 display nat outbound华为端口映射:
interface g 0/0/0
nat server protocol tcp global current-interface 80 inside 192.168.1.1 80 //外网通过tcp协议的80端口访问内网的80端口配置思路:1.准备环境2.进接口,确定in、out3.静态nat思科:
ip nat inside source list 1 interface fastethernet0/1 overload //pnat pat 端口多路复用 动态natip nat inside source static tcp 192.168.1.1 23 200.1.1.3 6969 extendable//nat高级应用——端口映射ip nat inside source static 192.168.1.1 200.1.1.3//静态nat怎么把路由器搞成pc?conf tno ip routing //关闭路由功能ip default-gateway 地址如果不这么干,那么,你需要配置路由条目,才能和你的网关通信==========================================
华为:
静态nat interface gigabitethernet0/0/1 ip address 200.1.1.3 255.255.255.0 nat static global 200.1.1.5 inside 192.168.1.1 netmask 255.255.255.255 //先打公网地址(不能和你的外部接口地址一致),再输内部地址nat static enable //开服务 动态nat [huawei]acl 2000

如何激活企业邮箱
企业邮箱多少钱一年
网站备案号不识别-虚拟主机/数据库问题
linux安装git的方法步骤
手机怎么读取移动硬盘 手机读取移动硬盘的方法
机云服务器秒杀价格
哈尔滨注册商标到哪里办理
入手二手域名有几大原则