I have an Internet-enabled machine, HostA, with one NIC. I have another machine, HostB, with one NIC that is not Internet-enabled.
I would like HostB to be able to share HostA's Internet-connection. Is this possible using 'some' combination of
iptables, tun/tap devices?
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, obviously, not all applications are socksifiable. So, I would like to have the entire network traffic from/to HostB to go via HostA. Now, I know very well that if HostA had 2 NICs, I could have some
iptables rules to convert HostA into a gateway that would 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 just not possible.
I'm using Ubuntu 13.
EDIT: Additional details: HostA and HostB are both plugged into a switch. HostA has its default gateway and DNS servers appropriately configured. IPv4 is being used.