Understanding And Troubleshooting ASA NAT

Transcription

Cisco Support CommunityExpert Series Webcasts inRussian:Understanding andTroubleshooting ASA NATCreated by Oleg Tipisov, Cisco TAC.Version 1.1. Cisco Public

Cisco Support Community –Expert Series Webcasts in RussianСегодня на семинаре эксперт Cisco TACExpert’s photoОлег ТиписовCCIE in Routing and SwitchingCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public2

Спасибо, что посетили наш семинарсегодняСегодняшняя презентация включает опросы аудиторииПожалуйста, участвуйте!Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public3

Спасибо, что посетили наш семинарсегодняЕсли Вы хотите получить копию слайдов сегодняшнегосеминара, пожалуйста, используйте следующие nity/russian/securityили, o Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public4

Опрос #1Каков уровень ваших знаний о ASA NAT?1. Я представляю, что такое NAT, но не работал сним2. Мне приходилось настраивать NAT на ASA спомощью графического интерфейса ASDM3. Я владею настройкой NAT из CLI и ASDM иприменяю эту технологию в своей сети4. Я неоднократно настраивал различные вариантыNAT на ASA во многих версиях ПОCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public5

Задавайте Ваши вопросы!Используйте Q&A панель, чтобы послать вопрос. Нашиэксперты ответят на нихCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public6

Understanding andTroubleshooting ASA NATCreated by Oleg Tipisov, Cisco TAC.Version 1.1. Cisco PublicCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public7

Introduction This session is mostly about ASA 8.3 NAT ASA 8.2 configuration example is given, but slides arehidden to save time Two real-world troubleshooting scenarios are given Students are expected to understand ASA NAT CLI We will not discuss: 8.2 - 8.3 Configuration migration NAT and Routing integration NAT RPF Check and associated issues Separate presentation is needed for each of the aboveCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public8

Agenda Introduction NAT Terminology ASA 8.2 Configuration Example ASA 8.3 Configuration Example Troubleshooting Scenario #1 Troubleshooting Scenario #2 Final RecommendationsCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public9

IntroductionCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public10

ASA Features Stateful packet filter Security policy is based on “interface security levels” Application inspection NAT/PAT, NAT ALG Static & Dynamic IPv4 & IPv6 routing Integration with IPS, CSC and CX modules L2L & RA VPN (IPSec IKEv1, IPSec IKEv2, SSL) Redundancy features and failoverCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public11

ASA Features Virtualization (multiple context mode) Transparent mode NetFlow v9 for security monitoring Botnet traffic filtering (Ironport integration) Identity firewall ASA Phone Proxy and other UC integration featuresCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public12

Latest Releases 8.4 – 5505, 5510-5550, 5580, 5585-X 8.4(4) is the latest version 8.5 – ASA SM 8.4(1) with few other features 8.6 – 5500-X 8.4(2) with few other features 8.7 – ASA 1000V ASA in a Nexus 1000V switch 9.0 – To be released soonCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public13

NAT TerminologyCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public14

NAT Terminology Real Address vs. Mapped Address Connection vs. xlate Source Translation vs. Destination Translation (UN-NAT) Bidirectional NAT Dynamic NAT vs. Static NAT NAT vs. PAT Identity NAT NAT exemption or “NAT 0 ACL” (8.2- only) Policy NATCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public15

ASA 8.2 Configuration ExampleCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public16

Security Policy ExampleInternet traffic blockedinbound to corporatenetworkASACorporate NetworkinsideInternetoutsidedmzCorporate network allowedto access DMZ networkand the InternetCisco Support CommunityInternet allowed inboundaccess to DMZDMZ network 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public17

ASA Interface Configurationinterface GigabitEthernet0/0.1vlan 99nameif insidesecurity-level 100ip address 10.1.1.1 255.255.255.0interface GigabitEthernet0/0.2vlan 98nameif dmzsecurity-level 50ip address 172.16.1.1 255.255.255.0interface GigabitEthernet0/1nameif outsidesecurity-level 0ip address 194.1.1.1 255.255.255.0route outside 0.0.0.0 0.0.0.0 194.1.1.2 1Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public18

ASA NAT and ACL Configuration – 8.2?no nat-control! Dynamic PAT to “outside” interface IPglobal (outside) 1 interfacenat (inside) 1 10.1.1.0 ! Static PATstatic (dmz,outside) 194.1.1.254 172.16.1.2 netmask 255.255.255.255! No NAT between “inside” and “dmz” interfacesaccess-list nonat extended permit ip 10.1.1.0 255.255.255.0 172.16.1.0255.255.255.0nat (inside) 0 access-list nonat! Allow HTTP to DMZ serveraccess-list outside in extended permit tcp any host 194.1.1.254 eq wwwaccess-group outside in in interface outside“host 194.1.1.254 eq www”public IP in this release!Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public19

ASA Dynamic NAT – 8.2%ASA-6-305011: Built dynamic TCP translation from inside:10.1.1.2/64253 tooutside:194.1.1.1/33627%ASA-6-302013: Built outbound TCP connection 0 for outside:207.1.1.2/80(207.1.1.2/80) to inside:10.1.1.2/64253 (194.1.1.1/33627)ASA# show conn longTCP outside:207.1.1.2/80 (207.1.1.2/80) inside:10.1.1.2/64253(194.1.1.1/33627), flags U, idle 30s, uptime 30s, timeout 1h0m, bytes 0ASA# show xlate debug2 in use, 2 most usedFlags: D - DNS, d - dump, I - identity, i - dynamic, n - no random,r - portmap, s - staticTCP PAT from inside:10.1.1.2/64253 to outside:194.1.1.1/33627 flags ri idle0:00:36 timeout 0:00:30Source port is always changed as of -9233Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public20

ASA Static NAT – 8.2%ASA-6-302013: Built inbound TCP connection 1 for outside:207.1.1.2/63715(207.1.1.2/63715) to dmz:172.16.1.2/80 (194.1.1.254/80)ASA# show conn longTCP outside:207.1.1.2/63715 (207.1.1.2/63715) dmz:172.16.1.2/80(194.1.1.254/80), flags UB, idle 26s, uptime 26s, timeout 1h0m, bytes 0ASA# show xlate debug1 in use, 2 most usedFlags: D - DNS, d - dump, I - identity, i - dynamic, n - no random,r - portmap, s - staticNAT from dmz:172.16.1.2 to outside:194.1.1.254 flags s idle 0:08:00 timeout0:00:00ASA# show access-listaccess-list outside in line 1 extended permit tcp any host 194.1.1.254 eq www(hitcnt 1) 0x24e3fc02public IPnumber of connections,not packets!Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public21

NAT Rules Order – 8.2?no nat-control! Dynamic PAT to “outside” interface IPglobal (outside) 1 interfacenat (inside) 1 10.1.1.0 ! Static PATstatic (dmz,outside) 194.1.1.254 172.16.1.2 netmask 255.255.255.255! No NAT between “inside” and “dmz” interfacesaccess-list nonat extended permit ip 10.1.1.0 255.255.255.0 172.16.1.0255.255.255.0nat (inside) 0 access-list nonat! Allow HTTP to DMZ serveraccess-list outside in extended permit tcp any host 194.1.1.254 eq wwwaccess-group outside in in interface outside“host 194.1.1.254 eq www”public IP in this release!Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public22

NAT Rules Order – 8.21. NAT Exemption (NAT 0 ACL)2. Static NAT, Static PAT, Static Policy NAT/PAT in order, until the first match FWSM uses longest match for static NAT3. Dynamic Policy NAT/PAT in order, until the first match4. Regular Dynamic NAT/PAT longest match identity NAT doesn’t have priorityCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public23

NAT Pitfalls – 8.2 “no nat-control” doesn’t help much Policy NAT ACL doesn’t support “deny” statements NAT exemption ACL doesn’t support TCP/UDP ports Bidirectional NAT is difficult to configure Flexibility is limited 64K xlates per PAT IP port ranges cannot be configured (0-511, 512-1023, 1024-65535) no support for “timeout pat-xlate”Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public24

ASA 8.3 Configuration ExampleCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public25

NAT in 8.3 Completely new implementation “NAT simplification” Object NAT (Auto NAT) Twice NAT (Manual NAT) Bidirectional NAT is very easy to configure Flexibility is higher, new features are beingimplementedCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public26

Security Policy ExampleInternet traffic blockedinbound to corporatenetworkASACorporate NetworkinsideInternetoutsidedmzCorporate network allowedto access DMZ networkand the InternetCisco Support CommunityInternet allowed inboundaccess to DMZDMZ network 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public27

Configuration Migration (8.2 – 8.3)INFO: MIGRATION - Saving the startup configuration to fileINFO: MIGRATION - Startup configuration saved to file'flash:8 2 1 0 startup cfg.sav'*** Output from config line 4, "ASA Version 8.2(1) ".Cryptochecksum (unchanged): 66abf6f4 1b22b1c8 2f06d057 62b2e46aNAT migration logs:The following 'nat' command didn't have a matching 'global' rule on interface'dmz' and was not migrated.nat (inside) 1 10.1.1.0 255.255.255.0INFO: NAT migration completed.Real IP migration logs:ACL outside in has been migrated to real-ip versionINFO: MIGRATION - Saving the startup errors to file'flash:upgrade startup errors 200503292016.log'See this article about 8.2 - 8.3 software upgrade and configuration -12690Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public28

ASA Interface Configurationinterface GigabitEthernet0/0.1vlan 99nameif insidesecurity-level 100ip address 10.1.1.1 255.255.255.0interface GigabitEthernet0/0.2vlan 98nameif dmzsecurity-level 50ip address 172.16.1.1 255.255.255.0interface GigabitEthernet0/1nameif outsidesecurity-level 0ip address 194.1.1.1 255.255.255.0route outside 0.0.0.0 0.0.0.0 194.1.1.2 1Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public29

ASA Object NAT – 8.3 object network obj-10.1.1.0subnet 10.1.1.0 255.255.255.0object network obj-172.16.1.2host 172.16.1.210.1.1.0/24194.1.1.254.2object network obj-10.1.1.0nat (inside,outside) dynamic interface172.16.1.0/24object network obj-172.16.1.2nat (dmz,outside) static 194.1.1.254access-list outside in extended permit tcp any host 172.16.1.2 eq wwwaccess-group outside in in interface outside“host 172.16.1.2 eq www”real IP in this release!Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public30

ASA Twice NAT – 8.3 object network obj-10.1.1.0subnet 10.1.1.0 255.255.255.0nat (inside,outside) source dynamic obj-10.1.1.0 interface10.1.1.0/24194.1.1.254.2object network obj-172.16.1.2host 172.16.1.2172.16.1.0/24object network obj-194.1.1.254host 194.1.1.254nat (dmz,outside) source static obj-172.16.1.2 obj-194.1.1.254access-list outside in extended permit tcp any host 172.16.1.2 eq wwwaccess-group outside in in interface outside“host 172.16.1.2 eq www”real IP in this release!Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public31

ASA Dynamic NAT – 8.3 %ASA-6-305011: Built dynamic TCP translation from inside:10.1.1.2/57126 tooutside:194.1.1.1/57126%ASA-6-302013: Built outbound TCP connection 3 for outside:207.1.1.2/80(207.1.1.2/80) to inside:10.1.1.2/57126 (194.1.1.1/57126)ASA# show conn longTCP outside:207.1.1.2/80 (207.1.1.2/80) inside:10.1.1.2/57126(194.1.1.1/57126), flags U, idle 12s, uptime 12s, timeout 1h0m, bytes 0ASA# show xlate2 in use, 3 most usedFlags: D - DNS, i - dynamic, r - portmap, s - static, I - identity, T - twicee - extendedTCP PAT from inside:10.1.1.2/57126 to outside:194.1.1.1/57126 flags ri idle0:00:23 timeout 0:00:30Newest software tries to preserve source port if possibleCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public32

ASA Static NAT – 8.3 %ASA-6-302013: Built inbound TCP connection 4 for outside:207.1.1.2/41506(207.1.1.2/41506) to dmz:172.16.1.2/80 (194.1.1.254/80)ASA# show conn longTCP outside:207.1.1.2/41506 (207.1.1.2/41506) dmz:172.16.1.2/80(194.1.1.254/80), flags UB, idle 41s, uptime 43s, timeout 1h0m, bytes 0ASA# show xlate1 in use, 3 most usedFlags: D - DNS, i - dynamic, r - portmap, s - static, I - identity, T - twicee - extendedNAT from dmz:172.16.1.2 to outside:194.1.1.254flags s idle 0:00:47 timeout 0:00:00ASA# show access-listaccess-list outside in line 1 extended permit tcp any host 172.16.1.2 eq www(hitcnt 1) 0xdae674c0public IPnumber of connections,not packets!Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public33

NAT Rules Order (8.3 )1. Section 1: Twice NAT default place for twice NAT rules in order, until the first match2. Section 2: Object NAT static NAT (longest match) dynamic NAT (longest match)3. Section 3: Twice NAT “after-auto” needs to be specified in “nat” command in order, until the first matchCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public34

Опрос #2Сталкивались ли Вы с проблемами прииспользовании NAT на ASA1. Нет, никогда. Все отлично работает2. Иногда бывало, но это были ошибки настройки3. Проблемы встречались, но они легко решалисьпереходом на новую версию4. Проблемы возникали и их могли решить толькоинженеры Cisco TAC5. Сплошные проблемы, не знаю, что делать6. Я не использую NAT на ASA, потому что он неработаетCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public35

Troubleshooting Scenario #1Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public36

Security Policy ExampleRemote OfficeASAInternetinsideoutsidedmz10.2.2.0/24to 194.1.1.254172.16.1.2IPSec tunnelServer 172.16.1.2 should be accessible from bothInternet and Remote Office by 194.1.1.254.Other DMZ servers should be accessible via VPNwithout NAT.172.16.1.0/24VPN is terminated on some other device, such asperimeter router.DMZ servers should be able to talk to InternetDNS servers.Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public37

ASA Interface Configurationinterface GigabitEthernet0/0.1vlan 99nameif insidesecurity-level 100ip address 10.1.1.1 255.255.255.0interface GigabitEthernet0/0.2vlan 98nameif dmzsecurity-level 50ip address 172.16.1.1 255.255.255.0interface GigabitEthernet0/1nameif outsidesecurity-level 0ip address 194.1.1.1 255.255.255.0route outside 0.0.0.0 0.0.0.0 194.1.1.2 1Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public38

ASA NAT Configuration – 8.3 object network obj-172.16.1.0subnet 172.16.1.0 255.255.255.0to 194.1.1.25410.2.2.0/24object network obj-172.16.1.2host 172.16.1.2object network obj-194.1.1.254host 194.1.1.254172.16.1.2object network RemoteOfficeNetsubnet 10.2.2.0 255.255.255.0172.16.1.0/24object network RemoteOfficeNet-2subnet 10.2.2.0 255.255.255.0nat (dmz,outside) source static obj-172.16.1.2 obj-194.1.1.254nat (dmz,outside) source static obj-172.16.1.0 obj-172.16.1.0 destinationstatic RemoteOfficeNet RemoteOfficeNet-2nat (dmz,outside) source dynamic obj-172.16.1.0 interfaceCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public39

Customer Symptomto 194.1.1.25410.2.2.0/24172.16.1.2Everything works, but 172.16.1.2 gets wrong IPwhen goes to the Internet 172.16.1.0/24ASA# show conn longTCP outside:207.1.1.2/80 (207.1.1.2/80) dmz:172.16.1.2/37116(194.1.1.1/23384), flags U, idle 9s, uptime 9s, timeout 1h0m, bytes 0At the same time inbound connections to 194.1.1.254work as expected TCP outside:207.1.1.2/16123 (207.1.1.2/16123) dmz:172.16.1.2/80(194.1.1.254/80), flags UB, idle 12s, uptime 12s, timeout 1h0m, bytes 0Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public40

Troubleshooting – Step #1ASA# show run objectobject network obj-172.16.1.0subnet 172.16.1.0 255.255.255.0object network obj-172.16.1.2host 172.16.1.2object network obj-194.1.1.254host 194.1.1.254object network RemoteOfficeNetsubnet 10.2.2.0 255.255.255.0object network RemoteOfficeNet-2subnet 10.2.2.0 255.255.255.0to 194.1.1.25410.2.2.0/24172.16.1.2172.16.1.0/24ASA# show run natnat (dmz,outside) source static obj-172.16.1.2 obj-194.1.1.254nat (dmz,outside) source static obj-172.16.1.0 obj-172.16.1.0 destinationstatic RemoteOfficeNet RemoteOfficeNet-2nat (dmz,outside) source dynamic obj-172.16.1.0 interfaceCisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public41

Troubleshooting – Step #2%ASA-6-305011: Built dynamic TCPtranslation from dmz:172.16.1.2/37116to outside:194.1.1.1/23384to 194.1.1.254%ASA-6-302013: Built outbound TCP connection 54for outside:207.1.1.2/80 (207.1.1.2/80)to dmz:172.16.1.2/37116 4ASA# show conn longTCP outside:207.1.1.2/80 (207.1.1.2/80) dmz:172.16.1.2/37116(194.1.1.1/23384), flags U, idle 9s, uptime 9s, timeout 1h0m, bytes 0ASA# show xlate local 172.16.1.2 global 194.1.1.14 in use, 4 most usedFlags: D - DNS, i - dynamic, r - portmap, s - static, I - identity, T - twiceTCP PAT from dmz:172.16.1.2/37116 to outside:194.1.1.1/23384 flags ri idle0:02:03 timeout 0:00:30Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Public42

Troubleshooting – Step #3Hmm This is strange. It seems that dynamic PAT(rule #3) takes precedence over static NAT (rule #1)to 194.1.1.25410.2.2.0/24ASA# debug nat 255nat: policy lock 0x73a1cb40, old count is 1nat: translation - dmz:172.16.1.2/37116to outside:194.1.1.1/23384172.16.1.2172.16.1.0/24ASA# show nat detailManual NAT Policies (Section 1)1 (dmz) to (outside) source static obj-172.16.1.2 obj-194.1.1.254translate hits 0, untranslate hits 0Source - Origin: 172.16.1.2/32, Translated: 194.1.1.254/322 (dmz) to (outside) source static obj-172.16.1.0 obj-172.16.1.0static RemoteOfficeNet RemoteOfficeNet-2translate hits 0, untranslate hits 0Source - Origin: 172.16.1.0/24, Translated: 172.16.1.0/24Destination - Origin: 10.2.2.0/24, Translated: 10.2.2.0/243 (dmz) to (outside) source dynamic obj-172.16.1.0 interfacetranslate hits 1, untranslate hits 0Source - Origin: 172.16.1.0/24, Translated: 194.1.1.1/24Cisco Support Community 2010 Cisco and/or its affiliates. All rights reserved.Cisco Publicdestination43

Troubleshooting – Step #4ASA# packet-tracer input dmz tcp 172.16.1.2 1234 207.1.1.2 80Phase: 1Type: ROUTE-LOOKUPSubtype: inputResult: ALLOWConfig:Additional Information:in0.0.0.00.0.0.0to 24Phase: 2Type: IP-OPTIONSSubtype:Result: ALLOWConfig:Additional Information:Phase: 3This again confirms that traffic is processed byType: NATdynamic PAT rule, instead of static NAT rule Subtype:Result: ALLOWConfig:nat (dmz,outside) source dy

This session is mostly about ASA 8.3 NAT ASA 8.2 configuration example is given, but slides are hidden to save time Two real-world troubleshooting scenarios are given Students are expected to understand ASA NAT CLI We will not discuss: 8