[R2-GigabitEthernet0/0/1]ip ad 100.1.1.2 24
R3
sy
[Huawei]sy R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip ad 100.1.1.3 24
路由配置
[R1]ip route-static 0.0.0.0 0 10.1.12.2
[R2]ip route-static 0.0.0.0 0 10.1.12.1
NAT配置步骤
1.配置静态NAT
①在接口下配置
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]nat static global 100.1.1.10 inside 192.168.1.1
②在全局下配置
[R2]nat static global 100.1.1.20 inside 192.168.1.2
[R2-GigabitEthernet0/0/1]nat static enable
PC2访问外网
PC>ping 100.1.1.3
Ping 100.1.1.3: 32 data bytes, Press Ctrl_C to break
From 100.1.1.3: bytes=32 seq=1 ttl=253 time=31 ms
From 100.1.1.3: bytes=32 seq=2 ttl=253 time=32 ms
From 100.1.1.3: bytes=32 seq=3 ttl=253 time=46 ms
From 100.1.1.3: bytes=32 seq=4 ttl=253 time=47 ms
From 100.1.1.3: bytes=32 seq=5 ttl=253 time=63 ms
2.配置动态NAT
[R2]nat address-group 1 100.1.1.10 100.1.1.20
[R2]acl 2000
[R2-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]nat outbound 2000 address-group 1 no-pat
查看NAT的类型
[R2]dis nat outbound address-group 1
NAT Outbound Information:
Interface Acl Address-group/IP/Interface Type
GigabitEthernet0/0/1 2000 1 no-pat
Total : 1
3.配置NA