Read more

Ubuntu: Share internet connections with other computers

Tobias Kraze
July 06, 2017Software engineer at makandra GmbH

You can configure a Ubuntu system as a gateway in order to share it's internet connection (maybe via WLAN or tethering) with other computers on the network.

On the gateway

  • Enable ip traffic forwarding:
    • Open /etc/sysctl.conf

    • Uncomment the line

      net.ipv4.ip_forward=1
      
    • Reload using sudo sysctl -p /etc/sysctl.conf

  • Reconfigure ip_tables to allow NAT:
    • Download the attached file
    • Replace online_device with the name of the network device that provides the internet connection
    • Replace lan_device with the name of the network device that connects to the LAN
    • Run the script with sudo

On the client PC

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

Add the gateway PC as the default gateway using

sudo ip route del default
sudo ip route add default via <ip of gateway pc>

Add another DNS server to /etc/resolv.conf, for example

nameserver 8.8.8.8
Posted by Tobias Kraze to makandra dev (2017-07-06 12:23)