CLI example: Configuring NAT Server for external-to-internal access

Network configuration

As shown in Figure 1, two Web servers, one FTP server and one SMTP server, are in the internal network to provide services for external users. The internal network address is 10.110.0.0/16. The company has three public IP addresses from 202.38.1.1/24 to 202.38.1.3/24.

Configure the NAT Server feature to allow the external user to access the internal servers with public address 202.38.1.1/24.

Figure 1 Network diagram

 

Software versions used

This configuration example was created and verified on F9900 of the F5000-AI120 device.

Procedures

# Assign IP addresses to interfaces and configure routes, security zones, zone pairs, and interzone policies. Make sure the network connections are available. (Details not shown.)

# Enter interface view of GigabitEthernet 1/0/2.

<Device> system-view

[Device] interface gigabitethernet 1/0/2

# Configure a NAT server mapping to allow external users to access the FTP server by using the address 202.38.1.1 and port 21.

[Device-GigabitEthernet1/0/2] nat server protocol tcp global 202.38.1.1 21 inside 10.110.10.3 ftp

# Configure a NAT server mapping to allow external users to access the Web server 1 by using the address 202.38.1.1 and port 80.

[Device-GigabitEthernet1/0/2] nat server protocol tcp global 202.38.1.1 80 inside 10.110.10.1 http

# Configure a NAT server mapping to allow external users to access the Web server 2 by using the address 202.38.1.1 and port 8080.

[Device-GigabitEthernet1/0/2] nat server protocol tcp global 202.38.1.1 8080 inside 10.110.10.2 http

# Configure a NAT server mapping to allow external users to access the SMTP server by using the address 202.38.1.1 and port number defined by SMTP.

[Device-GigabitEthernet1/0/2] nat server protocol tcp global 202.38.1.1 smtp inside 10.110.10.4 smtp

[Device-GigabitEthernet1/0/2] quit

Verifying the configuration

# Verify that the host on the external network can access the internal servers by using the public addresses. (Details not shown.)

# Display all NAT configuration and statistics.

[Device] display nat all

NAT internal server information:

  Totally 4 internal servers.

  Interface: GigabitEthernet1/0/2

    Protocol: 6(TCP)

    Global IP/port: 202.38.1.1/21

    Local IP/port : 10.110.10.3/21

    Rule name     : ServerRule_1

    NAT counting  : 0

    Config status : Active

 

  Interface: GigabitEthernet1/0/2

    Protocol: 6(TCP)

    Global IP/port: 202.38.1.1/25

    Local IP/port : 10.110.10.4/25

    Rule name     : ServerRule_4

    NAT counting  : 0

    Config status : Active

 

  Interface: GigabitEthernet1/0/2

    Protocol: 6(TCP)

    Global IP/port: 202.38.1.1/80

    Local IP/port : 10.110.10.1/80

    Rule name     : ServerRule_2

    NAT counting  : 0

    Config status : Active

 

  Interface: GigabitEthernet1/0/2

    Protocol: 6(TCP)

    Global IP/port: 202.38.1.1/8080

    Local IP/port : 10.110.10.2/80

    Rule name     : ServerRule_3

    NAT counting  : 0

    Config status : Active

 

NAT logging:

  Log enable          : Disabled

  Flow-begin          : Disabled

  Flow-end            : Disabled

  Flow-active         : Disabled

  Port-block-assign   : Disabled

  Port-block-withdraw : Disabled

  Alarm               : Disabled

  NO-PAT IP usage     : Disabled

 

NAT mapping behavior:

  Mapping mode : Address and Port-Dependent

  ACL          : ---

  Config status: Active

 

NAT ALG:

  DNS        : Enabled

  FTP        : Enabled

  H323       : Disabled

  ICMP-ERROR : Enabled

  ILS        : Disabled

  MGCP       : Disabled

  NBT        : Disabled

  PPTP       : Enabled

  RTSP       : Enabled

  RSH        : Disabled

  SCCP       : Disabled

  SCTP       : Disabled

  SIP        : Disabled

  SQLNET     : Disabled

  TFTP       : Disabled

  XDMCP      : Disabled

 

Static NAT load balancing:     Disabled

 

NAT link-switch recreate-session: Disabled

 

NAT configuration-for-new-connection: Disabled

# Display NAT sessions that are generated when Host accesses the FTP server.

[Device] display nat session verbose

Slot 1:

Initiator:

  Source      IP/port: 202.38.1.2/52802

  Destination IP/port: 202.38.1.1/21

  DS-Lite tunnel peer: -

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

  Protocol: TCP(6)

  Inbound interface: GigabitEthernet1/0/2

  Source security zone: Untrust

Responder:

  Source      IP/port: 10.110.10.3/21

  Destination IP/port: 202.38.1.2/52802

  DS-Lite tunnel peer: -

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

  Protocol: TCP(6)

  Inbound interface: GigabitEthernet1/0/1

  Source security zone: Trust

State: TCP_ESTABLISHED

Application: FTP

Rule ID: -/-/-

Rule name:

Start time: 2017-05-21 11:13:39  TTL: 3597s

Initiator->Responder:            7 packets        313 bytes

Responder->Initiator:            6 packets        330 bytes

Total sessions found: 1

Configuration files

#

interface GigabitEthernet1/0/1

 ip address 10.110.10.10 255.255.0.0

#

interface GigabitEthernet1/0/2

 ip address 202.38.1.1 255.255.255.0

 nat server protocol tcp global 202.38.1.1 21 inside 10.110.10.3 21

 nat server protocol tcp global 202.38.1.1 25 inside 10.110.10.4 25

 nat server protocol tcp global 202.38.1.1 80 inside 10.110.10.1 80

 nat server protocol tcp global 202.38.1.1 8080 inside 10.110.10.2 80

#

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

#