Cisco ASA Dynamic NAT Configuration

This topic is to discuss the following lesson:

Hello,

I do not understand the difference of the object nat and the regular nat, can you explain that to me?

Hi Alejandro,

Object groups are used to group things like IP addresses, ports, etc together. This simplifies the configuration.

Take a look at this post:

https://networklessons.com/security/cisco-asa-object-group-access-list/

Rene

Rene

I was not able to ping between interfaces after adding the policy map on a ASA 5505

1    inside                           up        Et0/0, Et0/3, Et0/4, Et0/5
Et0/6, Et0/7
2    outside                          up        Et0/1
3    DMZ                              up        Et0/2

------------------

class-map inspection_default
match default-inspection-traffic
!
!
policy-map type inspect dns preset_dns_map
parameters
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
inspect icmp
!
service-policy global_policy global

 

 

Hi Donald,

Try the “packet-tracer” command from the CLI, it will show you why it is dropping the packet.

Rene

Hi Rene,
What is the difference or when do you use one or the other? on this example I am using PAT with a dynamic ip address on the outside interface.

nat (INSIDE,OUTSIDE) dynamic interface

or

nat (INSIDE,OUTSIDE) after-auto 1 source dynamic any interface.

Please advise

Hi Alfredo,

The ASA (since 8.3) has different NAT “sections”:

  • 1:Manual
  • 2: Auto
  • 3: "after auto" Manual
  • The ASA will first process NAT rules in section 1, then 2 and finally 3.

    Here’s an example of manual NAT:

ASA(config)# object network INTERNAL_SERVER
ASA(config-network-object)# host 192.168.1.1

ASA(config)# object network PUBLIC_IP
ASA(config-network-object)# host 1.1.1.1

ASA(config)# nat (INSIDE,OUTSIDE) source static INTERNAL_SERVER PUBLIC_IP

The NAT rule has been configured globally, this section 1 rule is preferred over 2 and 3.

Here’s an example for Auto NAT:

ASA(config)# object network LAN
ASA(config-network-object)# subnet 192.168.1.0 255.255.255.0
ASA(config-network-object)# nat (INSIDE,OUTSIDE) static PUBLIC_IP

Above we configured NAT in the network object, this is a section 2 rule.

Last but not least, we have your rule:

ASA(config)# nat (INSIDE,OUTSIDE) after-auto 1 source dynamic any interface

This section 3 rule will be processed after 1 and 2.

The rule above is a general rule to translate all source addresses on the inside to the IP address of your outside interface. It might be a good idea to process this NAT rule last since it allows you to put more specific NAT rules in section 1 or 2.

Both options will get you the same result (if you don’t have any other NAT rules). The first one is processed in section 2, the other one in section 3.

Hope this helps.

Rene

Hi Rene,

Would Like to ask, its not exactly related to above mentioned scenario but similar question:

object_pool my_pool
range 192.168.30.100 192.168.30.200 
object-group LAN
network-object 192.168.10.0 255.255.255.0
network-object 192.168.20.0 255.255.255.0

nat(inside,outside) dynamic my_pool interface

Am I right in saying the above command dictates - Traffic from object-group LAN( belong to either of the subnet 10 OR 20) flowing from inside to outside will be dynamically NAT to one of the IP in MY_POOL. And once IP`s in the pool is entirely mapped then NAT to outside interface.

Hi Asi,

Of top of my head, here’s what you should use:

ASA1(config)# object network PUBLIC_POOL
ASA1(config-network-object)# range 192.168.30.100 192.168.30.200

ASA1(config)# object network VLAN10
ASA1(config-network-object)# subnet 192.168.10.0 255.255.255.0

ASA1(config)# object network VLAN20            
ASA1(config-network-object)# subnet 192.168.20.0 255.255.255.0

ASA1(config)# object-group network MY_LAN
ASA1(config-network-object-group)# network object VLAN10
ASA1(config-network-object-group)# network object VLAN20

ASA1(config)# nat (INSIDE,OUTSIDE) source dynamic MY_LAN PUBLIC_POOL interface 

This will translate IP addresses in the 192.168.10.0/24 and 192.168.20.0/24 subnet to the addresses in PUBLIC_POOL. When there are no IP addresses left in the pool, we use the IP address on the interface.

Rene

1 Like

Hi Rene
Can you talk about service nat ?
Thanks

Hi Rene

What is the difference between
ASA(config)# nat (INSIDE,OUTSIDE) after-auto 1 source dynamic any interface

and

ASA1(config)# object network INTERNAL
ASA1(config-network-object)# nat (INSIDE,OUTSIDE) dynamic PUBLIC_POOL interface

Thanks

Hi Sims,

The ASA has different sections for NAT. Take a look here:

Rene

nat (INSIDE,OUTSIDE) dynamic PUBLIC_POOL

its giving me error invalid input detected at Marker inside

The marker will tell you where the error is.

On router sides , I am configuring interfaces with ipnet inside on R1 and ipnat ouside on R2 with ip addresses provided . Is there anything else we config on routers?

Hi Shraddha,

In this example, there’s nothing you need to configure on the routers. We are only using these as (dumb) host devices.

If you want to know how to configure dynamic NAT on a Cisco IOS router, you can take a look here:

How to configure dynamic NAT on Cisco IOS router

Rene

Rene

I was having an issue the other day not being able to route out of my ASA 5516, Scenario is as follows.The Outside interface on the ASA has the /30 configured the Inside interface has the /27 and we have a static default route for all traffic to be sent to the outside interface router ex:outside 0.0.0.0 0.0.0.0 24.43.182.19; I was able to ping out of the ASA because it was sourcing the ping from the wan IP (outside ip) When I configured my laptop with a static ip from one of the LAN ips i wasnt not able to ping out nor browse to a website. After a few hours of troubleshooting we added an extended access-list allow any traffic to my inside LAN subnet and I was able to route out. ex(access-list outin extended permit ip any 69.75.199.0 255.255.255.224)

I was wondering if you can shed some light on this issue, I was under the impression that it would work with only a default route and going for a higher security zone to a lower one (inside, outside) Any explanation would be greatly appreciated.

9Hi Jaun

Had a answer thought of answering you

Networking base line is send from the source and receive back from destination

When you do PING from inside(LAN) the echo request packet from inside interface (higher security level 100) goes to the outside(lower security level 0) and later when the echo reply back to outside interface(lower security level)going to inside interface ASA does not allow this.

Traffic from lower security level interface to higher not allowed by default (use access list or add protocol to inspection engine)
Traffic from higher security level to lower allowed by default (without any access-list)

Hi

Can someone help cant figure out why my internal ip address wont get nat’ed

R1 IOS 
!
hostname Router
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
ethernet lmi ce
!
!
!
mmi polling-interval 60
no mmi auto-configure
no mmi pvc
mmi snmp-timeout 180
!
!
!
!
!
!
!
!
!
!
!
ip cef
no ipv6 cef
!
multilink bundle-name authenticated
!
!
!
!
!
redundancy
!
!
! 
!
!
!
!
!
!
!
!
!
!
!
!
interface GigabitEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
 media-type rj45
!
interface GigabitEthernet0/1
 ip address 192.168.1.1 255.255.255.0
 duplex auto
 speed auto
 media-type rj45
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
!
!
!
control-plane
!
banner exec ^C
**************************************************************************
* IOSv is strictly limited to use for evaluation, demonstration and IOS  *
* education. IOSv is provided as-is and is not supported by Cisco's      *
* Technical Advisory Center. Any use or disclosure, in whole or in part, *
* of the IOSv Software or Documentation to any third party for any       *
* purposes is expressly prohibited except as otherwise authorized by     *
* Cisco in writing.                                                      *
**************************************************************************^C
banner incoming ^C
**************************************************************************
* IOSv is strictly limited to use for evaluation, demonstration and IOS  *
* education. IOSv is provided as-is and is not supported by Cisco's      *
* Technical Advisory Center. Any use or disclosure, in whole or in part, *
* of the IOSv Software or Documentation to any third party for any       *
* purposes is expressly prohibited except as otherwise authorized by     *
* Cisco in writing.                                                      *
**************************************************************************^C
banner login ^C
**************************************************************************
* IOSv is strictly limited to use for evaluation, demonstration and IOS  *
* education. IOSv is provided as-is and is not supported by Cisco's      *
* Technical Advisory Center. Any use or disclosure, in whole or in part, *
* of the IOSv Software or Documentation to any third party for any       *
* purposes is expressly prohibited except as otherwise authorized by     *
* Cisco in writing.                                                      *
**************************************************************************^C
!
line con 0
line aux 0
line vty 0 4
 login
 transport input none
!
no scheduler allocate
!
end

-

R2 
Building configuration...

Current configuration : 2741 bytes
!
! Last configuration change at 10:21:34 UTC Wed Mar 1 2017
!
version 15.6
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname Router
!
boot-start-marker
boot-end-marker
!
!
!
no aaa new-model
ethernet lmi ce
!
!
!
mmi polling-interval 60
no mmi auto-configure
no mmi pvc
mmi snmp-timeout 180
!
!
!
!
!
!
!
!
!
!
!
ip cef
no ipv6 cef
!
multilink bundle-name authenticated
!
!
!
!
!
redundancy
!
!
! 
!
!
!
!
!
!
!
!
!
!
!
!
interface GigabitEthernet0/0
 no ip address
 shutdown
 duplex auto
 speed auto
 media-type rj45
!
interface GigabitEthernet0/1
 ip address 192.168.2.2 255.255.255.0
 duplex auto
 speed auto
 media-type rj45
!
ip forward-protocol nd
!
!
no ip http server
no ip http secure-server
!
!
!
!
control-plane
!
banner exec ^C
**************************************************************************
* IOSv is strictly limited to use for evaluation, demonstration and IOS  *
* education. IOSv is provided as-is and is not supported by Cisco's      *
* Technical Advisory Center. Any use or disclosure, in whole or in part, *
* of the IOSv Software or Documentation to any third party for any       *
* purposes is expressly prohibited except as otherwise authorized by     *
* Cisco in writing.                                                      *
**************************************************************************^C
banner incoming ^C
**************************************************************************
* IOSv is strictly limited to use for evaluation, demonstration and IOS  *
* education. IOSv is provided as-is and is not supported by Cisco's      *
* Technical Advisory Center. Any use or disclosure, in whole or in part, *
* of the IOSv Software or Documentation to any third party for any       *
* purposes is expressly prohibited except as otherwise authorized by     *
* Cisco in writing.                                                      *
**************************************************************************^C
banner login ^C
**************************************************************************
* IOSv is strictly limited to use for evaluation, demonstration and IOS  *
* education. IOSv is provided as-is and is not supported by Cisco's      *
* Technical Advisory Center. Any use or disclosure, in whole or in part, *
* of the IOSv Software or Documentation to any third party for any       *
* purposes is expressly prohibited except as otherwise authorized by     *
* Cisco in writing.                                                      *
**************************************************************************^C
!
line con 0
line aux 0
line vty 0 4
 login
 transport input none
!
no scheduler allocate
!
end

-

ASA 

: 
: Serial Number: 9AQC5RW23DD
: Hardware:   ASAv, 2048 MB RAM, CPU Pentium II 3504 MHz
:
ASA Version 9.5(2)204 
!
hostname ciscoasa
enable password 8Ry2YjIyt7RRXU24 encrypted
xlate per-session deny tcp any4 any4
xlate per-session deny tcp any4 any6
xlate per-session deny tcp any6 any4
xlate per-session deny tcp any6 any6
xlate per-session deny udp any4 any4 eq domain
xlate per-session deny udp any4 any6 eq domain
xlate per-session deny udp any6 any4 eq domain
xlate per-session deny udp any6 any6 eq domain
names
!
interface GigabitEthernet0/0
 nameif INSIDE
 security-level 100
 ip address 192.168.1.254 255.255.255.0 
!
interface GigabitEthernet0/1
 nameif OUTSIDE
 security-level 0
 ip address 192.168.2.254 255.255.255.0 
!
interface Management0/0
 shutdown
 no nameif
 no security-level
 no ip address
!
ftp mode passive
object network PUBLIC_POOL
 range 192.168.2.100 192.168.2.200
object network INTERNAL
 range 192.168.1.0 255.255.255.0
pager lines 23
mtu INSIDE 1500
mtu OUTSIDE 1500
no failover
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
no arp permit-nonconnected
!
object network INTERNAL
 nat (INSIDE,OUTSIDE) dynamic PUBLIC_POOL
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 sctp 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
user-identity default-domain LOCAL
no snmp-server location
no snmp-server contact
crypto ipsec security-association pmtu-aging infinite
crypto ca trustpoint _SmartCallHome_ServerCA
 no validation-usage
 crl configure
crypto ca trustpool policy
 auto-import
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 76736c6f 676f2e67 69663028 0603551d 11042130 1fa41d30 
    1b311930 17060355 04031310 56657269 5369676e 4d504b49 2d322d36 301d0603 
    551d0e04 1604140d 445c1653 44c1827e 1d20ab25 f40163d8 be79a530 1f060355 
    1d230418 30168014 7fd365a7 c2ddecbb f03009f3 4339fa02 af333133 300d0609 
    2a864886 f70d0101 05050003 82010100 0c8324ef ddc30cd9 589cfe36 b6eb8a80 
    4bd1a3f7 9df3cc53 ef829ea3 a1e697c1 589d756c e01d1b4c fad1c12d 05c0ea6e 
    b2227055 d9203340 3307c265 83fa8f43 379bea0e 9a6c70ee f69c803b d937f47a 
    6decd018 7d494aca 99c71928 a2bed877 24f78526 866d8705 404167d1 273aeddc 
    481d22cd 0b0b8bbc f4b17bfd b499a8e9 762ae11a 2d876e74 d388dd1e 22c6df16 
    b62b8214 0a945cf2 50ecafce ff62370d ad65d306 4153ed02 14c8b558 28a1ace0 
    5becb37f 954afb03 c8ad26db e6667812 4ad99f42 fbe198e6 42839b8f 8f6724e8 
    6119b5dd cdb50b26 058ec36e c4c875b8 46cfe218 065ea9ae a8819a47 16de0c28 
    6c2527b9 deb78458 c61f381e a4c4cb66
  quit
telnet timeout 5
ssh stricthostkeycheck
ssh timeout 5
ssh key-exchange group dh-group1-sha1
console timeout 0
threat-detection basic-threat
threat-detection statistics access-list
no threat-detection statistics tcp-intercept
dynamic-access-policy-record DfltAccessPolicy
!
class-map inspection_default
 match default-inspection-traffic
!
!
policy-map type inspect dns migrated_dns_map_1
 parameters
  message-length maximum client auto
  message-length maximum 512
policy-map global_policy
 class inspection_default
  inspect dns migrated_dns_map_1 
  inspect ftp 
  inspect h323 h225 
  inspect h323 ras 
  inspect ip-options 
  inspect netbios 
  inspect rsh 
  inspect rtsp 
  inspect skinny  
  inspect esmtp 
  inspect sqlnet 
  inspect sunrpc 
  inspect tftp 
  inspect sip  
  inspect xdmcp 
!
service-policy global_policy global
prompt hostname context 
call-home reporting anonymous prompt 2
call-home
 profile License
  destination address http https://tools.cisco.com/its/service/oddce/services/DDCEService
  destination transport-method http
 profile CiscoTAC-1
  no active
  destination address http https://tools.cisco.com/its/service/oddce/services/DDCEService
  destination address email callhome@cisco.com
  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
Cryptochecksum:37800462eea240bb1047046b615be618
: end

I think i followed the lesson correctly but it just wont work

Thanks

Simon

Hi Simon,

Your ASA config seems to look ok, I don’t see any default route on R1 though…it won’t know how to get to 192.168.2.0/24.

Rene