Setting Up Ubuntu for Ethernet LAN While Preserving Wifi Internet Access
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:
- Open the connections editor from the network drop-down ("Edit Connections...") or launch
- Select the wired connection (the local one, which we don't want to use for Internet access) and click "Edit"
- Under IPv4 settings, change Method to "Manual"
- Enter any static IP (e.g. 192.168.2.1), set Netmask to 255.255.255.0 (or 24), and leave Gateway blank
- Select "Routes..." and enable "Use the connection only for resources on its network"
- 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.
- Open the connections editor
- Select "Add..." and then "Ethernet"
- Set IPv4 Method to "Automatic (DHCP)"
- It should be easy to switch between the two interfaces through the network manager menu or the