Linux Network Configuration
Clearpath robots use netplan
to configure all network connections, including wired and
wireless interfaces. The netplan
package is installed on Ubuntu by default.
To edit the netplan
configuration files you will also need a text editor. The nano
and
vi
editors are included by default, but additional editors such as vim
or emacs
can
also be installed using the apt
command.
Connecting to an Existing Wi-Fi Network
Use netplan
to connect your robot to an existing wireless network.
First, determine the name of your wireless interface by running iwconfig
you should see
an entry similar to this:
wlp59s0 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=off
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
The interface name is in the left column, starting with w
.
Once you have identified your interface, edit or create a file
called /etc/netplan/60-wifi.yaml
containing the following:
network:
wifis:
MY_WIFI_INTERFACE:
optional: true
access-points:
MY_WIFI_SSID:
password: MY_WIFI_PASSWORD
dhcp4: true
with the following substitutions:
- Replace
MY_WIFI_INTERFACE
with the name of the interface you identified in the first step, e.g.wlp59s0
- Replace
MY_WIFI_SSID
with the SSID of your network. - Replace
MY_WIFI_PASSWORD
with your network's password.
For example:
network:
wifis:
wlp59s0:
optional: true
access-points:
BabCom:
password: peekaboo
dhcp4: true
This configuration will connect your robot via DHCP to your WPA2/3 wireless network. If you need to use a static IP address, modify the file to contain the following:
network:
wifis:
MY_WIFI_INTERFACE:
optional: true
access-points:
MY_WIFI_SSID:
password: MY_WIFI_PASSWORD
dhcp4: false
dhcp4-overrides:
send-hostname: true
addresses:
- MY_STATIC_IP/MY_SUBNET
nameservers:
addresses:
- MY_NAMESERVER
with the same substitutions noted earlier, plus
- Replace
MY_STATIC_IP
with the desired static IP address. - Replace
MY_SUBNET
with the length of your network's subnet mask (typically24
or16
) - Replace
MY_NAMESERVER
with the IP address of your DNS server You may add multiple DNS servers with each one on its own line.
For example:
network:
wifis:
wlp59s0:
optional: true
access-points:
BabCom:
password: peekaboo
dhcp4: false
dhcp4-overrides:
send-hostname: true
addresses:
- 10.25.0.134/16
nameservers:
addresses:
- 10.25.0.10
- 8.8.8.8
- 8.8.4.4
Once you have edited the netplan configuration file, run the following two commands:
sudo netplan --debug generate
-- this will verify that the netplan configuration files can be read properly. Correct any errors before proceeding.sudo netplan try
-- this will try running the new configuration, but will automatically roll back if it doesn't work correctly.sudo netplan apply
-- this will apply the new configuration to your network interfaces.
By convention, all Netplan configuration files should be prefixed with two numbers indicating the
order in which the file should be read. Files are read in alphanumeric order, with 00-
prefixes
first and 99-
prefixes last.
If multiple files define the same configuration, the last-read file will override the earlier definitions.
Once all files have been processed the result is amalgamated to create the system's Netplan confguration.
Standard Clearpath Bridge
The default networking configuration for a robot's computer is to bridge all Ethernet interfaces and assign the computer
the IP address 192.168.131.1
. See Reserved IP Addresses for a detailed list of IP ranges.
Changing or removing the default bridge configuration may result in your robot no longer working
properly. Certain components inside the robot rely on static IP addresses in the 192.168.131.0/24
subnet.
To configure the default bridge, create or edit /etc/netplan/50-clearpath-standard.yaml
to
contain the following:
network:
version: 2
renderer: networkd
ethernets:
bridge_enp:
match:
name: "enp*"
dhcp4: false
dhcp6: false
bridge_enx:
match:
name: "enx*"
dhcp4: false
dhcp6: false
bridge_eth:
match:
name: "eth*"
dhcp4: false
dhcp6: false
bridges:
br0:
addresses:
- "192.168.131.1/24"
dhcp4: true
dhcp6: false
interfaces:
- bridge_eth
- bridge_enx
- bridge_enp
This will bridge all physical ethernet ports together into the br0
bridge, which is assigned
the static address 192.168.131.1
. The bridge can also be used to connect to a wired DHCP
server to provide internet access to the robot.
After editing the file, run the following commands to apply the changes:
sudo netplan --debug generate
-- this will verify your netplan configuration files and notify you if there are errors. Correct any errors before proceeding.sudo netplan try
-- this will try running the new configuration, but will automatically roll back if it doesn't work correctly.sudo netplan apply
-- this will apply the new configuration. Note that if you are logged in over SSH from a remote computer you may lose your SSH connection if the active interface was modified.
Determining the robot's IP address
The robot's main computer can have several IP addresses for different connections. The robot will
always have a static address on its internal network of 192.168.131.1
with a netmask of 255.255.255.0
(24 bits).
If your robot has a wireless base-station or long-range wireless radio integrated into it, these
are considered part of the robot's internal network. When connected to the base-station you can
log into the robot via its 192.168.131.1
IP address.
The robot's wired interface may also be connected to an external DHCP source to provide wired internet access, and the robot can be connected over Wi-Fi. To determine the robot's DHCP address, you must either
- Log into your router and look up the current DCHP assignments. This process will vary from vendor-to-vendor, so refer to your router's manual for instructions on how to do this.
- Log into the robot via its static
192.168.131.1
address and run the commandip a
Interpreting ip a
output
The ip a
command produces a lot of output, and can be difficult to understand if you aren't
familiar with it.
Sample Output
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
link/ether 12:23:34:45:56:67 brd ff:ff:ff:ff:ff:ff
3: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
link/ether 12:34:56:78:90:ab brd ff:ff:ff:ff:ff:ff
4: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff
inet 192.168.131.1/24 brd 192.168.131.255 scope global br0
valid_lft forever preferred_lft forever
inet 10.0.100.42/16 metric 100 brd 10.0.255.255 scope global dynamic br0
valid_lft 79814sec preferred_lft 79814sec
inet6 1234::1234:5678:90ab:cdef/64 scope link
valid_lft forever preferred_lft forever
5: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 70:1a:b8:2b:0b:b0 brd ff:ff:ff:ff:ff:ff
inet 10.0.200.101/16 brd 10.0.255.255 scope global wlp2s0
valid_lft forever preferred_lft forever
inet6 1234::1122:3344:5566:7788/64 scope link
valid_lft forever preferred_lft forever
6: vcan0: <NOARP,UP,LOWER_UP> mtu 16 qdisc pfifo_fast state UP group default qlen 100
link/can
7: vcan1: <NOARP,UP,LOWER_UP> mtu 16 qdisc pfifo_fast state UP group default qlen 1000
link/can
Note: MAC addresses have been redacted in the sample above
Each numbered item (1
to 7
in the example above) corresponds to a network interface. Each
interface that has an active connection will have an entry of the form inet aaa.bbb.ccc.ddd/ee
indicating its IP address. Some interfaces, such as the bridge interface described above, may
have more than one address.
The items of note are:
br0
: The Clearpath bridge interface. It will always have theinet 192.168.131.1/24
address, denoting its static address on the internal network. In this example it is also connected to a wireless DHCP source, giving it the address10.0.100.42/16
.wlp2s0
: the robot's wireless interface (the wireless interface will always start withw
). In in this example the robot is connected to a wireless network with the address10.0.200.101/16
.