搜档网
当前位置:搜档网 › 华为路由器配置实战汇总-nat

华为路由器配置实战汇总-nat

一、配置nat(共用一个端口)
说明:Router的出接口E0/0的IP地址为218.107.49.1*/240,接口Eth0/1.1的IP地址为192.168.95.1/24。接口Eth0/1.2的IP地址为172.20.2.1/24
内网用户通过Router的出接口做Easy IP 地址转换访问外网。
图1 配置出接口做EASY IP组网图

pc-------route------外网
操作步骤 Router的配置
interface Ethernet0/0
ip address 218.107.49.170 255.255.255.240
nat outbound 2001
#
interface Ethernet0/1
#
interface Ethernet0/1.1
ip address 192.168.95.1 255.255.255.0
vlan-type dot1q vid 95
#
interface Ethernet0/1.2
ip address 172.20.2.1 255.255.255.0
vlan-type dot1q vid 20
#
interface NULL0
#
acl number 2001
rule 0 permit source 192.168.95.0 0.0.0.255
#
ip route-static 0.0.0.0 0.0.0.0 Ethernet 0/0 218.107.49.161 preference 60
#
检查配置结果
在Router上执行display nat outbound命令查看出接口的Easy IP配置信息。
dis nat session
There are currently 1 NAT session:
Protocol GlobalAddr Port InsideAddr Port DestAddr Port
1 218.107.49.170 12288 192.168.95.1 44006 8.8.8.8 44006
VPN: 0, status: 11, TTL: 00:01:00, Left: 00:00:57
ping -a 192.168.95.1 8.8.8.8
PING 8.8.8.8: 56 data bytes, press CTRL_C to break
Reply from 8.8.8.8: bytes=56 Sequence=2 ttl=48 time=11 ms
Reply from 8.8.8.8: bytes=56 Sequence=4 ttl=48 time=8 ms
Reply from 8.8.8.8: bytes=56 Sequence=5 ttl=48 time=8 ms
ping -a 172.20.2.1 8.8.8.8
PING 8.8.8.8: 56 data bytes, press CTRL_C to break
Request time out
Request time out
Request time out
Request time out
测试达到达到要求。
配置注意事项
配置ACL,确定对哪些网段进行NAT转换。
在出接口视图下配置NAT转换,注意转换方向。
子接口,必须配置vlan类型,否则子接口协议起不来。
二、发布内部的web服务器
#
firewall enable
#
nterface Ethernet0/0
ip address 218.107.49.170 255.255.255.240
firewall packet-filter 3001 inbound
nat outbound 2001
nat server protocol tcp global 218.107.49.170 www inside 192.168.95.2 www
#
interface Ethernet0/1
ip address 192.168.95.1 255.255.255.0
#
interface NULL0
#
acl number 2001
rule 0 permit source 192.168.95.0 0.0.0.255
#
acl number 3001 match-order auto
rule 0 permit tcp destination 192.168.95.2 0 destination-port eq www
#
ip route-static 0.0.0.0 0.0.0.0 Ethernet 0/0 218.107.49.161 preference 60
#

外网找台机器,http://218.107.49.170 测试成功。
[Quidway-Ethernet0/1]dis nat all
NAT address-group information:
No address-groups have been configured
NAT outbound information:
Ethernet0/0: acl(2001) --- interface
Server in private network information:
Interface:Ethernet0/0, Protocol:6(tcp),
[global] 218.107.49.170: 80(www) [local] 192.168.95.2: 80(www)
如果关

闭,firewall功能会怎么样呢?
好像对整个没有反应。
去掉接口下的firewall应用。?居然也没有问题。

相关主题