How can I share a wireless connection to the Internet through an Ethernet cable, using Arch Linux?

That is, I have a laptop with a wifi connexion to the Internet, and I would like to share that with a computer that does not have working wifi software through an Ethernet cable.

There is a guide here


but it uses ifconfig, which I think is obsolete.

The receiving computer is a Windows machnie, but I suppose that doesn't matter.

  • The Arch Wiki has an up-to-date page on Software access points Is that what you want? If not, are you broadcasting wifi and bridging all connected clients through ethernet, or serving as the gateway to an ethernet network and bridging that through your wifi? – Stewart Aug 23 '20 at 19:10
  • @Stewart, sorry I was unclear; edited. – Toothrot Aug 23 '20 at 19:47
  • 1
    I think the answer is to add a network bridge. See brctl or Network Bridge. I think your wlan0 would be the master and eth0 would also need to be added. Not entirely sure though as I haven't played with bridges or tunnels for a while. – Stewart Aug 23 '20 at 19:54
  • I did something similar recently. The "recipe" is on this github page. As you'll see this is me making it up as I went along - but it might be useful. – Seamus Aug 23 '20 at 23:46

On your laptop, these commands are needed to route traffic between interfaces and setup NAT:

sudo sysctl net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o [your wireless adapter] -j MASQUERADE

You will also need to give static IPs to your ethernet NICs connected with cable, on both machines. Either manually or using an app like Network Manager. On the 2nd computer, the one without Internet connection, you'll need to add your laptop's static IP address as gateway and set IP of DNS server, the same as on your laptop (cat /etc/resolv.conf will probably show the IP/IPs of DNS server, unless a modern implementation of dns settings is used).

  • Would it be possible to do this so that the receiving machine can't tell the difference between my laptop and a router? (I.e. so that no special action is required on the receiver.) – Toothrot Aug 23 '20 at 19:59
  • 1
    That's exactly the result, it's NAT - masquerate. – Krackout Aug 23 '20 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.