User Tools

Site Tools


Devuan Recipes

Share your network connection

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 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 netmask up
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
iptables -I FORWARD -o wlan0 -s -j ACCEPT
iptables -I INPUT -s -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 ( 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 netmask up
mv /etc/resolv.conf /etc/resolv.conf.back
echo 'nameserver' > /etc/resolv.conf
echo 'nameserver' >> /etc/resolv.conf
unix/linux/debian/recipes.txt · Last modified: 2021/04/30 01:45 by rodolico