靜態NAT
有些環境需要單獨指定公網IP地址上網,可以使用靜態NAT的方式來實現
1、AR路由器的配置
<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 #配置默認路由,指向外網網關
2、配置PC的IP地址及網關等
配置pc的IP地址和網關等信息
3、配置內網的網關等信息
[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 #退出接口
4、配置nat一對一映射
[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 #退出接口
5、查看靜態NAT映射信息
[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路由器