Quote:
Originally posted by hasnain
[root@localhost root] ifconfig eth0:1 192.168.0.1 netmask 255.255.255.0 up
|
That would be how to give a network adapter a second (virtual) IP address.
@hariiyer
To setup masquerading, as root enter into the commandline:
iptables -t nat -A POSTROUTING -o ethX -j MASQUERADE
You'll also need to turn on port forwarding (echo "1" > /proc/sys/net/ipv4/ip_forward) and setup forwarding rules to allow traffic to pass between the two interfaces. Something like this should work:
iptables -A FORWARD -i ethY -o ethX -j ACCEPT
iptables -A FORWARD -i ethX -o ethY -m state --state ESTABLISHED,RELATED -j ACCEPT
Where ethX is your external interface (connected to internet) and ethY is the internal interface (connected to your internal LAN).