华为NAT配置案例
策略路由和NAT实现负载均衡实例(华为防火墙)

rule0permit ip source10.0.0.0 0.255.255.255
acl number3002
rule0permit ip source20.0.0.0 0.255.255.255
#
nat address-group100NAT1100.0.0.1 100.0.0.100
注:方便起见,图中文字的接口用IP地址来表示具体三层接口。
从上图中,我们就可以知道,根据不同的下一跳接口,可以分类出两种不
同的域间策略,这时我们就可以在不同的域间进行不同NAT,实现了实验要求
的NAT需求。那么第二个实验要求能不能实现呢?
答案是确定能实现的。我们可以仔细思考一下,利用策略路由我们可以实
nat实际上在防火墙中也属于域间策略的一种即从上图中我们可以知道nat是在路由选路后进行的而nat的配置很简单只是将匹配的地址acl进行一个地址转换的操作如果不选nopat方式还包括端口所以我们不可能从nat上进行某种操作来实现冗余
一、组网需求:
1.正常情况下10.0.0.2从出口12.12.12.0NAT转化成100.0.0.0的地址,20.0.0.2从出口13.13.13.0NAT转化成200.0.0.0的地址,实现负载均衡。
ip route-static0.0.0.0 0.0.0.0 13.13.13.2
ip route-static 0.0.0.0 0.0.0.0 12.12.12.2
五、实现原理
按照实验要求,如果我们用传统的NAT,将10.0.0.2 nat成
100.0.0.0/24网段,将20.0.0.2 nat成200.0.0.0/24网段,这种方 法是实现不了当FW双线上连线路任意断掉一条业务不断的实验要求。那么我 们应如何解决这个问题呢?首先我们要了解防火墙的处理流程,如下图:
史上最详细H3C路由器NAT典型配置案例

史上最详细H3C路由器NAT典型配置案例神马CCIE,H3CIE,HCIE等⽹络⼯程师⽇常实施运维必备,你懂的。
NAT典型配置举例内⽹⽤户通过NAT地址访问外⽹(静态地址转换)1. 组⽹需求内部⽹络⽤户使⽤外⽹地址访问Internet。
2. 组⽹图图1-5 静态地址转换典型配置组⽹图3. 配置步骤# 按照组⽹图配置各接⼝的IP地址,具体配置过程略。
# 配置内⽹IP地址到外⽹地址之间的⼀对⼀静态地址转换映射。
system-view[Router] nat static outbound 使配置的静态地址转换在接⼝GigabitEthernet1/2上⽣效。
[Router] interface gigabitethernet 1/2[Router-GigabitEthernet1/2] nat static enable[Router-GigabitEthernet1/2] quit4. 验证配置# 以上配置完成后,内⽹主机可以访问外⽹服务器。
通过查看如下显⽰信息,可以验证以上配置成功。
[Router] display nat staticStatic NAT mappings:There are 1 outbound static NAT mappings.IP-to-IP:Local IP : Global IP :Interfaces enabled with static NAT:There are 1 interfaces enabled with static NAT.Interface: GigabitEthernet1/2# 通过以下显⽰命令,可以看到Host访问某外⽹服务器时⽣成NAT会话信息。
[Router] display nat session verbose Initiator:Source IP/port: Destination IP/port: VPN instance/VLAN ID/VLL ID: -/-/-Protocol: ICMP(1)Responder:Source IP/port: Destination IP/port: VPN instance/VLAN ID/VLL ID: -/-/-Protocol: ICMP(1)State: ICMP_REPLYApplication: INVALIDStart time: 2012-08-16 09:30:49 TTL: 27sInterface(in) : GigabitEthernet1/1Interface(out): GigabitEthernet1/2Initiator->Responder: 5 packets 420 bytes Responder->Initiator: 5 packets 420 bytesTotal sessions found: 1内⽹⽤户通过NAT地址访问外⽹(地址不重叠)1. 组⽹需求·某公司内⽹使⽤的IP地址为。
H3C 华为 06-NAT命令

06-NAT命令目录1 NAT配置命令1.1 NAT配置命令1.1.1 display nat address-group1.1.2 display nat all1.1.3 display nat bound1.1.4 display nat dns-map1.1.5 display nat server1.1.6 display nat static1.1.7 display nat statistics1.1.8 display userlog export1.1.9 nat address-group1.1.10 nat dns-map1.1.11 nat outbound1.1.12 nat outbound static1.1.13 nat server (for normal nat server)1.1.14 nat static1.1.15 nat static net-to-net1 NAT配置命令1.1 NAT配置命令1.1.1 display nat address-group【命令】display nat address-group [ group-number ]【视图】任意视图【缺省级别】1:监控级【参数】group-number:表示地址池索引号。
取值范围为0~255。
【描述】display nat address-group命令用来显示NAT地址池的信息。
相关配置可参考命令nat address-group。
【举例】# 显示NAT地址池的信息。
<Sysname> display nat address-groupNAT address-group information:There are currently 2 nat address-group(s)1 : from 202.110.10.10 to 202.110.10.152 : from 202.110.10.20 to 202.110.10.25# 显示索引号为1的NAT地址池信息。
华为nat配置实例

窗体顶端NAT【Router】华为路由器单臂路由配置实例组网描述:PC---------------------3050C-------------------------AR28-31-------------------------INTERNET组网实现:3050C上划分多个VLAN,在AR28-31上终结VLAN信息,下面的所有VLAN中的PC都可以上公网,所有的PC机都通过AR28-31分配IP地址和DNS[AR28-31]dis cu#sysname Quidway#FTP server enable#nat address-group 0 222.222.222.2 222.222.222.10用于上公网的地址池#radius scheme system#domain system#local-user adminpasswordcipher .]@USE=B,53Q=^Q`MAF4<1!! service-type telnet terminallevel 3service-type ftplocal-userhuawei telnet用户,用于远程管理password simple huaweiservice-type telnetlevel 3#dhcp server ip-pool 10为VLAN10分配IP地址network 192.168.10.0 mask 255.255.255.0gateway-list 192.168.10.1dns-list 100.100.100.100#dhcp server ip-pool 20为VLAN20分配IP地址network 192.168.20.0 mask 255.255.255.0gateway-list 192.168.20.1dns-list 100.100.100.100#dhcp server ip-pool 30为VLAN30分配IP地址network 192.168.30.0 mask 255.255.255.0gateway-list 192.168.30.1dns-list 100.100.100.100#dhcp server ip-pool 40为VLAN40分配IP地址network 192.168.40.0 mask 255.255.255.0gateway-list 192.168.40.1dns-list 100.100.100.100#interface Aux0async mode flow#interfaceEthernet1/0用于与交换机的管理IP互通ip address 192.168.100.1 255.255.255.0 firewall packet-filter 3000 inbound#interfaceEthernet1/0.1终结交换机上的VLAN10tcp mss 1024ip address 192.168.10.1 255.255.255.0 firewall packet-filter 3000 inbound vlan-type dot1q vid 10#interfaceEthernet1/0.2终结交换机上的VLAN20tcp mss 1024ip address 192.168.20.1 255.255.255.0 firewall packet-filter 3000 inbound vlan-type dot1q vid 20#interfaceEthernet1/0.3终结交换机上的VLAN30tcp mss 1024ip address 192.168.30.1 255.255.255.0 firewall packet-filter 3000 inbound vlan-type dot1q vid 30#interfaceEthernet1/0.4终结交换机上的VLAN40tcp mss 1024ip address 192.168.40.1 255.255.255.0 firewall packet-filter 3000 inbound vlan-type dot1q vid 40#interface Ethernet2/0ip address 222.222.222.1 255.255.255.0 nat outbound 2000 address-group 0进行私网到公网的地址转换#interface NULL0#acl number 2000允许192.168.0.0 这个网段的地址进行地址转换rule 0 permit source 192.168.0.0 0.0.255.255rule 1 deny#acl number 3000rule 0 deny udp destination-port eq tftp rule 1 deny tcp destination-port eq 135 rule 2 deny udp destination-port eq 135 rule 3 deny udp destination-port eq netbios-nsrule 4 deny udp destination-port eq netbios-dgmrule 5 deny tcp destination-port eq 139 rule 6 deny udp destination-port eq netbios-ssnrule 7 deny tcp destination-port eq 445 rule 8 deny udp destination-port eq 445 rule 9 deny tcp destination-port eq 539 rule 10 deny udp destination-port eq 539 rule 11 deny udp destination-port eq 593 rule 12 deny tcp destination-port eq 593 rule 13 deny udp destination-port eq 1434rule 14 deny tcp destination-port eq 4444rule 15 deny tcp destination-port eq 9996rule 16 deny tcp destination-port eq 5554rule 17 deny udp destination-port eq 9996rule 18 deny udp destination-port eq 5554rule 19 deny tcp destination-port eq 137 rule 20 deny tcp destination-port eq 138 rule 21 deny tcp destination-port eq 1025rule 22 deny udp destination-port eq 1025rule 23 deny tcp destination-port eq 9995rule 24 deny udp destination-port eq 9995rule 25 deny tcp destination-port eq 1068rule 26 deny udp destination-port eq 1068rule 27 deny tcp destination-port eq 1023rule 28 deny udp destination-port eq 1023#ip route-static 0.0.0.0 0.0.0.0 222.222.222.254 preference 60到电信网关的缺省路由#user-interface con 0user-interface aux 0user-interface vty 0 4authentication-mode scheme#return===================================== ==========================<Quidway 3050C>dis cu#sysname Quidway#radius scheme systemserver-type huaweiprimary authentication 127.0.0.1 1645 primary accounting 127.0.0.1 1646 user-name-format without-domaindomain systemradius-scheme systemaccess-limit disablestate activevlan-assignment-mode integeridle-cut disableself-service-url disablemessenger time disabledomain default enable system#local-server nas-ip 127.0.0.1 key huaweilocal-user huawei用于WEB网管和TELNETpassword simple huaweiservice-type telnet level 3#vlan 1#vlan 10#vlan 20#vlan 30# vlan 40#interfaceVlan-interface1管理IPip address 192.168.100.2 255.255.255.0 #interface Aux0/0#interface Ethernet0/1port access vlan 10#interface Ethernet0/2port access vlan 10#interface Ethernet0/3port access vlan 10#interface Ethernet0/4port access vlan 10#interface Ethernet0/5port access vlan 10#interface Ethernet0/6port access vlan 10#interface Ethernet0/7port access vlan 10#interface Ethernet0/8port access vlan 10#interface Ethernet0/9port access vlan 10#interface Ethernet0/10port access vlan 10#interface Ethernet0/11port access vlan 20#interface Ethernet0/12port access vlan 20#interface Ethernet0/13 port access vlan 20#interface Ethernet0/14 port access vlan 20#interface Ethernet0/15 port access vlan 20#interface Ethernet0/16 port access vlan 20#interface Ethernet0/17 port access vlan 20#interface Ethernet0/18 port access vlan 20#interface Ethernet0/19 port access vlan 20#interface Ethernet0/20 port access vlan 20#interface Ethernet0/21 port access vlan 30#interface Ethernet0/22 port access vlan 30#interface Ethernet0/23 port access vlan 30#interface Ethernet0/24 port access vlan 30#interface Ethernet0/25 port access vlan 30#interface Ethernet0/26 port access vlan 30# interface Ethernet0/27 port access vlan 30#interface Ethernet0/28 port access vlan 30#interface Ethernet0/29 port access vlan 30#interface Ethernet0/30 port access vlan 30#interface Ethernet0/31 port access vlan 40#interface Ethernet0/32 port access vlan 40#interface Ethernet0/33 port access vlan 40#interface Ethernet0/34 port access vlan 40#interface Ethernet0/35 port access vlan 40#interface Ethernet0/36 port access vlan 40#interface Ethernet0/37 port access vlan 40#interface Ethernet0/38 port access vlan 40#interface Ethernet0/39 port access vlan 40#interface Ethernet0/40 port access vlan 40#interface Ethernet0/41 port access vlan 40 #interface Ethernet0/42port access vlan 40 #interface Ethernet0/43 port access vlan 40 #interface Ethernet0/44 port access vlan 40 #interface Ethernet0/45 port access vlan 40 #interface Ethernet0/46 port access vlan 40 #interface Ethernet0/47 port access vlan 40 #interface Ethernet0/48 上行口port link-type trunkport trunk permit vlan 1 10 20 30 40 只允许这几个VLAN 标签透传 #interface NULL0 #user-interface aux 0 user-interface vty 0 4 #return<Quidway> 0人了章。
华为NAT配置案例

华为NAT配置案例模拟图表1模拟拓扑图1、在华为设备上部署静态NAT技术,实现公司员工(私网)访问internet(公网)静态一对一:AR1#interface GigabitEthernet0/0/1ip address 202.106.1.2 255.255.255.0nat static global 202.1.1.1 inside 192.168.1.2 netmask255.255.255.255AR2#[AR2]ip route-static 202.1.1.1 255.255.255.255 202.106.1.2[AR2]结果测试:查看静态转换表[AR1]display nat staticStatic Nat Information:Interface : GigabitEthernet0/0/1Global IP/Port : 202.1.1.1/----Inside IP/Port : 192.168.1.2/----Protocol : ----VPN instance-name : ----Acl number : ----Netmask : 255.255.255.255Description : ----Total : 1[AR1]在没有做静态NAT条目的PC2上不能访问公网,可以得出结论:静态NAT是静态一对一的关系2、在华为设备上部署动态NAT技术,实现公司员工(私网)访问internet(公网)动态NAT[AR1]nat address-group 1 202.1.1.1 202.1.1.1(定义一个地址池存放一个可用公网地址202.1.1.1)[AR1]dis cu | begin aclacl number 2000 (定义转换的源IP)rule 5 permit source 192.168.1.0 0.0.0.255interface GigabitEthernet0/0/1(接口调用)ip address 202.106.1.2 255.255.255.0nat outbound 2000 address-group 1结果测试:在出接口下将ACL和地址池关联起来,需要注意华为设备上如果地支持中有不止一个IP地址,后面需加no-pat,本例中只有一个地址可以不加;PC1和PC2都可以访问公网[AR1-GigabitEthernet0/0/1]nat outbound 2000 address-group 1 ?no-pat Not use PAT<cr> Please press ENTER to execute command3、在华为设备上部署PAT技术实现公司员工(私网)访问internet(公网)AR1#acl number 2000rule 5 permit source 192.168.1.0 0.0.0.255interface GigabitEthernet0/0/1ip address 202.106.1.2 255.255.255.0nat outbound 2000 (定义复用接口g0/0/1用于PAT转换)结果测试[AR1]dis nat outboundNAT Outbound Information:--------------------------------------------------------------------------Interface Acl Address-group/IP/Interface Type--------------------------------------------------------------------------GigabitEthernet0/0/1 2000 202.106.1.2 easyip--------------------------------------------------------------------------Total : 1[AR1]4、在华为设备上部署静态端口映射技术实现公网用户访问私网服务器静态端口映射--------------------------------------------------------------------------AR1#acl number 2000rule 5 permit source 192.168.1.0 0.0.0.255interface GigabitEthernet0/0/1ip address 202.106.1.2 255.255.255.0nat static protocol tcp global 202.1.1.1 23 inside 192.168.1.4 23 nat outbound 2000#return[AR1-GigabitEthernet0/0/1]--------------------------------------------------------------------------AR3#[AR3]ip route-static 0.0.0.0 0.0.0.0 192.168.1.1[AR3]dis cu | begin vtyuser-interface vty 0 4authentication-mode passwordset authentication password cipher ****user-interface vty 16 20[AR3]。
华为Eudemon防火墙NAT配置实例

[原创]华为Eudemon防火墙NAT配置实例Post By:2007-7-11 11:35:00贴一下我公司里防火墙的配置,希望能够起到抛砖引玉的作用。
具体外网IP和内网ARP绑定信息已经用“x”替代,请根据实际情况更换。
“//”后面的部分是我导出配置后添加的注释。
防火墙型号为华为Eudemon 200,E0/0/0口为外网接口,E0/0/1口为内网。
另外此配置方法也完全适用于华为Secpath系列防火墙,略加改动也可适用于华为AR系列路由器。
------------------------------------------传说中的分隔线------------------------------------------#sysname Eudemon//设置主机名#super password level 3 simple xxxxxxxx//Super密码为xxxxxxxx #firewall packet-filter default permit interzone local trust direction inboundfirewall packet-filter default permit interzone local trust direction outboundfirewall packet-filter default permit interzone local untrust direction inboundfirewall packet-filter default permit interzone local untrust direction outboundfirewall packet-filter default permit interzone local dmz direction inboundfirewall packet-filter default permit interzone local dmz direction outboundfirewall packet-filter default permit interzone trust untrust direction inboundfirewall packet-filter default permit interzone trust untrust direction outboundfirewall packet-filter default permit interzone trust dmz direction inboundfirewall packet-filter default permit interzone trust dmz direction outboundfirewall packet-filter default permit interzone dmz untrust direction inboundfirewall packet-filter default permit interzone dmz untrust direction outbound//设置默认允许所有数据包通过#青岛IT社区提醒:本地交易眼见为实,当面验货!不要嫌麻烦!交易地点建议在人多地方,防止抢劫!QQ:支持(0) 中立(0) 反对(0)wanghaoqd 小大 2楼个性首页| QQ| 信息| 搜索| 邮箱| 主页| 手机号码所在地查询|加好友发短信蛋白超人等级:退役版主帖子:206 7积分:185 威望:5精华:1 注册:2004-3-24Post By:2007-7-11 11:35:00nat address-group 1 //将ISP分配的公网IP加入地址池1nat server global insidenat server global insidenat server global insidenat server global insidenat server global inside //将几个公网IP地址映射到内部服务器nat alg enable ftpnat alg enable dnsnat alg enable icmpnat alg enable netbiosundo nat alg enable h323undo nat alg enable hwccundo nat alg enable ilsundo nat alg enable pptpundo nat alg enable qqundo nat alg enable msnundo nat alg enable user-defineundo nat alg enable rtspfirewall permit sub-ip#firewall statistic system enable#interface Aux0async mode flowlink-protocol ppp#interface Ethernet0/0/0ip address //设置外网端口IP地址,此处为网通分配的内部私有IP,#interface Ethernet0/0/1ip address //设置内网IP地址,采用#interface NULL0#acl number 2000rule 0 permit source //ACL 2000,目的是只允许rule 1 deny#acl number 3001rule 0 deny udp destination-port eq 445rule 1 deny udp destination-port eq netbios-nsrule 2 deny udp destination-port eq netbios-dgmrule 3 deny udp destination-port eq netbios-ssnrule 4 deny udp destination-port eq 1434rule 5 deny tcp destination-port eq 135rule 6 deny tcp destination-port eq 139rule 7 deny tcp destination-port eq 389rule 8 deny tcp destination-port eq 445rule 9 deny tcp destination-port eq 636rule 10 deny tcp destination-port eq 1025rule 11 deny tcp destination-port eq 1503rule 12 deny tcp destination-port eq 3268rule 13 deny tcp destination-port eq 3269rule 14 deny tcp destination-port eq 4444rule 15 deny tcp destination-port eq 5554rule 16 deny tcp destination-port eq 5800rule 17 deny tcp destination-port eq 5900rule 18 deny tcp destination-port eq 9996rule 19 deny tcp destination-port eq 6667//ACL 300 1,关闭常见蠕虫病毒使用的端口#firewall zone localset priority 100QQ:支持(0) 中立(0) 反对(0)wanghaoqd 小大 3楼个性首页| QQ| 信息| 搜索| 邮箱| 主页| 手机号码所在地查询|加好友发短信蛋白超人等级:退役版主帖子:206 7积分:185 威望:5精华:1 注册:2004-3-24Post By:2007-7-11 11:36:00#firewall zone trustset priority 85add interface Ethernet0/0/1//将E0/ 0/1口加入TRUST区#firewall zone untrustset priority 5add interface Ethernet0/0/0 //将E0/0/0口加入UN TRUST区#firewall zone dmzset priority 50#firewall interzone local trustpacket-filter 3001 inbound//在LO CAL到TRUST方向应用ACL 3001号#firewall interzone local untrustpacket-filter 3001 inbound//在LO CAL到UNTRUST方向应用ACL 3001号#firewall interzone local dmz#firewall interzone trust untrustnat outbound 2000 address-group 1 //在TRUST到U NTRUST的方向做NAT,使用2000号ACL#firewall interzone trust dmz#firewall interzone dmz untrust#aaalocal-user admin password cipher A^.5<+_KCH)./a!1$H@GYA!!//建立用户admin,密码为密文local-user admin level 3 //用户权限为3(最高级)authentication-scheme default#authorization-scheme default#accounting-scheme default#domain default##arp static xxxx-xxxx-xxxx//做IP和MAC地址绑定arp static xxxx-xxxx-xxxxarp static xxxx-xxxx-xxxxarp static xxxx-xxxx-xxxxarp static xxxx-xxxx-xxxxarp static xxxx-xxxx-xxxx…………………………//省略许多行......arp static 1111-1111-1111arp static 1111-1111-1111arp static 1111-1111-1111arp static 1111-1111-1111arp static 1111-1111-1111//把不使用的IP与不存在的#ip route-static //设置缺省路由,此处IP地址为网通内部IP,#snmp-agentsnmp-agent local-engineid 000007DB7F00000Dsnmp-agent community read xxxxxxsnmp-agent community write xxxxxxsnmp-agent sys-info version all//设置SNMP参数,以使用网管软件来监控#user-interface con 0user-interface aux 0user-interface vty 0 4authentication-mode aaa//设置VTY口的认证模式为AAA#returnQQ:支持(0) 中立(0) 反对(0) pladin123小大 4楼个性首页| 信息| 搜索| 邮箱| 主页| 手机号码所在地查询|加好友发短信等级:QDIT游民帖子:23 8积分:1309 威望:0 精华:0 注册:2007-3-30 16:0 4:00Post By:2007-7-23 13:12:00楼上的这种方法带宽方面的如何的呢?内网所有都用一个IP,那不是浪费了吗还有我们和美国视频会议的时候,会不会有影响。
ensp上防火墙上配置nat

ensp上防⽕墙上配置nat博⽂⼤纲:⼀、华为防⽕墙NAT的六个分类;⼆、解决NAT转换时的环路及⽆效ARP;三、server-map表的作⽤;四、NAT对报⽂的处理流程;五、各种常⽤NAT的配置⽅法;⼀、华为防⽕墙NAT的六个分类华为防⽕墙的NAT分类:NAT No-PAT:类似于Cisco的动态转换,只转换源IP地址,不转换端⼝,属于多对多转换,不能节约公⽹IP地址,使⽤情况较少。
NAPT(Network Address and Port Translation,⽹络地址和端⼝转换):类似于Cisco的PAT转换,NAPT即转换报⽂的源地址,⼜转换源端⼝。
转换后的地址不能是外⽹接⼝IP地址,属于多对多或多对⼀转换,可以节约公⽹IP地址,使⽤场景较多。
出接⼝地址(Easy-IP):因其转换⽅式⾮常简单,所以也被称为Easy-IP、和NAPT⼀样,即转换源IP地址,⼜转换源端⼝。
区别是出接⼝地址⽅式转换后的地址只能是NAT设备外⽹接⼝所配置的IP地址,属于多对⼀转换,可以节约IP地址。
NAT Server:静态⼀对⼀发布,主要⽤于内部服务器需要对Internet提供服务时使⽤,。
Smart NAT(智能转换):通过预留⼀个公⽹地址进⾏NAPT转换,⽽其他的公⽹地址⽤来进⾏NAT No-PAT转换,该⽅式不太常⽤。
三元组NAT:与源IP地址、源端⼝和协议类型有关的⼀种转换,将源IP地址和源端⼝转换为固定公⽹IP地址和端⼝,能解决⼀些特殊应⽤在普遍NAT中⽆法实现的问题。
主要应⽤于外部⽤户访问局域⽹的⼀些P2P应⽤。
⼆、解决NAT转换时的环路及⽆效ARP在特定的NAT转换时,可能会产⽣环路及⽆效ARP,关于其如何产⽣,⼤概就是,在有些NAT的转换⽅式中,是为了解决内⽹连接Internet,⽽映射出了⼀个公有IP,那么,若此时有⼈通过internet来访问这个映射出来的公有IP,就会产⽣这两种情况。
若要详细说起来,⼜是很⿇烦,但是解决这两个问题很简单,就是配置⿊洞路由(将internet主动访问映射出来的地址的流量指定到空接⼝null0),关于如何配置,将在过后的配置中展⽰出来,我总结了以下需要配置⿊洞路由的场景,如下表所⽰:表中的前三个可以对应到⽂章开始的⼏个NAT类型中,那么NAT Server(粗泛)、NAT Server(精细)⼜是什么⿁呢?NAT Server(粗泛):是NAT Server转换类型中的⼀种,表⽰源地址和转换后的地址只有简单的映射关系,没有涉及端⼝等映射,如源地址为192.168.1.2,转换后的地址为33.2.55.6,如果做的是NAT Server(粗泛)这种类型的NAT,那么所有访问33.2.55.6的数据包都将转发给192.168.1.2这个地址。
华为防火墙NAT配置命令

私网用户通过NAPT方式访问Internet(备注:在这种环境中,外网只能ping通外网口,公网没有写入到内网的路由,所以前提是内网只能ping通外网口,但走不到外网口以外的网络,做了NAT之后,内网可以通外网任何网络,但是外网只能ping到本地内网的外网口。
)本例通过配置NAPT功能,实现对少量公网IP地址的复用,保证公司员工可以正常访问Internet。
组网需求如图1所示,某公司内部网络通过USG9000与Internet相连,USG9000作为公司内网的出口网关。
由于该公司拥有的公网IP地址较少(202.169.1.21~202.169.1.25),所以需要利用USG9000的NAPT功能复用公网IP地址,保证员工可以正常访问Internet。
图1 配置私网用户通过NAPT方式访问Internet组网图配置思路1.完成设备的基础配置,包括配置接口的IP地址,并将接口加入安全区域。
2.配置安全策略,允许私网指定网段访问Internet。
3.配置NAT地址池和NAT策略,对指定流量进行NAT转换,使私网用户可以使用公网IP地址访问Internet。
4.配置黑洞路由,防止产生路由环路。
操作步骤1.配置USG9000的接口IP地址,并将接口加入安全区域。
# 配置接口GigabitEthernet 1/0/1的IP地址。
<USG9000> system-view[USG9000] interface GigabitEthernet 1/0/1[USG9000-GigabitEthernet1/0/1] ip address 10.1.1.10 24[USG9000-GigabitEthernet1/0/1] quit# 配置接口GigabitEthernet 1/0/2的IP地址。
[USG9000] interface GigabitEthernet 1/0/2[USG9000-GigabitEthernet1/0/2] ip address 202.169.1.1 24[USG9000-GigabitEthernet1/0/2] quit# 将接口GigabitEthernet 1/0/1加入Trust区域。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
图表1模拟拓扑图
1、在华为设备上部署静态NAT技术,实现公司员工(私网)访问internet(公网)
静态一对一:
AR1#
interface GigabitEthernet0/0/1
ip address 202.106.1.2 255.255.255.0
nat static global 202.1.1.1 inside 192.168.1.2 netmask 255.255.255.255
Global IP/Port : 202.1.1.1/----
Inside IP/Port : 192.168.1.2/----
Protocol : ----
VPN instance-name : ----
Acl number : ----
Netmask : 255.255.255.255
Description : ----
user-interface vty 16 20
[AR3]
GigabitEthernet0/0/1 2000 202.106.1.2 easyip
--------------------------------------------------------------------------
Total : 1
[AR1]
4、在华为设备上部署静态端口映射技术实现公网用户访问私网服务器
nat outbound 2000 address-group 1
结果测试:
在出接口下将ACL和地址池关联起来,需要注意华为设备上如果地支持中有不止一个IP地址,后面需加no-pat,本例中只有一个地址可以不加;PC1和PC2都可以访问公网
[AR1-GigabitEthernet0/0/1]nat outbound 2000 address-group 1 ?
no-pat Not use PAT
<cr> Please press ENTER to execute command
3、在华为设备上部署PAT技术实现公司员工(私网)访问internet(公网)
AR1#
acl number 2000
rule 5 permit source 192.168.1.0 0.0.0.255
ip address 202.106.1.2 255.255.255.0
nat static protocol tcp global 202.1.1.123inside 192.168.1.423
nat outbound 2000
#
return
[AR1-GigabitEthernet0/0/1]
--------------------------------------------------------------------------
Total : 1
[R1]
在没有做静态NAT条目的PC2上不能访问公网,可以得出结论:静态NAT是静态一对一的关系
2、在华为设备上部署动态NAT技术,实现公司员工(私网)访问internet(公网)
动态NAT
[AR1]nat address-group 1 202.1.1.1 202.1.1.1(定义一个地址池存放一个可用公网地址202.1.1.1)
静态端口映射
--------------------------------------------------------------------------
AR1#
acl number 2000
rule 5 permit source 192.168.1.0 0.0.0.255
interface GigabitEthernet0/0/1
--------------------------------------------------------------------------
Interface Acl Address-group/IP/Interface Type
--------------------------------------------------------------------------
interface GigabitEthernet0/0/1
ip address 202.106.1.2 255.255.255.0
nat outbound 2000 (定义复用接口g0/0/1用于PAT转换)
结果测试
[AR1]dis nat outbound
NAT Outbound Information:
[AR1]dis cu | begin acl
acl number 2000(定义转换的源IP)
rule 5 permit source 192.168.1.0 0.0.0.255
interface GigabitEthernet0/0/1(接口调用)
ip address 202.106.1.2 255.255.255.0
AR3#
[AR3]ip route-static 0.0.0.0 0.0.0.0 192.168.1.1
[AR3]dis cu | begin vty
user-interface vty 0 4
authentication-mode password
set authentication password cipher****
AR2#
[AR2]ip route-static 202.1.1.1 255.255.255.255 202.106.1.2
[AR2]
结果测试:
查看静态转换表
[AR1]display nat static
Static Nat Information:
Interface : GigabitEthernet0/0/1