CLI方式:内网用户通过NAT地址访问外网典型配置(静态地址转换)

使用版本

本举例是在F1090R8660P33版本上进行配置和验证的。

组网需求

如下图所示,内部网络用户10.110.10.8/24使用外网地址202.38.1.100访问Internet

图-1 内网用户通过NAT地址访问外网配置组网图(静态地址转换)

配置步骤

# 配置接口IP地址、路由、安全域及域间策略保证网络可达,具体配置步骤略。

# 配置内网IP地址10.110.10.8到外网地址202.38.1.100之间的一对一静态地址转换映射。

<Device> system-view

[Device] nat static outbound 10.110.10.8 202.38.1.100

# 使配置的静态地址转换在接口GigabitEthernet1/0/2上生效。

[Device] interface gigabitethernet 1/0/2

[Device-GigabitEthernet1/0/2] nat static enable

[Device-GigabitEthernet1/0/2] quit

验证配置

# 以上配置完成后,内网主机可以访问外网服务器。通过查看如下显示信息,可以验证以上配置成功。

[Device] display nat static

Static NAT mappings:

  Totally 1 outbound static NAT mappings.

  IP-to-IP:

    Local IP     : 10.110.10.8

    Global IP    : 202.38.1.100

    Config status: Active

 

Interfaces enabled with static NAT:

  Totally 1 interfaces enabled with static NAT.

  Interface: GigabitEthernet1/0/2

    Config status: Active

# 通过以下显示命令,可以看到Host访问某外网服务器时生成NAT会话信息。

[Device] display nat session verbose

Slot 1:

Initiator:

  Source      IP/port: 10.110.10.8/54765

  Destination IP/port: 202.38.1.2/23

  DS-Lite tunnel peer: -

  VPN instance/VLAN ID/Inline ID: -/-/-

  Protocol: TCP(6)

  Inbound interface: GigabitEthernet1/0/1

  Source security zone: Trust

Responder:

  Source      IP/port: 202.38.1.2/23

  Destination IP/port: 202.38.1.100/54765

  DS-Lite tunnel peer: -

  VPN instance/VLAN ID/Inline ID: -/-/-

  Protocol: TCP(6)

  Inbound interface: GigabitEthernet1/0/2

  Source security zone: Untrust

State: TCP_ESTABLISHED

Application: TELNET

Rule ID: -/-/-

Rule name:

Start time: 2017-05-19 10:57:47  TTL: 1195s

Initiator->Responder:            8 packets        375 bytes

Responder->Initiator:           10 packets        851 bytes

 

Total sessions found: 1

配置文件

#

 nat static outbound 10.110.10.8 202.38.1.100

#

interface GigabitEthernet1/0/1

 ip address 10.110.10.1 255.255.255.0

#

interface GigabitEthernet1/0/2

 ip address 202.38.1.1 255.255.0.0

 nat static enable

#

security-zone name Trust

 import interface GigabitEthernet1/0/1

#

security-zone name Untrust

 import interface GigabitEthernet1/0/2

#

security-policy ip

 rule 0 name trust-untrust

  action pass

  source-zone trust

  destination-zone untrust

 rule 1 name untrust-trust

  action pass

  source-zone untrust

  destination-zone trust

#