I want to connect two devices, the first is a laptop with ubuntu (connected to internet via wifi), and the second one is a device with a distro linux compiled with yocto. These two devices are connected each other with an ethernet cable. I want the internet acces on the second device. On the laptop i've setted a static IP on the eth interface (, and i've allowed the wifi sharing option to other computers (so to the eth iface too). In the second device i've the following etc/network/interfaces:

auto eth0
iface eth0 inet static

Now i'm able to start ssh session, but the only ping that works on the secon device is on I've tried to ping or but nothing! What i'm doing wrong?

  • You will have to give way more informations about "wifi sharing" on the laptop. The issue is probably on the laptop, not the yocto device.
    – A.B
    Commented Mar 26, 2020 at 22:37
  • The laptop is connected to a WiFi Access Point with default settings. My only change to this settings (as mentioned in a lot of raspberry forum) is been enabling the ICS over all other computer connected.
    – Sguit
    Commented Mar 26, 2020 at 22:50
  • related: askubuntu.com/questions/3063/… Commented Feb 8 at 11:49

4 Answers 4


There are two ways to accomplish this. I'm not sure how to go about this using a GUI, but here's the standard way on Ubuntu. I will use the UFW and netplan tools which come with later versions of Ubuntu, as an example. One of these options should be applied on the laptop.

Setup a NAT

The reason your current setup isn't working is that you haven't setup a NAT, or Network Address Translation. A NAT is what is responsible for changing the device's IP as packets enter and leave your NAT gateway. A wireless router does this, and this is the reason devices have private IP addresses, but can still contact the outside internet.

In Ubuntu, setting up a NAT is fairly straightforward because of the built-in UFW utility. In the file /etc/ufw/sysctl.conf, comment out the line net.ipv4.ip_forward=1.

Also, set this line in /etc/default/ufw

Now, in the file /etc/ufw/before.rules, add these lines just before the filter rules:




Change <WIRELESS INTERFACE> to the name of your wireless interface, found using ip link. Once you have made these changes, restart ufw to apply changes sudo systemctl restart ufw, and also make sure the firewall is enabled by running sudo ufw enable.

Your current configuration with static IPs on the ethernet interface will work fine, and your secondary device should now be able to contact the outside.

Setup a Bridge

Another option is to bridge your ethernet interface and your wireless interface, essentially turning your laptop into a network switch. This is the best option if you want your device to act as a normal device on your network (as in as far as the other devices in your network is concerned, this is just another wireless client). You can configure your interfaces in the file /etc/netplan/01-netcfg.yaml or /etc/netplan/50-cloud-init.yaml. Whichever file you have. This example assumed DHCP is provided from your wireless interface. If it is not, you can find other examples for netplan here.

  version: 2
  renderer: networkd
      dhcp4: no
      dhcp4: no
      dhcp4: yes

Change to the interface your secondary device is connected to.

Then, run sudo netplan apply to apply those changes. If you run ip a you can confirm that the bridge interface br0 exists. Now, once you connect the secondary device and enable DHCP on that device, it will obtain an IP address from the wireless router and act as any other wireless device does on the network.

The bridge is now your primary interface from your wireless router, meaning if you wanted to assign a static ip on your laptop, for example, you would need to assign it on the bridge interface, not the wireless interface.

  • Thanks! The NAT solution worked for me. Just make sure to setup DNS on the device manually.
    – orzechow
    Commented Sep 11, 2023 at 9:04

Using GUI :

Connections > Wired Connection > IPv4 > Method: Shared to other comuputers

enter image description here

More info: https://askubuntu.com/questions/359856/share-wireless-internet-connection-through-ethernet

  • 1
    Wow. Why am I surprised that this "just works"?
    – cyqsimon
    Commented Jun 12, 2023 at 7:55

Sharing Fedora wifi internet with Manjaro through ethernet. Gnome is on both sides. Everything can be done in the GUI. On server side (Fedora here) select "Shared to other computers", on client side "Automatic".

Even though it is automatic read the Details so you quickly understand what is going on. In particular the gateway or DNS is simply the server.

The netmask is not shown in GUI, it can be obtained with ifconfig.

In case of problem, check with ping then ssh (allow remote login in Sharing and manjaro password is manjaro).

Wit Mac OS sharing internet to Linux, the only thing to do is plug the cable.


Sorry if I'm late to this but the same purpose can be achieved with Fedora's default GUI (GNOME).

  1. Go to settings and search for Network tab

  2. At the top, a Wired section should be empty. Click the add button located to the left

  3. Search for the IPv4 tab and select Shared to other computers. Click on Apply once done.
    enter image description here

After that, the ethernet interface should be sharing internet to another device. In my case, I used my laptop as a router to a Windows PC, so I had to "accept" the connection from the other machine.

Note: I also disabled IPv6 in the neighbor tab of IPv4.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .