Showing results for 
Search instead for 
Did you mean: 

NAT(PAT) & Portforwarding ASA 5505



I have a ASA 5505.

ASA Version 8.4(4)1

ADSM Version 6.4(9)

In the startup wizard i choosed PAT.

I'm a bit unsecure if I'm doing the NAT & Access rules is right.

I'm trying to portforward a Service-group i created to a server on the LAN that should be access from the outside (WAN).

I'll attatch two screenshots from the NAT & Access rules configuration.



7 Replies 7

Jouni Forss


If possible could you provide the CLI format configuration of the ASA

And also give the following information

  • LAN server local IP
  • Services you need to forward to the LAN server
  • From what public networks you want to allow the connections? (Or perhaps from "any" source network?)

I ask this because I dont personally use the ASDM almost at all and for NAT and ACL configurations I never use it.

If you need some instructions regarding the CLI commands etc. I can help out with those.

- Jouni


I'll post the config, I have bolded the things I'm unsure off.

Lan server IP:

Services: Exchange RPC, http, https

Public network is "the internet", I should reach this portforward from anywhere on the internet.

Result of the command: "show running-config"

: Saved


ASA Version 8.4(4)1


hostname PreventASA

domain-name prevent.local

enable password encrypted

passwd encrypted



interface Ethernet0/0

switchport access vlan 2


interface Ethernet0/1


interface Ethernet0/2


interface Ethernet0/3


interface Ethernet0/4


interface Ethernet0/5


interface Ethernet0/6


interface Ethernet0/7


interface Vlan1

nameif inside

security-level 100

ip address


interface Vlan2

nameif outside

security-level 0

ip address x.x.x.x


ftp mode passive

dns domain-lookup inside

dns server-group DefaultDNS


domain-name prevent.local

object network obj_any


object network inside-range


object network Fantomen


object network Internet-IP

host x.x.x.x

object-group service Exchange_RPC tcp-udp

port-object range 6001 6002

port-object eq 6004

object-group service Portfowards_Fantomen

service-object tcp-udp destination range 6001 6002

service-object tcp-udp destination eq 6004

service-object tcp-udp destination eq www

service-object tcp destination eq https

access-list outside_access_in extended permit object-group Portfowards_Fantomen any object Fantomen

pager lines 24

logging asdm informational

mtu inside 1500

mtu outside 1500

icmp unreachable rate-limit 1 burst-size 1

no asdm history enable

arp timeout 14400


nat (inside,outside) after-auto source dynamic any interface

nat (inside,outside) after-auto source static Fantomen Fantomen

access-group outside_access_in in interface outside

route outside x.x.x.x 1

timeout xlate 3:00:00

timeout pat-xlate 0:00:30

timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02

timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00

timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00

timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute

timeout tcp-proxy-reassembly 0:01:00

timeout floating-conn 0:00:00

dynamic-access-policy-record DfltAccessPolicy

aaa-server AD-Server protocol nt

aaa-server AD-Server (inside) host

nt-auth-domain-controller FANTOMEN

user-identity default-domain LOCAL

aaa authentication ssh console AD-Server LOCAL

http server enable

http inside

http inside

no snmp-server location

no snmp-server contact

snmp-server enable traps snmp authentication linkup linkdown coldstart warmstart

crypto ca trustpoint _SmartCallHome_ServerCA

crl configure

crypto ca certificate chain _SmartCallHome_ServerCA

certificate ca 6ecc7aa5a7032009b8cebcf4e952d491

    308205ec 308204d4 a0030201 0202106e cc7aa5a7 032009b8 cebcf4e9 52d49130

    0d06092a 864886f7 0d010105 05003081 ca310b30 09060355 04061302 55533117

    30150603 55040a13 0e566572 69536967 6e2c2049 6e632e31 1f301d06 0355040b

    13165665 72695369 676e2054 72757374 204e6574 776f726b 313a3038 06035504

    0b133128 63292032 30303620 56657269 5369676e 2c20496e 632e202d 20466f72

    20617574 686f7269 7a656420 75736520 6f6e6c79 31453043 06035504 03133c56

    65726953 69676e20 436c6173 73203320 5075626c 69632050 72696d61 72792043

    65727469 66696361 74696f6e 20417574 686f7269 7479202d 20473530 1e170d31

    30303230 38303030 3030305a 170d3230 30323037 32333539 35395a30 81b5310b

    30090603 55040613 02555331 17301506 0355040a 130e5665 72695369 676e2c20

    496e632e 311f301d 06035504 0b131656 65726953 69676e20 54727573 74204e65

    74776f72 6b313b30 39060355 040b1332 5465726d 73206f66 20757365 20617420

    68747470 733a2f2f 7777772e 76657269 7369676e 2e636f6d 2f727061 20286329

    3130312f 302d0603 55040313 26566572 69536967 6e20436c 61737320 33205365

    63757265 20536572 76657220 4341202d 20473330 82012230 0d06092a 864886f7

    0d010101 05000382 010f0030 82010a02 82010100 b187841f c20c45f5 bcab2597

    a7ada23e 9cbaf6c1 39b88bca c2ac56c6 e5bb658e 444f4dce 6fed094a d4af4e10

    9c688b2e 957b899b 13cae234 34c1f35b f3497b62 83488174 d188786c 0253f9bc

    7f432657 5833833b 330a17b0 d04e9124 ad867d64 12dc744a 34a11d0a ea961d0b

    15fca34b 3bce6388 d0f82d0c 948610ca b69a3dca eb379c00 48358629 5078e845

    63cd1941 4ff595ec 7b98d4c4 71b350be 28b38fa0 b9539cf5 ca2c23a9 fd1406e8

    18b49ae8 3c6e81fd e4cd3536 b351d369 ec12ba56 6e6f9b57 c58b14e7 0ec79ced

    4a546ac9 4dc5bf11 b1ae1c67 81cb4455 33997f24 9b3f5345 7f861af3 3cfa6d7f

    81f5b84a d3f58537 1cb5a6d0 09e4187b 384efa0f 02030100 01a38201 df308201

    db303406 082b0601 05050701 01042830 26302406 082b0601 05050730 01861868

    7474703a 2f2f6f63 73702e76 65726973 69676e2e 636f6d30 12060355 1d130101

    ff040830 060101ff 02010030 70060355 1d200469 30673065 060b6086 480186f8

    45010717 03305630 2806082b 06010505 07020116 1c687474 70733a2f 2f777777

    2e766572 69736967 6e2e636f 6d2f6370 73302a06 082b0601 05050702 02301e1a

    1c687474 70733a2f 2f777777 2e766572 69736967 6e2e636f 6d2f7270 61303406

    03551d1f 042d302b 3029a027 a0258623 68747470 3a2f2f63 726c2e76 65726973

    69676e2e 636f6d2f 70636133 2d67352e 63726c30 0e060355 1d0f0101 ff040403

    02010630 6d06082b 06010505 07010c04 61305fa1 5da05b30 59305730 55160969

    6d616765 2f676966 3021301f 30070605 2b0e0302 1a04148f e5d31a86 ac8d8e6b

    c3cf806a d448182c 7b192e30 25162368 7474703a 2f2f6c6f 676f2e76 65726973

    69676e2e 636f6d2f 16de0c28

    6c2527b9 deb78458 c61f381e a4c4cb66


telnet timeout 5

ssh inside

ssh inside

ssh timeout 5

ssh version 2

ssh key-exchange group dh-group1-sha1

console timeout 0

dhcpd auto_config outside


threat-detection basic-threat

threat-detection statistics access-list

no threat-detection statistics tcp-intercept


username admin password  encrypted


class-map inspection_default

match default-inspection-traffic



policy-map type inspect dns preset_dns_map


  message-length maximum client auto

  message-length maximum 512

policy-map global_policy

class inspection_default

  inspect dns preset_dns_map

  inspect ftp

  inspect h323 h225

  inspect h323 ras

  inspect rsh

  inspect rtsp

  inspect esmtp

  inspect sqlnet

  inspect skinny 

  inspect sunrpc

  inspect xdmcp

  inspect sip 

  inspect netbios

  inspect tftp

  inspect ip-options


service-policy global_policy global

prompt hostname context

call-home reporting anonymous


profile CiscoTAC-1

  no active

  destination address http

  destination address email

  destination transport-method http

  subscribe-to-alert-group diagnostic

  subscribe-to-alert-group environment

  subscribe-to-alert-group inventory periodic monthly

  subscribe-to-alert-group configuration periodic monthly

  subscribe-to-alert-group telemetry periodic daily


: end


It seems to me since we are talking about Port Forward / Static PAT configurations that you will have to make several NAT statements.  There are also 2 ways to do the same thing. I tried to choose the way that would be clearer, hopefully

NOTICE: If you plan to have Cisco AnyConnect VPN Client in use at some point you will need to configure another port for it. Its original port is TCP/443, but since we are now configuring port forward using that port, both of them cant be on the same port. Your above configuration doesnt seem to have any VPN configurations so this should not be a problem at the moment

Remove the old NAT Configuration

no nat (inside,outside) after-auto source static Fantomen Fantomen

Create new Port Forward / Static PAT configurations

  • Even though the "object service" have the "source" defined under them, dont care about that. Its defined as "source" because of the NAT configuration only.

object network FANTOMEN


object service TCP-80

service tcp source eq www

object service TCP-443

service tcp source eq https

object service TCP-6001-6002

service tcp source range 6001 6002

object service UDP-6001-6002

service udp source range 6001 6002

object service TCP-6004

service tcp source eq 6004

object service UDP-6004

service udp source eq 6004

nat (inside,outside) source static FANTOMEN interface service TCP-80 TCP-80

nat (inside,outside) source static FANTOMEN interface service TCP-443 TCP-443

nat (inside,outside) source static FANTOMEN interface service TCP-6001-6002 TCP-6001-6002

nat (inside,outside) source static FANTOMEN interface service UDP-6001-6002 UDP-6001-6002

nat (inside,outside) source static FANTOMEN interface service TCP-6004 TCP-6004

nat (inside,outside) source static FANTOMEN interface service UDP-6004 UDP-6004

I think your current ACL should work with this NAT configuration. So no need to change that unless you want to redo some ACL/object names.

Hopefully the above helps you get this working. Let me know how it goes.

- Jouni


Thanks, I have made the configuration now, but will test it live on monday.

I should have VPN, but i think to make that another port, but to use the "WebVPN" you must have 443 to the fw?

Hmm, It's a lot of NAT rules, is it for security or could it be just one NAT to allow "any" to the server?


Actually I should have confirmed this at the very start already.

  • Have you been assigned with the whole x.x.x.x network?

If so that would mean you would have spare public IP addresses and we wouldnt have to use Port Forward configurations at all. This would make the configuration significantly simpler.

If you do have unused public IP addresses then you could simply configure Static NAT for your server

object network FANTOMEN


nat (inside,outside) static dns

And again the ACL you have at the moment should do the trick.

Regarding the VPN. I think you will have to change some services default ports IF you only have the ASAs "outside" interface public IP address at your disposal. If on the other hand you actually have spare IP addresses at your disposal then there will be absolutely no problems with the ports.

- Jouni


But is all ports open to the server then? Because i still want the firewall for the server inside.

I think i have 2 IP's free but not the whole subnet.

Well, I will hook it up in a hour or something and see hows it goes.


If you have a spare public IP address you could use it in the above manner. This would essentially pair the local and NAT IP together. The server could then be reached on any port its listening on. Notice that its only reachable with certain port IF you allow it on the "outside" interface ACL. Otherwise the connections naturally arent allowed. (Even though the NAT exists)

The Port Forward / Static PAT configuration should be used in the situation where you simply have no other public IP address to spare other than the "outside" interface IP address of the ASA.

If you have a spare public IP address that is not used at the moment (as it seems you do) its the easiest/simplest solution to this configuration.

Hopefully the information has been helpfull

- Jouni

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers