CrossoverCable

From Arwiki

Jump to: navigation, search

On master machine ( the one with the working inet connection ):

1) Become root:
sudo -i
3) Enable IP forwarding:
echo "1" > /proc/sys/net/ipv4/ip_forward
4) Tell iptables to masquerade and forward packets that go to your "internet interface" (e.g. ppp0, eth0 or eth1, etc...):
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
5) Assign some internal IP address to your LAN card (e.g. eth1):
ifconfig eth0 inet 192.168.5.1 up

All the commands ( server-side ):

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

iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

ifconfig eth0 inet 192.168.5.1 up

sudo /sbin/iptables -A FORWARD -s 192.168.5.0/24 -j ACCEPT
sudo /sbin/iptables -A FORWARD -d 192.168.5.0/24 -j ACCEPT

sudo /etc/init.d/networking restart

On client computer:

ifconfig eth0 inet 192.168.5.2 up
route add default gw 192.168.5.1
sudo vi /etc/resolv.conf

In resolv.conf, just copy the entries from the master computer

Personal tools