Network settings

How to change the network settings on your controller.

Network adapter configuration

First log in to the controller. Either by connecting a keyboard and screen to the controller or logging in through ssh as explained in Remote Access and file transfer.


Network settings within MCX-RTOS 2022.9 or newer can be found in the path:

/etc/systemd/network
├── 25-wifi.network
├── 50-wired.network
├── 51-ethercat.network
└── examples
    ├── 25-wifi-ap.network
    ├── 50-wired-dhcp-client-and-static.network
    ├── 50-wired-dhcp-client.network
    ├── 50-wired-dhcp-server-and-static.network
    ├── 50-wired-dhcp-server.network
    ├── 50-wired-static.network
    └── 51-ethercat.network

Inside the network folder you can edit your network settings. For the ease of use, you can copy a example .network file in the examples folder and past/edit it in the network folder. Recommended is to not edit the examples in the examples folder so you can always use them as a template. For more information about network settings refer to Systemd.network.

Wired Network Configuration

  1. Navigate to the network configuration folder:

    cd /etc/systemd/network
    
  2. Edit the file 50-wired.network:

    sudo nano 50-wired.network
    

    This is the default configuration for the wired network:

    # Wired network settings
    [Match]
    Name=eth0
    
    [Network]
    DHCP=yes
    ConfigureWithoutCarrier=yes
    IgnoreCarrierLoss=yes
    
    [Address]
    Label=eth0:0
    Address=192.168.2.100/24
    
    

    You can change the static IP address to what you prefer.

  3. Save the file and reboot motorcortex:

    sudo reboot
    

Now your wired network settings are changed!

Reserving a network device for EtherCAT

  1. Navigate to the network configuration folder:

    cd /etc/systemd/network
    
  2. edit the file 51-ethercat.network:

    Sudo nano 51-ethercat.network
    

    This is the default configuration for the etherCAT network:

    # EtherCat network settings
    [Match]
    Name=eth1
    
    [Network]
    LinkLocalAddressing=no
    IPv6AcceptRA=no
    ConfigureWithoutCarrier=yes
    
    #[Link]
    #Unmanaged=yes
    

    Here we reserve device eth1 for etherCAT and make sure it does not get attached to a regular network driver.

  3. Save the file and reboot motorcortex:

    sudo reboot
    
  4. Configure the EtherCAT driver to use the correct network device: EtherCAT Device Configuration.

WiFi Configuration

  1. Navigate to the network configuration folder:

    cd /etc/systemd/network
    
  2. Edit the file 25-wifi.network:

    sudo nano 25-wifi.network 
    

    This is the default configuration for the etherCAT network:

    # Wifi network settings
    [Match]
    Name=wlan0
    
    [Network]
    Address=192.168.0.1/24
    DHCPServer=yes
    
    PoolOffset          = 10
    PoolSize            = 40
    EmitDNS             = yes
    DNS                 = 8.8.8.8 8.8.4.4
    DefaultLeaseTimeSec = 600
    MaxLeaseTimeSec     = 7200   
    
  3. Change the security setting of your WiFi (only available, if your controller contains WiFi-module):

    sudo nano /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
    

    By default the WiFi connection is configured as an Access Point to which an external system can connect using the default passphrase “vectioneer”. The default configuration is shown below.

    network={
        ssid="mcx-428c36"
        #psk="vectioneer"
        psk=373b4c981c2b7c30be346d560b6a7f04c313e7c66e841915db053d9d61a21bd7
        mode=2
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        group=CCMP
        frequency=2437
    }
    

    You can change the SSID by modifying the ssid field. You can enter a new passphrase by either putting the literal passphrase (readable) in quotes:

      psk="mynewpassword"
    

    Or you can generate a password hash by using the wpa_passphrase tool:

    wpa_passphrase {SSID} {NEWPASSPHRASE}
    

    This outputs a new hashed passphrase section that you can transfer into your configuration file.

  4. Save the file and reload the network settings:

    sudo systemctl restart networking
    

EtherCAT Device Configuration

The EtherCAT master needs to know which card it will use for EtherCAT. The EtherCAT network card should not be configured for normal networking.

  1. Change the EtherCAT network settings:

    sudo nano /etc/ethercat.conf
    

    The important settings in this file are which network adapter to use and which driver to use. Make sure that the network device that you wish to assign to the EtherCAT driver is not already taken by the normal network configuration (see network-adapter-configuration).

  2. You can select your network adapter by modifying the following line:

    MASTER0_DEVICE="eth1"
    
  3. To select the driver type, change the line:

    DEVICE_MODULES="generic"
    

Refer to the EtherLAB documentation for a description of all available configuration options.


Network settings within MCX-RTOS 2022.3 can be found in the path:

/etc/systemd/network
├── 10-igb-quirks.link
├── 25-wifi.network
├── 50-wired.network
└── 51-ethercat.network

Wired Network Configuration

  1. Navigate to the network configuration folder:

    cd /etc/systemd/network
    
  2. Edit the file 50-wired.network:

    sudo nano 50-wired.network
    

    This is the default configuration for the wired network:

    # Wired network settings
    [Match]
    Name=eth0
    
    [Network]
    DHCP=yes
    IPForward=yes
    
    [Address]
    Label=eth0:0
    Address=192.168.2.100/24
    

    This configuration tries to configure a connection with DHCP and in case there is no DHCP server on your network it configures a static IP.

    You can change the static IP address to what you prefer.

    Note that if you change the interface (something other than eth0) also make sure you check the configuration of the etherCAT port such that there are no conflicting settings.

  3. Save the file and reboot motorcortex:

    sudo reboot
    

Now your wired network settings are changed!

Reserving a network device for EtherCAT

The network device that is used for etherCAT must be configured as unmanaged such that the regular network driver do not claim the device.

  1. Navigate to the network configuration folder:

    cd /etc/systemd/network
    
  2. Edit the file 51-ethercat.network:

    sudo nano 51-ethercat.network
    

    This is the default configuration for the etherCAT network:

    # EtherCat network settings
    [Match]
    Name=eth1
    
    [Link]
    Unmanaged=yes
    

    Here we reserve device eth1 for etherCAT and make sure it does not get attached to a regular network driver.

  3. Save the file and reboot motorcortex:

    sudo reboot
    
  4. Configure the EtherCAT driver to use the correct network device: EtherCAT Device Configuration.

WiFi Configuration

  1. Navigate to the network configuration folder:

    cd /etc/systemd/network
    
  2. Edit the file 25-wifi.network:

    sudo nano 25-wifi.network 
    

    This is the default configuration for the etherCAT network:

    # Wifi network settings
    [Match]
    Name=wlan0
    
    [Network]
    Address=192.168.0.1/24
    DHCPServer=yes
    
    PoolOffset          = 10
    PoolSize            = 40
    EmitDNS             = yes
    DNS                 = 8.8.8.8 8.8.4.4
    DefaultLeaseTimeSec = 600
    MaxLeaseTimeSec     = 7200   
    
  3. Change the security setting of your WiFi:

    sudo nano /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
    

    By default the WiFi connection is configured as an Access Point to which an external system can connect using the default passphrase “vectioneer”. The default configuration is shown below.

    network={
        ssid="mcx-428c36"
        #psk="vectioneer"
        psk=373b4c981c2b7c30be346d560b6a7f04c313e7c66e841915db053d9d61a21bd7
        mode=2
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        group=CCMP
        frequency=2437
    }
    

    You can change the SSID by modifying the ssid field. You can enter a new passphrase by either putting the literal passphrase (readable) in quotes:

      psk="mynewpassword"
    

    Or you can generate a password hash by using the wpa_passphrase tool:

    wpa_passphrase {SSID} {NEWPASSPHRASE}
    

    This outputs a new hashed passphrase section that you can transfer into your configuration file.

  4. Save the file and reboot motorcortex:

    sudo reboot
    

EtherCAT Device Configuration

The EtherCAT master needs to know which card it will use for EtherCAT. The EtherCAT network card should not be configured for normal networking.

  1. Change the EtherCAT network settings:

    sudo nano /etc/ethercat.conf
    

    The important settings in this file are which network adapter to use and which driver to use. Make sure that the network device that you wish to assign to the EtherCAT driver is not already taken by the normal network configuration (see network-adapter-configuration).

  2. You can select your network adapter by modifying the following line:

    MASTER0_DEVICE="eth1"
    
  3. To select the driver type, change the line:

    DEVICE_MODULES="generic"
    

Refer to the EtherLAB documentation for a description of all available configuration options.


  1. Go open the interfaces file:

    sudo nano /etc/network/interfaces
    
  2. In the file find this selection of text:

    # Wired or wireless interfaces
    auto eth0
    iface eth0 inet static
        address 192.168.2.100
        netmask 255.255.255.0
        gateway 192.168.2.100
    
  3. Change the address and the gateway to the desired values. Or switch the interface to DHCP if you connect the controller to a router:

    # Wired or wireless interfaces
    auto eth0
    iface eth0 inet dhcp
    
  4. Safe the file and reboot motorcortex:

sudo reboot

Now your wired network settings are changed!

Renew the security certificate after a change of IP or hostname settings

It is possible that due to the network change the communication certificate has become invalid. For security reasons, the certificate is only valid for the ip address and hostname of the controller. MCX-Linux OS provides a certificate renewal service that checks the certificate and renews it if either it has expired or if the host name or ip address has changed. To renew the certificate, either reboot the controller or restart the cert-gen service:

sudo /etc/init.d/cert-gen restart

Optionally, you can modify the certificate settings by modifying the cert-gen config file:

sudo nano /usr/share/cert-gen/config.json

After your modification restart the service to generate the new certificate.

EtherCAT Device Configuration

The EtherCAT master needs to know which card it will use for EtherCAT. The EtherCAT network card should not be configured for normal networking.

To change the EtherCAT network settings do:

sudo nano /etc/ethercat.conf

The important settings in this file are which network adapter to use and which driver to use. Make sure that the network device that you wish to assign to the EtherCAT driver is not already taken by the normal network configuration, it should be configured as “unmanaged” (see network-adapter-configuration ). ).

You can select your network adapter by modifying the following line:

MASTER0_DEVICE="eth1"

To select the driver type, change the line:

DEVICE_MODULES="generic"

Refer to the EtherLAB documentation for a description of all available configuration options.

Changing the Host Name

  1. If you want to modify the system’s hostname you can change it by modifying

    sudo nano /etc/hostname
    

    and

    sudo nano /etc/hosts
    
  2. Reboot motorcortex to apply the new host name:

    sudo reboot