2008-03-29

Quick'n'dirty temporary configuration of internet gateway

Scenario: One Fedora 8 host with wireless internet access, and I want to give another Fedora 8 host internet access through cabling to it.

First connect the cables - and be aware that NetworkManager might start playing tricks when it detects link on the wired interfaces.

On the host with internet access find a free IP range and configure the network interface:
ifconfig eth0 10.0.0.1 up
Enable IP forwarding:
sysctl net.ipv4.ip_forward=1
But masquerade it:
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -j MASQUERADE

On the other host configure the network interface:
ifconfig eth0 10.0.0.2 up
Set default gateway:
route add default gw 10.0.0.1
Configure DNS with settings from the other host:
echo "nameserver 192.168.2.1" > /etc/resolv.conf

THAT was dirty!

I always forget the masquerading part and have difficulties finding it - now I know where to find it ;-)

No comments: