静态NAT
有些环境需要单独指定公网IP地址上网,可以使用静态NAT的方式来实现
<Huawei>system-view #进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname ar #修改名称
[ar]interface GigabitEthernet 0/0/1 #进入接口0/0/1
[ar-GigabitEthernet0/0/1]ip address 10.11.12.100 24 #配置IP地址及子网掩码
[ar-GigabitEthernet0/0/1]ping 10.11.12.1 #检测连通性
PING 10.11.12.1: 56 data bytes, press CTRL_C to break
Reply from 10.11.12.1: bytes=56 Sequence=1 ttl=128 time=70 ms
Reply from 10.11.12.1: bytes=56 Sequence=2 ttl=128 time=20 ms
Reply from 10.11.12.1: bytes=56 Sequence=3 ttl=128 time=10 ms
Reply from 10.11.12.1: bytes=56 Sequence=4 ttl=128 time=20 ms
Reply from 10.11.12.1: bytes=56 Sequence=5 ttl=128 time=10 ms
--- 10.11.12.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/26/70 ms
[ar-GigabitEthernet0/0/1]quit #退出
[ar]ip route-static 0.0.0.0 0.0.0.0 10.11.12.1 #配置默认路由,指向外网网关
配置pc的IP地址和网关等信息
[ar]interface GigabitEthernet 0/0/0 #进入接口0/0/0
[ar-GigabitEthernet0/0/0]ip add 192.168.1.1 24 #配置IP地址及子网掩码
[ar-GigabitEthernet0/0/0]ping 192.168.1.254 #检测连通性
PING 192.168.1.254: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.254: bytes=56 Sequence=1 ttl=128 time=40 ms
Reply from 192.168.1.254: bytes=56 Sequence=2 ttl=128 time=10 ms
Reply from 192.168.1.254: bytes=56 Sequence=3 ttl=128 time=10 ms
Reply from 192.168.1.254: bytes=56 Sequence=4 ttl=128 time=20 ms
Reply from 192.168.1.254: bytes=56 Sequence=5 ttl=128 time=20 ms
--- 192.168.1.254 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/20/40 ms
[ar-GigabitEthernet0/0/0]quit #退出接口
[ar]interface GigabitEthernet 0/0/1 #进入接口0/0/0
[ar-GigabitEthernet0/0/1]nat static global 10.11.12.101 inside 192.168.1.254 #配置外网地址及内网地址的静态映射
[ar-GigabitEthernet0/0/1]quit #退出接口
[ar]display nat static #查看静态nat信息
Static Nat Information:
Interface : GigabitEthernet0/0/1
Global IP/Port : 10.11.12.101/----
Inside IP/Port : 192.168.1.254/----
Protocol : ----
VPN instance-name : ----
Acl number : ----
Netmask : 255.255.255.255
Description : ----
Total : 1
#网络,#华为,#ensp,#华为ar路由器