5

I've in the past successfully set sharing of wireless Internet connection through Ethernet on Ubuntu 16.04 as described here. Unfortunately due to disk failure I install Ubuntu 18.04 LTS and cannot find anything similar to what is described in mentioned post. All menus are now different and I don't know where to look.

prasimix
  • 133

3 Answers3

11

Follows these steps:

  1. Open nm-connection-editor from the terminal

    nm-connection-editor
    
  2. Click on the wired connection and select edit cog wheel below

    enter image description here

  3. Go to the ipv4 settings tab there in the Method select Shared to Other Computers

    enter image description here

Source:

https://www.crookm.com/journal/2018/sharing-wifi-connection-over-ethernet/

George Udosen
  • 36,677
  • Do you also need to install dnsmasq as a dhcp server for the ethernet client? – heynnema Dec 26 '18 at 17:38
  • 1
    Not according to this article https://help.ubuntu.com/community/Internet/ConnectionSharing – George Udosen Dec 26 '18 at 19:27
  • Your link... under Advanced Gateway Configuration... re:dnsmasq...

    Advanced configurations include DHCP server and DNS server. A DHCP server allows the client to get an IP address automatically without having to manually configure a static IP. A DNS server allows the client to resolve Internet host names without manually configuring DNS addresses.

    – heynnema Dec 26 '18 at 19:33
  • Keep in mind, that with dnsmasq AND systemd-resolved installed at the SAME time, adjustments need to be made on systemd-resolved so it can co-exist nicely. – heynnema Dec 26 '18 at 19:35
  • I know what a DHCP server and what a DNS server do but I don't see the usefulness of setting up both just to share my internet with another computer! – George Udosen Dec 26 '18 at 19:41
  • Sorry, the earlier comment was just text copied directly out of your link... Didn't mean to offend. Anyway... either it's setup static IP/DNS addresses on the client... and hope they don't conflict with existing IP/DNS addresses already in use... or use something like dnsmasq to assign IP/DNS addresses. – heynnema Dec 26 '18 at 19:49
  • The other computer is a machine trying to install Windows 10, and after this change it says "Unidentified network - No internet". – Michael Aug 05 '22 at 17:25
0

I recently needed to do this in a terminal environment.

The main reason being nm-connection-editor will not open on manjaro running on a pinephone.

After much looking and words with Jesus, I was given: https://fedoramagazine.org/internet-connection-sharing-networkmanager/

Which for my needs of sharing over "eth0" produced:

"nmcli connection add type ethernet ifname eth0 ipv4.method shared con-name local"

Since my desktop was already configuring for what I can only guess is some sort of ubuntu-ish default for this sort of thing, the wireless connection was shared and I immediately gained internet connectivity on my desktop.

IPv4 10.42.0.142 subnetmask 255.255.255.0 gateway 10.42.0.1

This information can of course be found on the device sharing the connection with: "ip address show" then look for the interface you are sharing, in my case it is "6: eth0". The gateway information was 2-3 lines below.

hazlin
  • 1
0

Here is a way to do it with no client config:

Assumptions:

  • wlan0 is the wifi you want to share to a computer connected via ethernet
  • eth0 is the ethernet adapter that the client computer is connected to
  • you have dnsmasq installed via sudo apt install dnsmasq for now stop the service with systemctl stop dnsmasq
  1. Start with assigning an ip to the ethernet, do not use networkmanager GUI as this creates a conflict in dnsmasq sudo ip addr add 10.42.0.1/24 dev eth0
  2. First sudo nano /etc/dnsmasq.conf then add interface=eth0 dhcp-range=10.42.0.50,10.42.0.100,12h server=8.8.8.8 bind-interfaces domain-needed bogus-priv no-dhcp-interface=wlan0
  3. Then start dnsmasq systemctl start dnsmasq
  4. Open sudo nano /etc/sysctl.conf and uncomment the line net.ipv4.ip_forward=1
  5. Finally sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
  6. iptables from here sudo iptables -A FORWARD -o wlan0 -i eth0 -s 10.42.0.0/24 -m conntrack --ctstate NEW -j ACCEPT sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT sudo iptables -t nat -F POSTROUTING sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE `
  7. Save sudo iptables-save | sudo tee /etc/iptables.sav
  8. edit or create /etc/rc.local and add iptables-restore < /etc/iptables.sav before exit0
  9. run sudo iptables-restore < /etc/iptables.sav and make sure there are no errors
  10. you should have an established connection with internet working on the client
yknot
  • 1