Sunday, June 3, 2018

Configuring Inter-VLAN Routing on a Cisco ASA Firewall

There's a nice Cisco link for ASA firewall best practices. The routing on a Cisco ASA firewall behaves differently compared to router. For inter-VLAN routing to work on an ASA, you'll need a Static Identity NAT between security zones or VLANs. In my lab, I've got two VLANs: Corporate and DMZ on the same security level and are trunked from SW1 to ASA1 G0/1 (inside) interface


CORP PC

H:\>ipconfig

Windows IP Configuration

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 192.168.10.50
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.10.254

H:\>ping 192.168.10.254     // PING ASA GATEWAY

Pinging 192.168.10.254 with 32 bytes of data:
Reply from 192.168.10.254: bytes=32 time<1ms TTL=255
Reply from 192.168.10.254: bytes=32 time<1ms TTL=255
Reply from 192.168.10.254: bytes=32 time<1ms TTL=255
Reply from 192.168.10.254: bytes=32 time<1ms TTL=255

Ping statistics for 192.168.10.254:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms


DMZ SERVER

C:\Windows\System32>ipconfig

Windows IP Configuration

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 192.168.20.100
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.20.254

C:\Windows\System32>ping 192.168.20.254    // PING ASA GATEWAY

Pinging 192.168.20.254 with 32 bytes of data:
Reply from 192.168.20.254: bytes=32 time<1ms TTL=255
Reply from 192.168.20.254: bytes=32 time<1ms TTL=255
Reply from 192.168.20.254: bytes=32 time<1ms TTL=255
Reply from 192.168.20.254: bytes=32 time<1ms TTL=255

Ping statistics for 192.168.20.254:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms


I've configured Static Identity NAT for CORP and DMZ subnets and enabled the same-security-traffic permit inter-interface command for routing on the same security level to work. I was able to ping from Corporate PC to DMZ Server IP and vice-versa.

ciscoasa# configure terminal
ciscoasa(config)# interface GigabitEthernet0/1
ciscoasa(config-if)# description ### To SW01 F0/1 Trunk ###
ciscoasa(config-if)# no shut
ciscoasa(config-if)# interface GigabitEthernet0/1.10
ciscoasa(config-subif)# vlan 10
ciscoasa(config-subif)# nameif CORP
ciscoasa(config-subif)# security-level 100
ciscoasa(config-subif)# ip address 192.168.10.254 255.255.255.0
ciscoasa(config-subif)# interface GigabitEthernet0/1.20
ciscoasa(config-subif)# vlan 20
ciscoasa(config-subif)# nameif DMZ
ciscoasa(config-subif)# security-level 100
ciscoasa(config-subif)# ip address 192.168.20.254 255.255.255.0
ciscoasa(config-subif)# exit
ciscoasa(config)# object network CORP
ciscoasa(config-network-object)# subnet 192.168.10.0 255.255.255 5.0
ciscoasa(config-network-object)# nat (CORP,DMZ) static 192.168.10.0
ciscoasa(config-network-object)# exit
ciscoasa(config)#object network DMZ
ciscoasa(config)#subnet 192.168.20.0 255.255.255.0
ciscoasa(config-network-object)# nat (DMZ,CORP) static 192.168.20.0


H:\>ping 192.168.20.100 

Pinging 192.168.20.100 with 32 bytes of data:
Reply from 192.168.20.100: bytes=32 time=1ms TTL=128
Reply from 192.168.20.100: bytes=32 time=1ms TTL=128
Reply from 192.168.20.100: bytes=32 time=1ms TTL=128
Reply from 192.168.20.100: bytes=32 time=1ms TTL=128

Ping statistics for 192.168.20.100:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 1ms, Average = 1ms


C:\Windows\System32>ping 192.168.10.50

Pinging 192.168.10.50 with 32 bytes of data:
Reply from 192.168.10.50: bytes=32 time=1ms TTL=128
Reply from 192.168.10.50: bytes=32 time=1ms TTL=128
Reply from 192.168.10.50: bytes=32 time=1ms TTL=128
Reply from 192.168.10.50: bytes=32 time=1ms TTL=128

Ping statistics for 192.168.10.50:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 1ms, Average = 1ms


I ran a debug icmp trace on the ASA to monitor pings and configured ICMP inspection under the global_policy.

ciscoasa# debug icmp ?
  trace 

ciscoasa# debug icmp trace ?
  <1-255>  Specify an optional debug level (default is 1)
  <cr>

ciscoasa# debug icmp trace 255
debug icmp trace enabled at level 255

ciscoasa# configure terminal
ciscoasa(config)# same-security-traffic permit inter-interface
ciscoasa(config)# policy-map global_policy
ciscoasa(config-pmap)#  class inspection_default
ciscoasa(config-pmap-c)# inspect icmp

ciscoasa# show nat           

Auto NAT Policies (Section 2)
1 (CORP) to (DMZ) source static CORP 192.168.10.0 
    translate_hits = 0, untranslate_hits = 0
2 (DMZ) to (CORP) source static DMZ 192.168.20.0 
    translate_hits = 0, untranslate_hits = 0

ciscoasa# show xlate
2 in use, 2 most used
Flags: D - DNS, i - dynamic, r - portmap, s - static, I - identity, T - twice
NAT from CORP:192.168.10.0/24 to DMZ:192.168.10.0/24
    flags sI idle 0:01:31 timeout 0:00:00
NAT from DMZ:192.168.20.0/24 to CORP:192.168.20.0/24
    flags sI idle 0:00:57 timeout 0:00:00

ciscoasa(config)# ICMP echo request from CORP:192.168.10.50 to DMZ:192.168.20.100 ID=2 seq=8117 len=32
ICMP echo reply from DMZ:192.168.20.100 to CORP:192.168.10.50 ID=2 seq=8117 len=32
ICMP echo request from CORP:192.168.10.50 to DMZ:192.168.20.100 ID=2 seq=8118 len=32
ICMP echo reply from DMZ:192.168.20.100 to CORP:192.168.10.50 ID=2 seq=8118 len=32
ICMP echo request from DMZ:192.168.20.100 to CORP:192.168.10.50 ID=1 seq=6315 len=32
ICMP echo reply from CORP:192.168.10.50 to DMZ:192.168.20.100 ID=1 seq=6315 len=32
ICMP echo request from CORP:192.168.10.50 to DMZ:192.168.20.100 ID=2 seq=8119 len=32
ICMP echo reply from DMZ:192.168.20.100 to CORP:192.168.10.50 ID=2 seq=8119 len=32
ICMP echo request from CORP:192.168.10.50 to DMZ:192.168.20.100 ID=2 seq=8120 len=32
ICMP echo reply from DMZ:192.168.20.100 to CORP:192.168.10.50 ID=2 seq=8120 len=32

ciscoasa(config-subif)# ICMP echo request from DMZ:192.168.20.100 to CORP:192.168.10.50 ID=1 seq=6348 len=32
ICMP echo reply from CORP:192.168.10.50 to DMZ:192.168.20.100 ID=1 seq=6348 len=32
ICMP echo request from DMZ:192.168.20.100 to CORP:192.168.10.50 ID=1 seq=6349 len=32
ICMP echo reply from CORP:192.168.10.50 to DMZ:192.168.20.100 ID=1 seq=6349 len=32
ICMP echo request from DMZ:192.168.20.100 to CORP:192.168.10.50 ID=1 seq=6350 len=32
ICMP echo reply from CORP:192.168.10.50 to DMZ:192.168.20.100 ID=1 seq=6350 len=32
ICMP echo request from DMZ:192.168.20.100 to CORP:192.168.10.50 ID=1 seq=6351 len=32
ICMP echo reply from CORP:192.168.10.50 to DMZ:192.168.20.100 ID=1 seq=6351 len=32


I've re-configured DMZ to be on a lower security level (50) and can still ping the DMZ Server IP since CORP traffic is sourced from a high security level (100) and is goes toward a lower security level (50) on the DMZ. There's no ACL configured yet on the CORP and DMZ interfaces.


ciscoasa(config)interface GigabitEthernet0/1.20
ciscoasa(config-subif)# security-level 50


H:\>ping 192.168.20.100

Pinging 192.168.20.100 with 32 bytes of data:
Reply from 192.168.20.100: bytes=32 time=1ms TTL=128
Reply from 192.168.20.100: bytes=32 time=1ms TTL=128
Reply from 192.168.20.100: bytes=32 time=1ms TTL=128
Reply from 192.168.20.100: bytes=32 time=1ms TTL=128

Ping statistics for 192.168.20.100:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 1ms, Average = 1ms


By default, the DMZ Server can't ping CORP PC since it's from a lower security level (50) going to a high security level (100).


C:\Windows\System32>ping 192.168.10.50  

Pinging 192.168.10.50 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.10.50:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),


I've allowed ICMP and applied the policy to the DMZ interface and I was able to ping to CORP PC afterwards.

ciscoasa(config)# access-list DMZ-IN extended permit icmp any any echo
ciscoasa(config)# access-list DMZ-IN extended permit icmp any any echo-reply
ciscoasa(config)# access-group DMZ-IN in interface DMZ

ciscoasa(config)# ICMP echo request from DMZ:192.168.20.100 to CORP:192.168.10.50 ID=1 seq=6356 len=32
ICMP echo reply from CORP:192.168.10.50 to DMZ:192.168.20.100 ID=1 seq=6356 len=32
ICMP echo request from DMZ:192.168.20.100 to CORP:192.168.10.50 ID=1 seq=6357 len=32
ICMP echo reply from CORP:192.168.10.50 to DMZ:192.168.20.100 ID=1 seq=6357 len=32
ICMP echo request from DMZ:192.168.20.100 to CORP:192.168.10.50 ID=1 seq=6358 len=32
ICMP echo reply from CORP:192.168.10.50 to DMZ:192.168.20.100 ID=1 seq=6358 len=32
ICMP echo request from DMZ:192.168.20.100 to CORP:192.168.10.50 ID=1 seq=6359 len=32
ICMP echo reply from CORP:192.168.10.50 to DMZ:192.168.20.100 ID=1 seq=6359 len=32


C:\Windows\System32>ping 192.168.10.50

Pinging 192.168.10.50 with 32 bytes of data:
Reply from 192.168.10.50: bytes=32 time=1ms TTL=128
Reply from 192.168.10.50: bytes=32 time=1ms TTL=128
Reply from 192.168.10.50: bytes=32 time=1ms TTL=128
Reply from 192.168.10.50: bytes=32 time=1ms TTL=128

Ping statistics for 192.168.10.50:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 1ms, Average = 1ms


Below is the ASA show run.


ciscoasa# show run
: Saved
:
ASA Version 8.6(1)2
!
hostname ciscoasa
enable password 8Ry2YjIyt7RRXU24 encrypted
passwd 2KFQnbNIdI.2KYOU encrypted
names
!
interface GigabitEthernet0/0
 shutdown
 no nameif
 no security-level
 no ip address
!
interface GigabitEthernet0/1
 description ### To SW01 F0/1 Trunk ###
 no nameif
 no security-level
 no ip address
!
interface GigabitEthernet0/1.10
 vlan 10
 nameif CORP
 security-level 100
 ip address 192.168.10.254 255.255.255.0
!
interface GigabitEthernet0/1.20   
 vlan 20
 nameif DMZ  
 security-level 50
 ip address 192.168.20.254 255.255.255.0         
!
interface GigabitEthernet0/2
 shutdown
 no nameif 
 no security-level    
 no ip address           
!
interface GigabitEthernet0/3
 shutdown       
 no nameif
 no security-level
 no ip address      
!
interface GigabitEthernet0/4
 shutdown        
 no nameif         
 no security-level      
 no ip address          
!           
interface GigabitEthernet0/5 
 shutdown         
 no nameif             
 no security-level        
 no ip address     
!
interface GigabitEthernet0/6       
 shutdown       
 no nameif
 no security-level
 no ip address
!
interface GigabitEthernet0/7
 shutdown
 no nameif
 no security-level
 no ip address
!
interface Management0/0
 shutdown
 no nameif
 no security-level
 no ip address
!
ftp mode passive
same-security-traffic permit inter-interface
object network CORP
 subnet 192.168.10.0 255.255.255.0
object network DMZ
 subnet 192.168.20.0 255.255.255.0
access-list DMZ-IN extended permit icmp any any echo
access-list DMZ-IN extended permit icmp any any echo-reply
access-list DMZ-INextended permit ip any any
pager lines 24
mtu CORP 1500
mtu DMZ 1500
no failover
icmp unreachable rate-limit 1 burst-size 1
no asdm history enable
arp timeout 14400
!
object network CORP
 nat (CORP,DMZ) static 192.168.10.0
object network DMZ
 nat (DMZ,CORP) static 192.168.20.0
access-group DMZ-IN in interface DMZ
timeout xlate 3:00:00
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
user-identity default-domain LOCAL
no snmp-server location
no snmp-server contact
snmp-server enable traps snmp authentication linkup linkdown coldstart warmstart
telnet timeout 5
ssh timeout 5
console timeout 0
threat-detection basic-threat
threat-detection statistics access-list
no threat-detection statistics tcp-intercept
!
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 ip-options
  inspect netbios
  inspect rsh
  inspect rtsp
  inspect skinny 
  inspect esmtp
  inspect sqlnet      
  inspect sunrpc
  inspect tftp
  inspect sip 
  inspect xdmcp
  inspect icmp
!
service-policy global_policy global
prompt hostname context
call-home reporting anonymous prompt 2
call-home
 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 20
  subscribe-to-alert-group configuration periodic monthly 20
  subscribe-to-alert-group telemetry periodic daily
Cryptochecksum:181df8765246de8671ab0e98a05225bb
: end

2 comments: