redirect IP to IP with hosts file

WraithAkaMrak

Member
Apr 23, 2003
95
0
0
I'm trying to redirect a Static IP (assigned to us by our ISP) to an internal IP address (so we don't get sent to router config).

Just putting in the Static IP in where the domain name usually goes in the hosts file doesn't work.

Is there a way to fix this?
 

skyking

Lifer
Nov 21, 2001
22,775
5,937
146
Please give a little more detail about what you are doing. Are you trying to access a local server from the LAN, or the WAN? What kind of router?

If you are in the LAN trying to "loop back" to your WAN address to get to your server, most times it will not work with entry-level routers.
 

WraithAkaMrak

Member
Apr 23, 2003
95
0
0
If you are in the LAN trying to "loop back" to your WAN address to get to your server, most times it will not work with entry-level routers.
This is what I'm trying to do. It did work when we hosted the entire website locally and used the domain name to get to the server. I simply edited the Hosts file as such on machines in our LAN:

<LAN IP> <Domain Name>

So when we typed in <Domain Name>, it would forward to the server's <LAN IP>.

Now we've moved most of the website to our ISP, with the domain name pointing there. We still link to the Static IP (WAN address), for one part of the site hosted locally. But editing Hosts as:

<LAN IP> <WAN IP>

does not seem to work.

It's a Netgear RP114, if that makes any difference.
 

skyking

Lifer
Nov 21, 2001
22,775
5,937
146
that "portion" of the site still has a LAN or local address: Use that. if it is www.blahblah.com/anything,
put that url in your hosts file. If it is a mailserver, use the local address for pop and smtp.
 

Garion

Platinum Member
Apr 23, 2001
2,331
7
81
The HOSTS file is simply a way to suppement or override DNS, as you've used it for earlier. DNS is simply a mapping of hostnames to IP address. There isn't any way to use it to map an IP to an IP - That's not what it's for.

Unfortunately, I don't think there *is* a way for you to do what you're looking to do, unfortunately.

- G
 

WraithAkaMrak

Member
Apr 23, 2003
95
0
0
that "portion" of the site still has a LAN or local address: Use that. if it is www.blahblah.com/anything,
put that url in your hosts file. If it is a mailserver, use the local address for pop and smtp.
The site links straight to the WAN IP. It isn't really connected to "www.blahblah.com" at all except through the link to the WAN IP.

The HOSTS file is simply a way to suppement or override DNS, as you've used it for earlier. DNS is simply a mapping of hostnames to IP address. There isn't any way to use it to map an IP to an IP - That's not what it's for.

Unfortunately, I don't think there *is* a way for you to do what you're looking to do, unfortunately.
Ok. Guess we'll just have to put in the LAN IP if we really want to see that part of the site then.

The local server runs an outdoor camera, and records footage. Everything but the live feed is hosted w/ our ISP, so it saves on our connection. And we're working on getting it so the feed is sent to the ISP instead, so we hopefully don't need the WAN IP at all in the future. But it would have been nice to be able to browse the site (as it is now) normally from within our LAN.