华为路由器配置端口映射NAT Server
来源:原创
时间:2024-04-21
作者:脚本小站
分类:网络
AR1:
interface GigabitEthernet0/0/0 ip address 192.168.0.1 255.255.255.0 interface GigabitEthernet0/0/1 ip address 12.2.2.1 255.255.255.0 ip route-static 0.0.0.0 0.0.0.0 12.2.2.254 nat address-group 1 12.2.2.2 12.2.2.3 acl 2000 rule 5 permit source 192.168.0.0 0.0.0.255 rule 10 deny interface GigabitEthernet 0/0/1 nat outbound 2000 address-group 1 # 12.2.2.9 在华为路由器中这个地址不能在nat address-group组里,也不能是出口ip 12.2.2.1,必须是个未用过的公网地址 interface GigabitEthernet 0/0/1 nat server protocol tcp global 12.2.2.9 80 inside 192.168.0.2 80 # 上面配置完成之后只能在外部访问公网地址,内部访问不了公网地址,需要再在下行接口配置nat,将内部主机使用公网IP地址访问服务器的流量,引到Router上进行NAT转换 acl 3000 rule 5 permit ip source 192.168.0.0 0.0.255.255 destination 12.2.2.9 0 interface GigabitEthernet 0/0/0 nat outbound 3000 nat server protocol tcp global 12.2.2.9 80 inside 192.168.0.2 80 # 在上行端口配置的nat规则同样在下行端口也要配置一遍
查看:
# 查看地址映射表 display nat server interface GigabitEthernet 0/0/1 display nat static
AR2:
interface GigabitEthernet0/0/0 ip address 12.2.2.254 255.255.255.0 # interface GigabitEthernet0/0/1 ip address 20.1.2.1 255.255.255.0
参考地址:
https://support.huawei.com/hedex/api/pages/EDOC1100320585/AZM12261/05/resources/dc/dc_ar_cfgcase_NAT_0006.html