mcx-rtos v.2022.09 Network Configuration

How to change the network configuration on your controller for MCX-OS image v.2022.09.

Network Configuration

This section describes how to configure your wifi, wired or etherCAT network.

Network Directory

Default network files are stored in the following directory:

/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

The network directory displays the default network configuration for WiFi, Wired and EtherCAT. The examples folder provides a set of predefined network settings, based on Systemd.network.

Wired Network Configuration

How to change the wired network settings:

  1. Navigate to the network directory:

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

    sudo nano 50-wired.network
    

    Displays the default configuration:

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

    Per default the eth0 network device is reserved for wired network. This configuration tries to configure connection with DHCP and in case there is no DHCP server on your network it configures a static IP (192.168.2.100/24).

  1. Save the file and reboot your controller:

    sudo reboot
    

Now your wired network settings are changed!

EtherCAT Network Configuration

How to change the etherCAT network configuration:

  1. Navigate to the network directory:

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

    sudo nano 51-ethercat.network
    

    Displays the default configuration:

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

    Per default the eth1 network device is reserved for etherCAT. You can change the network device assigned to etherCAT network to your own preference.

  1. Save the file and reboot your controller:

    sudo reboot
    

WiFi Configuration

How to change the wifi configuration:

  1. Navigate to the network directory:

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

    sudo nano 25-wifi.network 
    

    Displays the default configuration:

    # 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 reboot your controller:

     sudo reboot
    

EtherCAT Master Configuration

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


Make changes to the default mcx-rtos etherCAT configuration:

  1. Open ethercat.conf in edit mode:

    sudo nano /etc/ethercat.conf
    
  1. Modify the network device by changing the following line:

    MASTER0_DEVICE="eth1"
    

    The configured MASTERO_DEVICE, needs to match the configured network device in the EtherCAT Network Configuration.

  2. Modify the driver type by changing the following line:

    DEVICE_MODULES="generic"
    

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

  1. Save the file and reboot your controller:

    sudo reboot
    

Configure etherCAT for CX5140:

  1. Open ethercat.conf in edit mode:

    sudo nano /etc/ethercat.conf
    
  1. Change the default MASTERO_DEVICE:"eth1" to registered ccat_netdev network device:
MASTER0_DEVICE="eth2"

The configured MASTERO_DEVICE, needs to match the configured network device in the EtherCAT Network Configuration.

  1. Save the file and reboot your controller:

    sudo reboot