Link to home
Start Free TrialLog in
Avatar of okamon
okamon

asked on

how to enter static (inside,outside) command in cisco router?

I have setup cisco router, no problem access internet and external users also able to access public service. However, when internal user try to access the website using external ip address it get blocked. Tested externally, no problem seeing the site. I found that I need to enter this command "static (inside,outside) 151.205.x.x 10.1.20.222 dns netmask 255.255.255.255"

But it seems I cannot enter this using cli.... how to do it?
Avatar of Wissam
Wissam
Flag of United Kingdom of Great Britain and Northern Ireland image

For a cisco router,
The first step is to define the addresses that will need to do NAT, can be done using a standard access-list:

access-list 1 permit your_lan_address_range
example: access-list 1 permit 192.168.1.0

Now we should enable the actual NAT:
ip nat inside source list access-list number interface overload
example: ip nat inside source list 1 eth1 overload

This command states that it will use the addresses from the access-list we defined in step 1 and NAT it to the Public IP address on the interface, e.g. serial 0, dialer 0, ethernet 1,… overload keyword specifies that multiple LAN addresses can be NAT’d to that same address. The router uses the TCP and UDP ports of the hosts [LAN addresses] to translate the public IP address back to the originating local host address.

The last steps we need to configure is to tell the router which our inside and outside addresses. This is achieved using the following commands:
- for the inside
conf t
interface ethernet | fastethernet number
ip nat inside

- for the outside, assume we are dealing with an xDSL router
conf t
interface dialer0
ip nat outside

Now that NAT is configured we can check to see which addresses are being used by using the show ip nat translations commands.
what is it that you have? Cisco Router or Pix, the "static (inside,outside)" command is for a PIX or ASA and the configuration is much different for NAT statements.

Furthermore, your statement " the website using external ip address it get blocked. " is a typical issue that is encountered trying to access a internal server using the external IP. On cisco routers, this is overcomed by utilizing a concept if NAT Hairpin routing;  DNS doctoring which is the feature you are looking for is not supported on Cisco routers. However, that is the correct command for the PIX and ASA and in some version is handled by default if I recall.

If you are trying to add the command to an IOS router, it will fail:

WORKAROUND 1:
Instead of using the public IP address, try to access the server through the private IP address. It's the most simple way to solve this issue.

WORKAROUND 2:
Configure what is called NAT on a Stick in your router. This kind of special configuration "tricks" both the server and the LAN to believe they are talking with a completely different network, avoiding the issue related to the NAT. Keep in mind regarding this workaround is that this specific setup is not supported by Cisco.

http://ccietobe.blogspot.com/2009/01/nat-on-stick.html

PIX/ASA:
http://www.cisco.com/en/US/products/ps6120/products_configuration_example09186a00807968c8.shtml

Also note, that if you have already applied the command, it is important that you also need to enable DNS inspection to perform DNS doctoring (Read the last link, it has all the required information).

Good Luck
Billy
Avatar of okamon
okamon

ASKER

yes. my is cisco router and it's configured as a NAT, so people sharing one public ip... but I don't want to to use internal ip as the users are used to use external address for accessing the website. So are you saying the only way to do it is to use NAT on a Stick??
no the configuration i entered for you earlier would work on your router
> So are you saying the only way to do it is to use NAT on a Stick??
correct; you will NOT be able to redirect a internal network from the inside to the outside back into the inside without a NAT hairpin route.

http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_7-3/anatomy.html
Figure 10: Hairpin NAT Operation

Here is another thread with additional workarounds; i have only implemented the hairpin solution

http://www.gossamer-threads.com/lists/cisco/nsp/90968



Billy
Avatar of okamon

ASKER

Is it difficult to do for NAT hairpin route? I don't know much about cisco...... any tutorial?
ASKER CERTIFIED SOLUTION
Avatar of rfc1180
rfc1180
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of okamon

ASKER

thanx rfc1180. it seems a simple solution. But let me confirm if this is correct:
my lans is 10.0.0.0 / 24
web server:10.0.0.20
webserver ip: 151.205.x.x

So I go to the config mode of the router, and type 151.205.x.x 255.255.255.255 10.0.0.20
and then in web server, I also put 151.205.x.x  in in tcp/ip setting and in host header value, I just leave it blank?


Above are correct?
Sounds good

Billy