I have two computers (let say "A" and "B") that are already pinging and sshing each other via firewire, both with static ip. Computer A is connected to the Internet and I want it to share its internet connection to computer B. I have no idea of how this can be done via firewire interface. Any ideas? thanks a lot.
1 Answer
Computer [A]:
- enable IP forwarding
- temporarily by running
echo 1 > /proc/sys/net/ipv4/ip_forward
- or permanently by adding
net.ipv4.ip_forward=1
in/etc/sysctl.conf
- temporarily by running
- iptables rules, assuming eth0 is your interface to the internet and firewire0 the internal connection to comp [B] (to make them permanent, add them to
/etc/rc.local
before the "exit 0":
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/sbin/iptables -A FORWARD -i eth0 -o firewire0 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i firewire0 -o eth0 -j ACCEPT
Computer [B]:
- check for a valid DNS server in
/etc/resolv.conf
, if not add a line withnameserver 8.8.8.8
- make sure the default route is through comp [A] (
route -n
shows computer [A] IP's on the line with destination 0.0.0.0). if not, runroute del default; route add default gw COMPUTER_A_IP_ON_firewire0