Ethernet Port Swap (eth0, eth1)

April 2025

Default Setup

The native Ethernet port is interface: eth0

Inserting a USB-Ethercat adapter creates interface: eth1

The goal is to swap the interface 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.

Make sure you have an IP address configured in Polyscope (Settings->System->Network)

Use ping to check connection to the robot.

$ ping <robotIPAddress>

Step 2 - Create a Script for Port Swap

On your local machine, copy the script below to a text file, and name it portswap.sh.

\#!/bin/sh
echo 'ACTION=="add", SUBSYSTEM=="net", DRIVERS=="igb", NAME="eth1"' \
    > /etc/udev/rules.d/70-persistent-net.rules
echo 'ACTION=="add", SUBSYSTEM=="net", DRIVERS=="intel-eth-pci", NAME="eth1"' \
   >> /etc/udev/rules.d/70-persistent-net.rules
echo 'ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="usb", NAME="eth%n"'\
   >> /etc/udev/rules.d/70-persistent-net.rules

Step 3 - Transfer Script to the Robot

Use scp to transfer the script to the /programs folder of the Robot.

$ scp <pathToYourScript>/portswap.sh root@<robotIPAddress>:/programs

Step 4 - Log in to the Robot

Use ssh to log in to the robot.

$ ssh root@<robotIPAddress>

Step 5 - Run Script

After login, go to /programs folder to run the script.

$ cd /programs
$ bash ./portswap.sh

The script will create a file at /etc/udev/rules.d/70-persistent-net.rules.

Step 6 - Restart the Robot

$ shutdown -r now

Your native ethernet port is now interface eth1 and should be used for EtherCAT. Your USB ethernet port is now interface 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.