{"id":736,"date":"2016-12-15T11:17:34","date_gmt":"2016-12-15T03:17:34","guid":{"rendered":"https:\/\/networkingnotesblog.wordpress.com\/?p=736"},"modified":"2016-12-15T11:17:34","modified_gmt":"2016-12-15T03:17:34","slug":"cisco-asa-simple-nat-and-firewall-policy-setup","status":"publish","type":"post","link":"http:\/\/notes4it.com\/?p=736","title":{"rendered":"Cisco ASA &#8211; simple 1 to 1 NAT and firewall policy setup"},"content":{"rendered":"<p>For those who had been working with Cisco routers, setting up a Cisco ASA stateful policy is as simple as setting up an ACL. \u00a0By default, ASA would drop any TCP connection that doesn&#8217;t have a session record created with a sync packet. In that case user doesn&#8217;t require to a setup ACL for return traffic like working with routers.<br \/>\nIn this example, we have 192.168.104.250\/32 as the server in the DMZ and have the have NAT 1 to 1 incoming traffic mapping applied to allow internet user accessing the http service only.<br \/>\nThe IP address of the firewall is 10.50.2.10\/29, and we will assign the mapping of the server to another external IP address of 10.50.2.11<br \/>\n<a href=\"https:\/\/networkingnotesblog.files.wordpress.com\/2016\/12\/20161215-vasa-lab-nat.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1207\" src=\"https:\/\/networkingnotesblog.files.wordpress.com\/2016\/12\/20161215-vasa-lab-nat.png\" alt=\"20161215-vasa-lab-nat\" width=\"700\" height=\"312\" srcset=\"http:\/\/notes4it.com\/wp-content\/uploads\/2016\/12\/20161215-vasa-lab-nat.png 966w, http:\/\/notes4it.com\/wp-content\/uploads\/2016\/12\/20161215-vasa-lab-nat-300x134.png 300w, http:\/\/notes4it.com\/wp-content\/uploads\/2016\/12\/20161215-vasa-lab-nat-768x343.png 768w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><!--more--><br \/>\nobject network 10.50.2.11_32<br \/>\nsubnet 10.50.2.11 255.255.255.255<br \/>\nobject network 192.168.104.250_32<br \/>\nhost 192.168.104.250<br \/>\nnat (untrust,DMZ) source static any any destination static 10.50.2.11_32 192.168.104.250_32 unidirectional \u00a0 \u00a0 &lt;&#8211; this is the twice\u00a0NAT one to one mapping for incoming traffic only. when traffic from 192.168.104.250 accessing the internet, the packet of the source address WILL NOT translated to 10.50.2.11 in this case.<br \/>\naccess-list untrust_in extended permit icmp any4 any4 \u00a0 \u00a0 &lt;&#8211; this is to allow the firewall and the mapped device to take response to the icmp packets.<br \/>\naccess-list untrust_in extended permit tcp any4 host 192.168.104.250 eq www \u00a0 \u00a0 &lt;&#8211; this is to allow any IPv4 address to access 192.168.104.250 s tcp 80 port.<br \/>\naccess-group untrust_in in interface untrust \u00a0 \u00a0 &lt;&#8211; this is to apply the firewall filter as the ingress filter in the untrust interface.<br \/>\nTo test the policy settings, we can use packet-tracer in the ASA itself.<br \/>\nnet-vASA-AS5052-F14# packet-tracer input untrust tcp <span style=\"color:#ff6600;\">8.8.8.8<\/span> <span style=\"color:#0000ff;\">12345<\/span> 10.50.2.11 <span style=\"color:#ff0000;\">80<\/span><br \/>\n(the <span style=\"color:#ff6600;\">8.8.8.8<\/span> is a random source address, the <span style=\"color:#0000ff;\">12345<\/span> from source port is randomly made since high ports are used for initialing a traffic, <span style=\"color:#ff0000;\">80<\/span>\u00a0is the destination port)<br \/>\nPhase: 1<br \/>\nType: UN-NAT<br \/>\nSubtype: static<br \/>\nResult: ALLOW<br \/>\nConfig:<br \/>\nnat (untrust,DMZ) source static any any destination static 10.50.2.11_32 192.168.104.250_32 unidirectional<br \/>\nAdditional Information:<br \/>\nNAT divert to egress interface DMZ<br \/>\nUntranslate 10.50.2.11\/80 to 192.168.104.250\/80<br \/>\nPhase: 2<br \/>\nType: ACCESS-LIST<br \/>\nSubtype: log<br \/>\nResult: ALLOW<br \/>\nConfig:<br \/>\naccess-group untrust_in in interface untrust<br \/>\naccess-list untrust_in extended permit tcp any4 host 192.168.104.250 eq www<br \/>\nAdditional Information:<br \/>\nPhase: 3<br \/>\nType: NAT<br \/>\nSubtype:<br \/>\nResult: ALLOW<br \/>\nConfig:<br \/>\nnat (untrust,DMZ) source static any any destination static 10.50.2.11_32 192.168.104.250_32 unidirectional<br \/>\nAdditional Information:<br \/>\nStatic translate 8.8.8.8\/12345 to 8.8.8.8\/12345<br \/>\nPhase: 4<br \/>\nType: NAT<br \/>\nSubtype: per-session<br \/>\nResult: ALLOW<br \/>\nConfig:<br \/>\nAdditional Information:<br \/>\nPhase: 5<br \/>\nType: IP-OPTIONS<br \/>\nSubtype:<br \/>\nResult: ALLOW<br \/>\nConfig:<br \/>\nAdditional Information:<br \/>\nPhase: 6<br \/>\nType: NAT<br \/>\nSubtype: rpf-check<br \/>\nResult: ALLOW<br \/>\nConfig:<br \/>\nnat (DMZ,untrust) source static 192.168.104.250_32 untrust-111.111.111.111_32<br \/>\nAdditional Information:<br \/>\nPhase: 7<br \/>\nType: NAT<br \/>\nSubtype: per-session<br \/>\nResult: ALLOW<br \/>\nConfig:<br \/>\nAdditional Information:<br \/>\nPhase: 8<br \/>\nType: IP-OPTIONS<br \/>\nSubtype:<br \/>\nResult: ALLOW<br \/>\nConfig:<br \/>\nAdditional Information:<br \/>\nPhase: 9<br \/>\nType: FLOW-CREATION<br \/>\nSubtype:<br \/>\nResult: ALLOW<br \/>\nConfig:<br \/>\nAdditional Information:<br \/>\nNew flow created with id 29, packet dispatched to next module<br \/>\nResult:<br \/>\ninput-interface: untrust<br \/>\ninput-status: up<br \/>\ninput-line-status: up<br \/>\noutput-interface: DMZ<br \/>\noutput-status: up<br \/>\noutput-line-status: up<br \/>\nAction: allow<br \/>\nThe test result shows that the firewall will <strong>ALLOW<\/strong>\u00a0any packets with destination port of 80\u00a0to the server.<br \/>\n<!--more--><\/p>\n<hr \/>\n<p>Since we have perform a 1 to 1 incoming mapping to the server, would https\u00a0services in the server be able to access by the internet users as well? We could use packet tracer to check with again.<br \/>\nnet-vASA-AS5052-F14# packet-tracer input untrust tcp 8.8.8.8 <span style=\"color:#0000ff;\">12345<\/span> 10.50.2.11<span style=\"color:#ff0000;\"> 443<br \/>\n<span style=\"color:#000000;\">(the <span style=\"color:#0000ff;\">12345<\/span> from source port is randomly made since high ports are used for initialing a traffic, <span style=\"color:#ff0000;\">443<\/span> is the destination port)<\/span><br \/>\n<\/span><br \/>\nPhase: 1<br \/>\nType: UN-NAT<br \/>\nSubtype: static<br \/>\nResult: ALLOW<br \/>\nConfig:<br \/>\nnat (untrust,DMZ) source static any any destination static 10.50.2.11_32 192.168.104.250_32 unidirectional<br \/>\nAdditional Information:<br \/>\nNAT divert to egress interface DMZ<br \/>\nUntranslate 10.50.2.11\/443 to 192.168.104.250\/443<br \/>\nPhase: 2<br \/>\nType: ACCESS-LIST<br \/>\nSubtype:<br \/>\nResult: DROP<br \/>\nConfig:<br \/>\nImplicit Rule<br \/>\nAdditional Information:<br \/>\nResult:<br \/>\ninput-interface: untrust<br \/>\ninput-status: up<br \/>\ninput-line-status: up<br \/>\noutput-interface: DMZ<br \/>\noutput-status: up<br \/>\noutput-line-status: up<br \/>\nAction: <strong>drop<\/strong><br \/>\nDrop-reason: (acl-drop) Flow is denied by configured rule<br \/>\nThe test result shows that the firewall will <strong>DROP<\/strong>\u00a0any packets with destination port of 443 to the server. The beaut of packet tracer would provide the drop reason, and in this case, it means the packet was drop due to no allowed policy applied.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For those who had been working with Cisco routers, setting up a Cisco ASA stateful policy is as simple as setting up an ACL. \u00a0By default, ASA would drop any TCP connection that doesn&#8217;t have a session record created with a sync packet. In that case user doesn&#8217;t require to a setup ACL for return [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,3],"tags":[14,26,46,114,131,187,192,193],"class_list":["post-736","post","type-post","status-publish","format-standard","hentry","category-networking","category-virtualization","tag-asa-en","tag-cisco-en","tag-firewall-en","tag-nat-en","tag-policy-en","tag-twice-nat-en","tag-vasa-en","tag-virtual-en"],"_links":{"self":[{"href":"http:\/\/notes4it.com\/index.php?rest_route=\/wp\/v2\/posts\/736","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/notes4it.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/notes4it.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/notes4it.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/notes4it.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=736"}],"version-history":[{"count":0,"href":"http:\/\/notes4it.com\/index.php?rest_route=\/wp\/v2\/posts\/736\/revisions"}],"wp:attachment":[{"href":"http:\/\/notes4it.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/notes4it.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=736"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/notes4it.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}