iCub networking
The networking on icub can be divided in two parts:
- internal (motor) networking : it is a network that connects to icub-head and all the motor controller boards on the robot, it is a segregated network (there is no connection from the nodes on its subnet and the ouside world) and it is used to send motor commands from icub-head to motor control boards
- extenal networking : it is the network connection that connects icub-head to the robot private subnet; it is used to connect the robot to the other machines in its enviroments, to the icub-server and to internet; this connection cam wired or wireless
It isa also available a bluetooth connection on the icub-head, but it currently used only to read data from the battery controller in the robot backpack.
The iCub private subnet
The icub private subnet is the subnnet that connects all the machines in the robot enmviroment, see the schema below
icub-head network interfaces
On recent icub-head hardware there are 4 network interfaces:
- external cabled network - used to connect the icub-head to other machines in its enviroment, wired
- internal motor network - used to connect the icub-head to the onboard motor controllers
- external wireless network - used to connect the icub-head to other machines in its enviroment, wireless
- bluetooth interface - used to connect the icub-head to the battery controller
IP addresses and other network configurations
Below you can find the default network paramenters of the the main icub-head network (external and motor).
Motor network configurations
This configuration depends deeply from the motor control board firware and thus it can't be changed
- IP address : 10.0.1.104 - STATIC
- Netmask : 255.255.255.0
since this is a segregated network, there is no default gateway.
External network configurations
Usually it is a static configuration, but it works also in DHCP mode. This configuration can be changed but it is not recommended
- IP address : 10.0.0.2
- Netmask : 255.255.255.0
- Default Gateway : 10.0.0.1
- DNS server : 10.0.0.1
Networking implementation in iCubOS
Basic principles
The basic idea is that to setup a network bonding in active-passive mode with network and wifi connections, and the network has the role of master connection. So, if the network cable is connected to the robot, the traffic to icub-head passes through the cabled connection otherwise the system uses the wifi, but the connection keeps the same IP address. The switch is generally quite fast (couple of seconds), so we don't lose ssh connections to icub-head
Netplan
Latest Ubuntu makes use of NETPLAN to configure the network via command line. Therefore, we set up netplan
to create the above network bonding. Netplan
relies on the configuration files found in the path:
/etc/netplan/
At startup, netplan
loads all files in the above path with the .yaml
extension.
This behavior can be used to create several configurations to choose from.
To this end, we stored several files in the /etc/netplan
path on icub-head
, as follows:
50-icub-static.yaml.notload
: to use STATIC IP for cabled network configuration (no bonding, no wifi - THIS IS THE DEFAULT ).50-icub-dhcp.yaml.notload
: to get IP for cabled network configuration from DHCP server (no bonding, no wifi).50-icub-bonding-static.yaml.notload
: to create a bonding with cabled network and WiFi and use a static IP for the bonded connection.50-icub-bonding-dhcp.yaml.notload
: to create a bonding with cabled network and WiFi and get the IP for the bonded connection from DHCP server.
To enable one specific configuration, we rely on the following symbolic link:
50-icub.yaml
: pointing to the active configuration (see section below).
How to switch among netplan
configurations
To check what configuration variant is actually symlinked, do:
cd /etc/netplan
ls -la
To switch among the available netplan
configurations, it suffices to update the symbolic link:
cd /etc/netplan
sudo ln -fs <variant_that_you_actually_want_to_use>.yaml.notload 50-icub.yaml
Required configuration
There are some parameters that must be configured on each icub-head installation because they are hardware dependant (network interfaces names) or user-dependant (Wifi configuration)
Network interfaces names
The names assigned to the network interfaces by the OS are hardware dependant, so on each new installation you must check that the name of the interfaces (internal, motor and wifi) written in the file /etc/netplan\50-icub.yaml
corresponds to the actual ones, shown by the commmand
ip link
WiFi
If wifi is used (see above), please change the Wifi configuration in the file /etc/netplan\50-icub.yaml
with your ESSID and WiFi password in the lines below
wifis:
...
access-points:
"please-put-your-ESSID-here":
password: "please-put-your-wifi-password-here"