My desktop with Ubuntu 16.04 has no wifi but has an ethernet connection.

My laptop with Ubuntu 17.x has Wifi.

I've bought a crossover cable which has been checked and works.


Has IP address of

Desktop with Ethernet

Wired Connection set under Ipv4 Settings with manual connection (method) to: with gateway Automatically connect to this network when available is checked.

Interface: name is eth0


Wifi connection set to automatic DHCP and assigned

I've tried setting this to "Shared to other computers" but then the interface isn't even assigned an IP. Pinging from desktop fails.

I've tried setting this to manual and entering and then I can ping it once I've reset the network manager but that's it. At least the ethernet connection now has an IP.

Interface: name for ethernet is enp14s0,wifi name is wlp7s0

I've tried following every other question and answer tutorial I can find and none of them work the way they're supposed to. All I wish to do is use the internet connection from a laptop on the desktop via an ethernet crossover.

Any help appreciated


First of all, use a different subnet for the LAN.

Desktop: Notebook LAN:

On the desktop configure your notebooks LAN ip address to be the default gateway.

On the notebook, enable IP forwarding:

echo 1 > /proc/sys/net/ipv4/ip_forward

You will need to edit /etc/sysctl.conf and change the line that says net.ipv4.ip_forward = 0 to net.ipv4.ip_forward = 1 to make this change permanent.

On the notebook, configure NAT for traffic coming in via the LAN interface (lets call it enp14s0) to go out via the wifi interface (lets call it wlp7s0)

/sbin/iptables -t nat -A POSTROUTING -o wlp7s0 -j MASQUERADE
/sbin/iptables -A FORWARD -i wlp7s0 -o enp14s0 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i enp14s0 -o wlp7s0 -j ACCEPT

That should do the trick.

|improve this answer|||||
  • thanks for reply. what should gateway be for notebook in this case? – user3168961 Jul 29 '17 at 12:46
  • the notebook uses the wifi access point (or the router behind it if they are separate) as its default gateway.. don't change that. It should be automatically set when you connect to the wifi. – neuhaus Jul 29 '17 at 13:13
  • sorry i mean the enp14s0 gateway. my wifi is set using DHCP but I'm setting Wired connection manually in the network manager. In IPv4Settings I've added an IP 192..2.1, 24 mask but it disables the save button whenever I try to enter a gateway value either router ip, same ip... in fact any ip. – user3168961 Jul 29 '17 at 13:23
  • there is no default gateway on the LAN interface of the notebook. Just the network route for the subnet with netmask – neuhaus Jul 29 '17 at 13:48

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.