华为NAT配置案例精编版
华为防火墙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区域。
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地址池信息。
[史上最详细]H3C路由器NAT典型配置案例
![[史上最详细]H3C路由器NAT典型配置案例](https://img.taocdn.com/s3/m/882e4d6942323968011ca300a6c30c225801f060.png)
H3C路由器NAT典型配置案列(史上最详细)神马CCIE,H3CIE,HCIE等网络工程师日常实施运维必备,你懂的。
1.11 NAT典型配置举例1.11.1 内网用户通过NAT地址访问外网(静态地址转换)1. 组网需求内部网络用户10.110.10.8/24使用外网地址202.38.1.100访问Internet。
2. 组网图图1-5 静态地址转换典型配置组网图3. 配置步骤# 按照组网图配置各接口的IP地址,具体配置过程略。
# 配置内网IP地址10.110.10.8到外网地址202.38.1.100之间的一对一静态地址转换映射。
<Router> system-view[Router] nat static outbound 10.110.10.8 202.38.1.100# 使配置的静态地址转换在接口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 : 10.110.10.8Global IP : 202.38.1.100Interfaces enabled with static NAT:There are 1 interfaces enabled with static NAT.Interface: GigabitEthernet1/2# 通过以下显示命令,可以看到Host访问某外网服务器时生成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配置实例

Router(config)#interface f0/0
Router(config-if)#ip nat insice
二、 动态NAT配置
如图内部局域网使用的IP是172.16.100.1—172.16.255.254,路由器局域网端口(默认网关)的
Router(config)#interface f0/0
Router(config)#ip address 10.1.1.1 255.255.255.0
Router(config-if)#no shutdown
(2) 定义内部访问列表:
Router(config)#access-list 99 permit 10.1.1.0 0.0.0.255
Router(config)#ip nat inside source static 192.168.100.4 61.159.62.132
Router(config)#ip nat inside source static 192.168.100.5 61.159.62.133
(4)定义合法的IP地址池:
Router(config)#ip nat pool zhou 61.159.62130 61.159.62.190 netmask 255.255.255.192(定
义地址池的名字为zhou)
(5)实现网络地址转换:
Router(config)#ip nat inside source list 99 pool zhou 【overload】(overload:地址复用
(3) 设置复用动态IP:
Router(config)ip nat inside source list 99 interface s0/0 overload(由于直接使用路由器的
华为路由器配置实例

通过在外网口配置nat基本就OK 了,以下配置假设EthernetO/O为局域网接口,EthernetO/1 为外网口。
1、配置内网接口( EthernetO/O):[MSR20-20 ] in terface EthernetO/O[MSR20-20 - EthernetO/O]ip add 192.168.1.1 242、使用动态分配地址的方式为局域网中的PC分配地址[MSR20-20 ]dhcp server ip-pool 1[MSR20-20 -dhcp-pool-1]network 192.168.1.0 24[MSR20-20 -dhcp-pool-1]dns-list 202.96.134.133[MSR20-20 -dhcp-pool-1] gateway-list 192.168.1.13、配置nat[MSR20-20 ]nat address-group 1 公网IP 公网IP[MSR20-20 ]acl number 3000[MSR20-20 -acl-adv-3000]rule 0 permit ip4、配置外网接口( EthernetO/1)[MSR20-20 ] in terface EthernetO/1[MSR20-20 - Ethernet0/1]ip add 公网IP[MSR20-20 - EthernetO/1] nat outbound 3000 address-group 15 .加默缺省路由[MSR20-20 ]route-stac 0.0.0.0 0.0.0.0 夕卜网网关总结:在2020路由器下面,配置外网口,配置内网口,配置acl作nat,一条默认路由指向电信网关.ok!Console登陆认证功能的配置关键词:MSR;co nsole;一、组网需求:要求用户从con sole登录时输入已配置的用户名h3c和对应的口令h3c,用户名和口令正确才能登录成功。
NAT详解、实例(网管必看)-Ralap的日志-网易博客

NAT详解、实例(⽹管必看)-Ralap的⽇志-⽹易博客NAT详解、实例(⽹管必看)电脑⽹络 2010-11-03 10:58:44 阅读70 评论0 字号:⼤中⼩订阅NAT详解、实例(⽹管必看)1、配置实例(如果看不明⽩,别急,看完通篇⼀定会明⽩)version 12.0service timestamps debug uptimeservice timestamps log uptimeno service password-encryption!hostname nat-r1!enable secret 5 $1$FEQr$INhRecYBeCb.UqTQ3b9mY0!ip subnet-zero!!!!interface Ethernet0ip address 172.18.150.150 255.255.0.0no ip directed-broadcastip nat inside /* 定义此为⽹络的内部端⼝ */!interface Serial0ip address 192.1.1.161 255.255.255.252no ip directed-broadcastip nat outside /* 定义此为⽹络的外部端⼝ */no ip mroute-cacheno fair-queue!interface Serial1no ip addressno ip directed-broadcastshutdown! /* 定义从ISP那⾥申请到的IP在企业内部的分配策阅 */ip nat pool tech 192.1.1.100 192.1.1.120 netmask 255.255.255.0ip nat pool deve 192.1.1.121 192.1.1.150 netmask 255.255.255.0ip nat pool manager 192.1.1.180 192.1.1.200 netmask 255.255.255.0ip nat pool soft-1 192.1.1.170 192.1.1.179 netmask 255.255.255.0ip nat pool soft-2 192.1.1.151 192.1.1.159 netmask 255.255.255.0ip nat pool temp-user 192.1.1.160 192.1.1.160 netmask 255.255.255.0/* 将访问列表与地址池对应,以下为动态地址转换*/ip nat inside source list 1 pool techip nat inside source list 2 pool deveip nat inside source list 3 pool managerip nat inside source list 4 pool soft-1ip nat inside source list 5 pool soft-2/* 将访问列表与地址池对应,以下为复⽤动态地址转换*/ip nat inside source list 6 pool temp-user overload/* 将访问列表与地址池对应,以下为静态地址转换*/ip nat inside source static 172.18.100.168 192.1.1.168ip nat inside source static 172.18.100.169 192.1.1.169ip classlessip route 0.0.0.0 0.0.0.0 Serial0 /* 设置⼀个缺省路由 */! /* 内部⽹访问地址表,他指出内部⽹络能访问外部⽹的地址段,分别定义是为了对应不同的地址池 */access-list 1 permit 172.18.107.0 0.0.0.255access-list 2 permit 172.18.101.0 0.0.0.255access-list 3 permit 172.18.108.0 0.0.0.255access-list 4 permit 172.18.103.0 0.0.0.255access-list 4 permit 172.18.102.0 0.0.0.255access-list 4 permit 172.18.104.0 0.0.0.255access-list 5 permit 172.18.105.0 0.0.0.255access-list 5 permit 172.18.106.0 0.0.0.255access-list 6 permit 172.18.111.0 0.0.0.255!line con 0transport input noneline 1 16line aux 0line vty 0 4login!end2、NAT的原理IP地址耗尽促成了CIDR的开发,但CIDR开发的主要⽬的是为了有效的使⽤现有的internet地址。
华为路由器NAT命令详解

#
interface Serial0/0
ip address /公网出口/
nat outbound 2000 /在出接口上进行NAT转换/
#
interface Serial0/1
ip address /公网出口/
nat outbound 2000
#
interface NULL0
nat outbound 2000
#
interface Ethernet0/1
ip address /内网网关/
#
interface NULL0
#
ip route-static preference 60 /配置默认路由/
#
user-interface con 0
user-interface vty 0 4
#
ip route-static preference 60 /配置默认路由/
ip route-static preference 60 /配置默认路由/
#
user-interface con 0
user-interface vty 0 4
#
return
【验证】
disp ip rout
Routing Table: public net
配置脚本
#
sysname RouterA
#
radius scheme system
#
domain system
#
acl number 2000 /配置允许进行NAT转换的内网地址段/
rule 0 permit source
rule 1 deny
#
interface Ethernet0/0
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
华为N A T配置案例精
编版
MQS system office room 【MQS16H-TTMS2A-MQSS8Q8-MQSH16898】
华为NAT配置案例模拟
图表模拟拓扑图
1、在华为设备上部署静态NAT技术,实现公司员工(私网)访问internet(公网)
静态一对一:
AR1#
interfaceGigabitEthernet0/0/1
ipaddress
natstaticglobalinsidenetmask
AR2#
[AR2]iproute-static
[AR2]
结果测试:
查看静态转换表
[AR1]displaynatstatic
StaticNatInformation:
Interface:GigabitEthernet0/0/1
GlobalIP/Port:
InsideIP/Port:
Protocol:----
VPNinstance-name:----
Aclnumber:----
Netmask:
Description:----
Total:1
[AR1]
在没有做静态NAT条目的PC2上不能访问公网,可以得出结论:静态NAT是静态一对一的关系
2、在华为设备上部署动态NAT技术,实现公司员工(私网)访问internet(公网)
动态NAT
[AR1]nataddress-group1(定义一个地址池存放一个可用公网地址)
[AR1]discu|beginacl
aclnumber2000(定义转换的源IP)
rule5permitsource
interfaceGigabitEthernet0/0/1(接口调用)
ipaddress
natoutbound2000address-group1
结果测试:
?
在出接口下将ACL和地址池关联起来,需要注意华为设备上如果地支持中有不止一个IP地址,后面需加no-pat,本例中只有一个地址可以不加;PC1和PC2都可以访问公网
[AR1-GigabitEthernet0/0/1]natoutbound2000address-group1?
no-patNotusePAT
<cr>PleasepressENTERtoexecutecommand
3、在华为设备上部署PAT技术实现公司员工(私网)访问internet(公网)AR1#
aclnumber2000
rule5permitsource
interfaceGigabitEthernet0/0/1
ipaddress
natoutbound2000(定义复用接口g0/0/1用于PAT转换)
结果测试
[AR1]disnatoutbound
NATOutboundInformation:
--------------------------------------------------------------------------InterfaceAclAddress-group/IP/InterfaceType
--------------------------------------------------------------------------GigabitEthernet0/0/12000easyip
--------------------------------------------------------------------------Total:1
[AR1]
4、在华为设备上部署静态端口映射技术实现公网用户访问私网服务器
静态端口映射
--------------------------------------------------------------------------AR1#
aclnumber2000
rule5permitsource
interfaceGigabitEthernet0/0/1
ipaddress
natstaticprotocoltcpglobal23inside23
natoutbound2000
#
return
[AR1-GigabitEthernet0/0/1]
--------------------------------------------------------------------------AR3#
[AR3]iproute-static
[AR3]discu|beginvty
user-interfacevty04
authentication-modepassword
setauthenticationpasswordcipher****
user-interfacevty1620
[AR3]。