Setting Up Ubuntu for Ethernet LAN While Preserving Wifi Internet Access

From RoboJackets Wiki
Revision as of 18:32, 14 September 2018 by Mbarulic6 (talk | contribs)
Jump to navigation Jump to search

In 2018, both RoboRacing and IGVC are adding features to their robot which work through the Ethernet hardware. By default, Ubuntu prioritizes the ethernet interface over wifi. In situations where an internet connection is still desired (e.g. SSH connection to robot, pulling from remote changes on git repo onto the robot), Ubuntu can be easily configured to use ethernet for local network connections only.

Creating a LAN-only Network Interface:

  1. Open the connections editor from the network drop-down ("Edit Connections...") or launch nm-connections-editor
  2. Select the wired connection (the local one, which we don't want to use for Internet access) and click "Edit"
  3. Under IPv4 settings, change Method to "Manual"
  4. Enter any static IP (e.g. 192.168.2.1), set Netmask to 255.255.255.0 (or 24), and leave Gateway blank
  5. Select "Routes..." and enable "Use the connection only for resources on its network"
  6. Save progress and restart your networking stack: "Enable Networking" twice or nmcli n off && nmcli n on

You should now be able to both access the Internet and ping devices on your Ethernet LAN.

Adding a Second Interface for Normal Internet Usage

This is useful if you are testing on a personal laptop and sometimes like to use Ethernet like a normal person.

  1. Open the connections editor
  2. Select "Add..." and then "Ethernet"
  3. Set IPv4 Method to "Automatic (DHCP)"
  4. It should be easy to switch between the two interfaces through the network manager menu or the nmcli tool.