This is a fork on the gist by Konamiman. Several typos are corrected and it works on my Pop!_OS too.
Suppose you want to share the Wi-Fi interface wlx244bxx to the Ethernet interface enp0s31f6 (I know it's weird)…
Following this guide, you may need to download some packages from apt
.
Configure the interface (in my case the Ethernet one) to let the device being shared internet acquire a static IP address. Here the gist proposes installing dhcpcd
and edit /etc/dhcpcd.conf
.
You may need to tick the "Automatically connect" option for the created connection in Network Manager (like via nmtui
) for convenience.
Then install isc-dhcp-server
, edit the config /etc/dhcp/dhcpd.conf
:
Trick: It seems that you can use the local DNS server (systemd-resolved) to serve as the DNS server for your local network with the command:
Useful if you want to ensure the same behavior on your host machine…
It's good to always assign an static address to the downstream device. Find out the device's MAC address and append:
Then the edit file /etc/default/isc-dhcp-server
,
Now systemctl start isc-dhcp-server
. Check the journal (journalctl -u ...
) to see if everything goes well.
Now the iptables
rules. Unfortunately it is not persistent, so the gist wraps it as a shell script and run it upon boots. You can adapt my script:
- nftables?
- How about iptables-persistent?