nat static global { global-address} inside {host-address }
命令用于创建静态NAT。
global
参数用于配置外部公网地址。
inside
参数用于配置内部私有地址。
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy NAT
[NAT]int g0/0/0
[NAT-GigabitEthernet0/0/0]ip address 192.168.1.254 24
[NAT-GigabitEthernet0/0/0]int s1/0/0
[NAT-Serial1/0/0]ip address 200.10.10.2 24
[NAT-Serial1/0/0]nat static global 202.10.10.1 inside 192.168.1.1
[NAT-Serial1/0/0]nat static global 202.10.10.2 inside 192.168.1.2
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]int s1/0/0
[Huawei-Serial1/0/0]ip address 100.1.1.1 24
[Huawei-Serial1/0/0]q
[Huawei]ip route-static 0.0.0.0 0.0.0.0 200.10.10.2
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy NAT
[NAT]nat address-group 1 200.10.10.1 200.10.10.200
[NAT]acl 2000
[NAT-acl-basic-2000]rule 5 permit source 192.168.1.0 0.0.0.255
[NAT-acl-basic-2000]q
[NAT]int s1/0/0
[NAT-Serial1/0/0]nat outbound 2000 address-group 1 no-pat
[NAT-Serial1/0/0]ip address 200.10.10.201 24
[NAT-GigabitEthernet0/0/0]ip address 192.168.1.254 24
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]int s1/0/0
[Huawei-Serial1/0/0]ip address 100.1.1.1 24
[Huawei-Serial1/0/0]q
[Huawei]ip route-static 0.0.0.0 0.0.0.0 200.10.10.201
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy NAT
[NAT]int g0/0/0
[NAT-GigabitEthernet0/0/0]ip address 192.168.1.254 24
[NAT-GigabitEthernet0/0/0]q
[NAT]int s1/0/0
[NAT-Serial1/0/0]ip address 200.10.10.1 24
[NAT-Serial1/0/0]q
[NAT]acl 2000
[NAT-acl-basic-2000]rule 5 permit source 192.168.1.0 0.0.0.255
[NAT-acl-basic-2000]q
[NAT]int s1/0/0
[NAT-Serial1/0/0]nat outbound 2000
<Huawei>sy
[Huawei]int s1/0/0
[Huawei-Serial1/0/0]ip address 100.1.1.1 24
[Huawei-Serial1/0/0]q
[Huawei]ip route-static 0.0.0.0 0.0.0.0 200.10.10.1