组网说明:
本案例采用H3C HCL模拟器来模拟实现双向NAT的组网,由于模拟器和本物理机的局限性,因此采用模拟器的S5820交换机开启WEB功能模拟成为WEB服务器。在该网络拓扑图中,内网和外网已经有了明确的标识,某局点申请了202.1.100.2-202.1.100.3这两个公网IP地址,其中202.1.100.2用于与外网互联,202.1.100.3用于给内网WEB服务器的转换并对外网提供WEB服务,同时内网机子能通过使用外网IP地址来访问WEB服务器,因此在不使用NAT回流的前提下,采用双向NAT来实现此需求。
配置步骤
1、按照网络拓扑图正确配置IP地址
2、SW1开启WEB功能,并创建相应账户及赋予权限
3、SW1配置默认路由指向R1
4、R1配置默认路由指向外网,并配置静态路由指向SW1
5、R1配置NAT,允许内网主机访问外网
6、R1配置双向NAT,实现内网主机通过使用外网地址来访问WEB服务
配置关键点
SW1:
sys
[H3C]sysname SW1
[SW1]vlan 200
[SW1-vlan200]quit
[SW1]int vlan 200
[SW1-Vlan-interface200]ip address 192.168.200.254 24
[SW1-Vlan-interface200]quit
[SW1]int gi 1/0/1
[SW1-GigabitEthernet1/0/1]port link-type access
[SW1-GigabitEthernet1/0/1]port access vlan 200
[SW1-GigabitEthernet1/0/1]quit
[SW1]int gi 1/0/2
[SW1-GigabitEthernet1/0/2]port link-mode route
[SW1-GigabitEthernet1/0/2]description
[SW1-GigabitEthernet1/0/2]ip address 10.0.0.1 30
[SW1-GigabitEthernet1/0/2]quit
[SW1]ip route-static 0.0.0.0 0.0.0.0 10.0.0.2
[SW1]ip http enable
[SW1]ip https enable
[SW1]local-user admin
New local user added.
[SW1-luser-manage-admin]password simple admin
[SW1-luser-manage-admin]service-type http https
[SW1-luser-manage-admin]authorization-attribute user-role network-admin
[SW1-luser-manage-admin]quit
[SW1]
R1:
sys
[H3C]sysname R1
[R1]int gi 0/0
[R1-GigabitEthernet0/0]description
[R1-GigabitEthernet0/0]ip address 10.0.0.2 30
[R1-GigabitEthernet0/0]quit
[R1]ip route-static 192.168.200.0 255.255.255.0 10.0.0.1
[R1]int gi 0/1
[R1-GigabitEthernet0/1]description
[R1-GigabitEthernet0/1]ip address 202.1.100.2 28
[R1-GigabitEthernet0/1]quit
[R1]ip route-static 0.0.0.0 0.0.0.0 202.1.100.1
NAT关键配置点:
[R1]acl basic 2000
[R1-acl-ipv4-basic-2000]rule 0 permit source any
[R1-acl-ipv4-basic-2000]quit
[R1]int gi 0/1
[R1-GigabitEthernet0/1]nat outbound 2000
[R1-GigabitEthernet0/1]nat server protocol tcp global 202.1.100.3 80 inside 10.0.0.1 80
[R1-GigabitEthernet0/1]nat server protocol tcp global 202.1.100.3 443 inside 10.0.0.1 443
[R1-GigabitEthernet0/1]quit
[R1]acl basic 2001
[R1-acl-ipv4-basic-2001]rule 0 permit source 192.168.200.0 0.0.0.255
[R1-acl-ipv4-basic-2001]rule 1 deny source any
[R1]int gi 0/0
[R1-GigabitEthernet0/0]nat server protocol tcp global 202.1.100.3 443 inside 10.0.0.1
[R1-GigabitEthernet0/0]nat outbound 2001
[R1-GigabitEthernet0/0]quit
WAN:
sys
[H3C]sysname WAN
[WAN]int gi 0/0
[WAN-GigabitEthernet0/0]description
[WAN-GigabitEthernet0/0]ip address 202.1.100.1 28
[WAN-GigabitEthernet0/0]quit
[WAN]int gi 0/1
[WAN-GigabitEthernet0/1]ip address 202.103.224.254 24
[WAN-GigabitEthernet0/1]quit
[WAN]
测试:
内网终端填写IP地址:
外网终端填写IP地址:
内网终端能PING通外网终端:
外网终端无法PING通内网终端:
内网终端打开浏览器,分别使用:https://192.168.200.254和https://202.1.100.3访问SW1的WEB服务
注意:192.168.200.254是内网地址、202.1.100.3是外网地址
1、使用192.168.200.254访问
2、使用外网地址202.1.100.3访问
由上面俩图可以看出,内网终端可以分别使用内网地址和外网地址访问SW1的WEB服务!
至此,双向NAT典型组网配置案例1已完成!