0

There is currently only WiFi at my place, but I have a PC (running Ubuntu 16.04) with no card for WiFi built in. I also have a laptop (Ubuntu 16.04 + Windows 7) that has WiFi and a LAN cable. What I want is to get internet on my PC from the laptop's WiFi via the LAN cable. I found instructions for Ubuntu 14.04 here (from the most upvoted answer), followed the steps but it didn't; hope that someone can help. Steps that I did so far:

1) Connected laptop and PC via cable.

2) On the laptop, typed nm-connection-editor in the terminal, chose 'Wired Connection', clicked on 'Edit' and then selected 'Shared to other computers' as 'Method' under the IPv4 Settings. Typing hostname -I in the laptop's terminal gave 10.42.0.1 192.168.1.97. (I assumed that the first one is the my IP address as viewed from the outside and the second one is the internal for the network with my PC.)

3) Typing hostname -I in a terminal on the PC gives only 192.168.1.1. I followed the instructions from the first answer in the link also on the PC, i.e., went to 'Wired Connections', selected 'IPv4 Settings', chose 'Manual' under 'Method', then entered 192.168.1.1 under 'Address', 255.255.255.0 under 'Netmask' and 192.168.1.97 under 'Gateway'. In the field for 'DNS servers' I also put 192.168.1.97.

However, after saving the settings there is still no internet on my PC. Can anyone help? What am I doing wrong?

Update #1:

dpkg -l *dnsmasq* (laptop and PC) gives: 
un dnsmasq <none> <none> (no description available) 
ii dnsmasq-base 2.75-1ubuntu0.1.04 amd64 Small caching DNS proxy and DHCP/TFTP server

Update #2:

Now it works! I don't know why but when I started the PC today and connected it to the laptop, it had internet. I haven't changed anything in the settings. Perhaps the system just needed to be restarted. Thanks a lot!

  • Glad it's working for you now! Is it now configured like my answer, or something else? – heynnema Feb 18 '19 at 21:30
  • Yes, pretty much the same: 'Method' is set to 'Manual', 'Address' is 10.42.0.2, 'Netmask' is 24 and 'Gateway' is 10.42.0.1. Under 'DNS servers' I put the same as under 'Gateway'. Perhaps it would also work if I would set 'Method' as 'Authomatic (DHCP)' but I haven't tried it - I simply don't want to mess with something that is working just fine now. – Ubuntu_fan Feb 25 '19 at 23:34
  • No, leave it set to manual with those addresses you used. – heynnema Feb 25 '19 at 23:36

1 Answers1

0

In the terminal...

dpkg -l *dnsmasq* # looking for dnsmasq-base

un dnsmasq <none> <none> (no description available) 
ii dnsmasq-base 2.75-1ubuntu0.1.04 amd64 Small caching DNS proxy and DHCP/TFTP server

Look for dnsmasq-base as the only installed dnsmasq anything. It should be status "ii". If you don't see it, then:

sudo apt update # update the software database

sudo apt install dnsmasq-base # install dnsmasq-base


Set up the laptop as you have before...

On the laptop, typed nm-connection-editor in the terminal, chose 
'Wired Connection', clicked on 'Edit' and then selected 'Shared 
to other computers' as 'Method' under the IPv4 Settings.

Set up the PC with an ethernet connection set to DHCP (not manual).

Connect the ethernet cable and it should work.


If for some reason DHCP doesn't work, try a manual connection profile, with:

address = 10.42.0.2/24

gateway = 10.42.0.1

Retry connection.

heynnema
  • 70,711
  • Thank you for trying to help. Unfortunately, it didn't work.

    Command dpkg -l *dnsmasq* (laptop and PC) gives (last two lines): `un dnsmasq (no description available)

    ii dnsmasq-base 2.75-1ubuntu0.1.04 amd64 Small caching DNS proxy and DHCP/TFTP server`

    I tried both options with DHCP but none worked. Interestingly, when I ping 192.168.1.1 I get decent response times. However, doing ping 192.168.1.97 on my PC gives Destination Host Unreachable. Any ideas?

    – Ubuntu_fan Feb 17 '19 at 19:49
  • With the configuration set up as in the first part of my answer (DHCP, not manual) screenshot the IPv4 tabs of both machines. Also show me ip addr and hostname -I on both machines. Edit this info into your question, not into comments, please. Ping me at @heynnema when you have done this. – heynnema Feb 17 '19 at 23:17