I had an issue where I was trying to set up a fail over firewall, but I did not have two Internet sources, so could not easily test it. I had a Wireless Hotspot, but no way to plug it into the firewall. So, I connected my laptop to the Hotspot, then shared that connection with the second WAN port on the firewall. Magic!
This was taken from https://medium.com/@TarunChinmai/sharing-internet-connection-from-a-linux-machine-over-ethernet-a5cbbd775a4f and modified by me. The original article explains in more detail.
NOTE: the IP addresses are variable here. You just need to create a network that can see each other.
NOTE: the Network Interfaces are specific to your machine. I have it set up for mine, which has wlan for wireless and eth0 for the wired
First step is to get your wireless working, so connect your laptop to your Hotspot and make sure you have a good connection. Now, run the following commands as the root user. Be sure to change the IP/netmask and interface names to match your device.
sysctl -w net.ipv4.ip_forward=1 ifconfig eth0 10.217.217.1 netmask 255.255.255.0 up iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE iptables -I FORWARD -o wlan0 -s 10.217.217.0/24 -j ACCEPT iptables -I INPUT -s 10.217.217.0/24 -j ACCEPT
Now, plug network cable from laptop to device to share with (the router in my case) and set the device up to have an IP in the subnet you chose above. For my SmartAppliances (https://smartappliances.us) firewall, I did all the work via the web interface, but if you are simply connecting to another Linux machine, do the following, as root. But, anything to set the IP as static and give yourself a DNS server. The original article has detailed instructions for Windows.
ifconfig eth0 10.217.217.2 netmask 255.255.255.0 up mv /etc/resolv.conf /etc/resolv.conf.back echo 'nameserver 220.127.116.11' > /etc/resolv.conf echo 'nameserver 18.104.22.168' >> /etc/resolv.conf