Web Hosting Talk







View Full Version : Nat


Hotspeed
04-12-2004, 01:20 PM
How do you setup NAT ?

probonic
04-12-2004, 08:14 PM
If you're talking about Linux, you need to look into iptables. Here is the NAT section of my firewall script that I use here at home:

iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain

# Set up IP FORWARDing and Masquerading
iptables --table nat --append POSTROUTING --out-interface $EXTERNAL -j MASQUERADE
iptables --append FORWARD --in-interface $INTERNAL -j ACCEPT

echo 1 > /proc/sys/net/ipv4/ip_forward

Just replace $EXTERNAL with the name of the interface on your Linux box which connects to the internet, and replace $INTERNAL with the interface that goes to your internal network.

If you're talking about Windows, then you just need to use Internet Connection Sharing.

Hotspeed
04-12-2004, 09:27 PM
i am not talking about iptables , i am taking about assigning private ips like 192.168.0.xxx to my servers , but the private ips must be linked with public ips.

_biGfOOts_
04-13-2004, 01:24 PM
ip addr add 192.168.0.xxx dev your_device

Hotspeed
04-13-2004, 01:40 PM
i dont mean how to add address or bring up ips on the servers. rather how do i link the private ips to the public ips ?

RandomLittleHost
04-13-2004, 01:43 PM
Are both sets of IP's on the same server? If so, you'll need to forward whichever ports you need from the external IP to the internal IP, probably by using IPTables (though I've no experience of this)