组网说明:本案例是采用H3C HCL模拟器来模拟搭建basic NAT的组网环境,内网和外网均以在网络拓扑图中有了明确的标识,R1是某局点的内网设备,R1为出口设备,某局点申请了202.1.100.3-202.1.100.5范围的公网地址,内网终端需要通过NAT地址转换来访问外网。PC-3为外网的服务器。本案例要求PC-4、PC-5能通过转换为202.1.100.3-202.1.100.5范围内的公网地址来访问PC-3。
配置步骤
1、按照网络拓扑图正确配置IP地址
2、在R1配置NAT,实现地址转换
3、R1配置默认路由指向到外网
4、PC-4、PC-5能通过地址转换后PING通外网服务器PC-3
配置关键点
R1:
sys
[H3C]sysname R1
[R1]int LoopBack 0
[R1-LoopBack0]ip address 2.2.2.2 32
[R1-LoopBack0]quit
[R1]router id 2.2.2.2
[R1]vlan 10
[R1-vlan10]quit
[R1]vlan 20
[R1-vlan20]quit
[R1]int vlan 10
[R1-Vlan-interface10]ip address 192.168.10.1 24
[R1-Vlan-interface10]quit
[R1]int vlan 20
[R1-Vlan-interface20]ip address 192.168.20.1 24
[R1-Vlan-interface20]quit
[R1]int gi 5/0
[R1-GigabitEthernet5/0]port link-mode bridge
[R1-GigabitEthernet5/0]port link-type access
[R1-GigabitEthernet5/0]port access vlan 10
[R1-GigabitEthernet5/0]quit
[R1]int gi 5/1
[R1-GigabitEthernet5/1]port link-mode bridge
[R1-GigabitEthernet5/1]port link-type access
[R1-GigabitEthernet5/1]port access vlan 20
[R1-GigabitEthernet5/1]quit
[R1]int gi 0/1
[R1-GigabitEthernet0/1]description
[R1-GigabitEthernet0/1]ip address 202.1.100.2 28
[R1-GigabitEthernet0/1]quit
NAT配置:
[R1]acl basic 2000
[R1-acl-ipv4-basic-2000]rule 0 permit source any
[R1-acl-ipv4-basic-2000]quit
[R1]nat address-group 1
[R1-address-group-1]address 202.1.100.3 202.1.100.5
[R1-address-group-1]quit
[R1]int gi 0/1
[R1-GigabitEthernet0/1]nat outbound 2000 address-group 1 no-pat
[R1-GigabitEthernet0/1]quit
[R1]ip route-static 0.0.0.0 0.0.0.0 202.1.100.1
ISP:
sys
[H3C]sysname ISP
[ISP]int gi 0/1
[ISP-GigabitEthernet0/1]description
[ISP-GigabitEthernet0/1]ip address 202.1.100.1 28
[ISP-GigabitEthernet0/1]quit
[ISP]int gi 0/0
[ISP-GigabitEthernet0/0]description
[ISP-GigabitEthernet0/0]ip address 202.103.224.254 24
[ISP-GigabitEthernet0/0]quit
测试:
所有PC都填写上IP地址、子网掩码、默认网关
PC-4和PC-5能PING通PC-3
查看NAT的转换情况及会话清单:
至此,basic NAT典型组网配置案例已完成!