Given: I have a machine (HostA) with only one NIC which has Internet connectivity. I have another machine (HostB) with one NIC on the same switch. HostB is not configured for Internet access yet. HostA has its default gateway and DNS servers appropriately configured. IPv4 is being used. OSes on the hosts are Ubuntu 13 and Fedora17.
What I want: Now, I would like HostB to have Internet connectivity, too. Is this possible using 'some' combination of
iptables, virtual tun/tap devices, or a VPN setup between HostA and HostB, etc?
What I already know and can do: Currently, I can use an
ssh-based SOCKS proxy on HostB (
ssh -D 9050 UserA@HostA) and route traffic of select 'socksifiable' applications on HostB via this proxy to HostA and beyond. However, sadly, not all applications are socksifiable. Now, I know very well that if HostA had 2 NICs, I could have used some
iptables rules to convert HostA into a gateway that would then route traffic between its NIC-1 and NIC-2 (where NIC-1 would be connected to HostB and NIC-2 to Internet). But installing another NIC in HostA is not feasible for me.
PS: I had posted this earlier on superuser.com but got no useful information.
:> ip addr [...] 2: p4p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether d4:be:d9:d5:46:05 brd ff:ff:ff:ff:ff:ff inet 192.168.22.9/24 brd 192.168.22.255 scope global p4p1 :> ip route default via 192.168.22.254 dev p4p1 proto static 192.168.22.0/24 dev p4p1 proto kernel scope link src 192.168.22.9
:> ip addr [...] 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 30:f9:ed:d9:2e:20 brd ff:ff:ff:ff:ff:ff inet 192.168.22.234/24 brd 192.168.22.255 scope global eth0 :> ip route 169.254.0.0/16 dev eth0 scope link metric 1000 192.168.22.0/24 dev eth0 proto kernel scope link src 192.168.22.234 metric 1