Access natted ip using public url

Unanswered Question
Mar 16th, 2010
User Badges:

Hello,


i've a basic scenario that i cant get to work.

i have a cisco asa 5505 acting as a firewall/router to our office with single public ip and i have setup PAT to allow all users behind it to access the internet.

i've added a static nat rule for http port 80 to be forwarded to a the ip of a web server. and the dns is pointing to the public ip that is setup as the ip on the outside interface of the ASA.


now i can access this normally but only from outside my network. but if i try to browse to this url from inside the network it wont load. except if i use the local ip of the machine.


i just replaced a cisco linksys WRVS4400N wireless router. for which this scenario used to work. ie: i can use the public url to acccess the web server from both inside and outside my local network.


please advise what config is needed to be added to allow this?


thank you in advance

Regards

Ramez

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Jennifer Halim Wed, 03/17/2010 - 06:09
User Badges:
  • Cisco Employee,

If you are hosting your dns server externally, you can add "dns" keyword at the end of your static nat statement for

the webserver.


Eg:

static (inside,outside) tcp interface 80 80 netmask 255.255.255.255 dns

ramez.ragaie Thu, 03/18/2010 - 01:57
User Badges:

hey,


thank you for reply. however my problem is not related to dns or so.

because i also can't telnet my public ip (no dns naming) on port 80 from the inside network, yet this can be done from any machine outside my local network.


please advise?

Jennifer Halim Thu, 03/18/2010 - 02:01
User Badges:
  • Cisco Employee,

yes, with dns doctoring, when you received the dns reply from your external dns server, it will automatically convert the dns resolution for the public ip address to private ip address so when the internal host receives the resolution, it is the private/internal ip address instead of the public ip address. Hence you will be connecting directly to the private ip address within your internal network.

ramez.ragaie Thu, 03/18/2010 - 05:11
User Badges:

ok so i enabled dns rewrite on the nat rule

but its still not working


i did a quick search and some results mentioned that dns rewrite depends on dns inspection and some other settings.

can you please assist me?

Jennifer Halim Thu, 03/18/2010 - 05:13
User Badges:
  • Cisco Employee,

If you check "sh run policy-map", make sure that "inspect dns" is configured.

ramez.ragaie Thu, 03/18/2010 - 05:23
User Badges:

output of the sh run policy-map


Result of the command: "sh run policy-map"


!
policy-map type inspect dns preset_dns_map
parameters
  message-length maximum 512
policy-map global_policy
class inspection_default
  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 dns preset_dns_map
policy-map type inspect dns Test_nat_rewrite
description just test
parameters
  message-length maximum 512
!


note that i just added "Test_nat_rewrite" to verify

ramez.ragaie Thu, 03/18/2010 - 05:27
User Badges:

below is my running config after removing the sensitive information


Result of the command: "show running-config"


: Saved
:
ASA Version 8.0(4)16
!
hostname ciscoasa
domain-name default.domain.invalid
enable password *** encrypted
passwd *** encrypted
names


!
interface Vlan1
nameif inside
security-level 100
ip address 192.168.1.1 255.255.255.0
ospf cost 10
!
interface Vlan2
nameif outside
security-level 0
ip address ***  255.255.255.252
ospf cost 10
!
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
!
boot system disk0:/asa804-16-k8.bin
ftp mode passive
dns domain-lookup outside
dns server-group DefaultDNS
name-server ***
name-server ***
name-server ***
domain-name default.domain.invalid


access-list acl-out extended permit tcp any interface outside eq www
access-list acl-out extended permit tcp any interface outside eq 8080
access-list outside_1_cryptomap extended permit ip 192.168.1.0 255.255.255.0 object-group RackSpace
access-list inside_nat0_outbound extended permit ip 192.168.1.0 255.255.255.0 object-group RackSpace
pager lines 24
logging enable
logging buffered debugging
logging asdm informational
mtu inside 1500
mtu outside 1500
icmp unreachable rate-limit 1 burst-size 1
asdm image disk0:/asdm-61551.bin
no asdm history enable
arp inside 192.168.1.11 001e.642e.a98a
arp inside 192.168.1.10 0021.6b40.18c8
arp timeout 14400
global (outside) 1 interface
nat (inside) 0 access-list inside_nat0_outbound
nat (inside) 1 0.0.0.0 0.0.0.0
static (inside,outside) tcp interface 8080 LocalDB 8080 netmask 255.255.255.255  dns
static (inside,outside) tcp interface www LocalDB www netmask 255.255.255.255  dns
access-group acl-out in interface outside
route outside 0.0.0.0 0.0.0.0 213.132.40.17 1
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
dynamic-access-policy-record DfltAccessPolicy
aaa-server TACACS+ protocol tacacs+
aaa-server RADIUS protocol radius
aaa authentication telnet console LOCAL
aaa authentication ssh console LOCAL
http server enable
http 0.0.0.0 0.0.0.0 inside
http 0.0.0.0 0.0.0.0 outside
http 192.168.1.0 255.255.255.0 inside
no snmp-server location
no snmp-server contact
snmp-server enable traps snmp authentication linkup linkdown coldstart
crypto ipsec transform-set ESP-DES-SHA esp-des esp-sha-hmac
crypto ipsec transform-set ESP-3DES-SHA esp-3des esp-sha-hmac
crypto ipsec transform-set ESP-3DES-MD5 esp-3des esp-md5-hmac
crypto ipsec security-association lifetime seconds 28800
crypto ipsec security-association lifetime kilobytes 4608000
crypto map outside_map 1 match address outside_1_cryptomap
crypto map outside_map 1 set peer ***
crypto map outside_map 1 set transform-set ESP-3DES-MD5
crypto map outside_map interface outside
crypto isakmp enable outside
crypto isakmp policy 10
authentication pre-share
encryption 3des
hash md5
group 2
lifetime 86400
crypto isakmp policy 20
authentication pre-share
encryption 3des
hash sha
group 2
lifetime 86400
telnet 192.168.1.2 255.255.255.255 inside
telnet 0.0.0.0 0.0.0.0 inside
telnet timeout 5
ssh 0.0.0.0 0.0.0.0 inside
ssh 0.0.0.0 0.0.0.0 outside
ssh timeout 5
ssh version 2
console timeout 0
dhcpd address 192.168.1.120-192.168.1.150 inside
dhcpd dns ***  ***  interface inside
dhcpd enable inside
!


threat-detection basic-threat
threat-detection statistics access-list
no threat-detection statistics tcp-intercept
username mobitrans password FTxWqcyJqT.aNchO encrypted privilege 15
tunnel-group ***  type ipsec-l2l
tunnel-group ***  ipsec-attributes
pre-shared-key *
tunnel-group ***  type ipsec-l2l
tunnel-group ***  type ipsec-l2l
tunnel-group ***  ipsec-attributes
pre-shared-key *
!
class-map inspection_default
match default-inspection-traffic
!
!
policy-map type inspect dns preset_dns_map
parameters
  message-length maximum 512
policy-map global_policy
class inspection_default
  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 dns preset_dns_map
policy-map type inspect dns Test_nat_rewrite
description just test
parameters
  message-length maximum 512
!
service-policy global_policy global
prompt hostname context
Cryptochecksum:e57c521513bf92799472b004fc30c708
: end



hope this helps

Jennifer Halim Thu, 03/18/2010 - 16:35
User Badges:
  • Cisco Employee,

Configuration looks correct.


Can you please confirm that your internal user/host uses external dns server to resolve the dns name for the webserver?


From the internal host, you can perform a test from a DOS prompt:


C:\nslookup

>server

>


Eg:

C:\>nslookup

> server 4.2.2.2
Default Server:  vnsc-bak.sys.gtei.net
Address:  4.2.2.2


>www.cisco.com
Server:  vnsc-bak.sys.gtei.net
Address:  4.2.2.2


Non-authoritative answer:
Name:    origin-www.cisco.com
Address:  10.1.1.1    <------ this is example only
Aliases:  www.cisco.com, www.cisco.com.akadns.net
          geoprod.cisco.com.akadns.net


In summary, if you perform dns resolution from your internal host with an external dns server (the dns request and reply needs to pass through the firewall), and the firewall will automatically change the dns resolution from the public to the private ip address.

Actions

This Discussion