Ethernet Device Swap (eth0, eth1)
October 2024
Default Setup
The native Ethernet port is device: eth0
Inserting a USB-Ethercat adapter creates device: eth1
The goal is to swap the device names so that the USB adapter is assigned eth0
and the native ethernet port is assigned eth1.
The native ethernet port provides a better physical device for ethercat communications, reducing latency and jitter.
Step 1 – Connect to the Robot
Connect an Ethernet cable (cat5e or better) to communicate with the robot over ssh.
Make sure you have an IP address configured in Polyscope (Settings->System->Network)
Use ssh
to connect to the robot.
$ ssh root@<robotIPAddress>
Step 2 - List the network devices
Insert the USB adapter into the USB 3.0 port of the control box, and run the following command.
$ ls -l /sys/class/net
lrwxrwxrwx 1 root root 0 May 14 17:56 eth0 -> ../../devices/pci0000:00/0000:00:14.0/0000:05:00.0/net/eth0/
lrwxrwxrwx 1 root root 0 May 14 18:01 eth1 -> ../../devices/pci0000:00/0000:00:15.0/usb2/2-3/2-3:2.0/net/eth1/
You can see that eth0
is assigned to the native Ethernet port eth1
is assigned to the USB Ethernet adapter.
Step 3 - Find the native Ethernet driver
Run the following command to identify the kernel driver used by the eth0 native Ethernet interface.
$ basename $(realpath /sys/class/net/eth0/device/driver)
The output should usually be igb
(for older control boxes) or intel-eth-pci
(for newer control boxes).
Step 4 - Assign the interfaces device names
Change the net generator rules to set device assignment to specific interfaces
Create or edit the file /etc/udev/rules.d/75-persistent-net-generator.rules
to have the following lines, substituting <eth0-driver-name>
for the name of the eth0
driver you found on the previous step:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="<eth0-driver-name>", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", SUBSYSTEMS=="usb", NAME="eth0"
Step 5 - Restart the UR control box
$ shutdown -r now
Your native ethernet port is now eth1
and should be used for ethercat. Your USB ethernet port is now eth0
and should be used for ssh and other TCP/IP communications.
Do not route the ethercat cable through a switch - it should be connected directly to the first EtherCAT drive on the fieldbus.
Try connecting again over ssh using same IP address.