mcx-rtos v.2022.09-4 Network settings

How to change the network settings on your controller.

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-ap.network
├── 40-bridge-device.netdev
├── 41-bridge-inherit-mac.link
├── 42-bridge-dhcp-client-and-static.network
├── 43-bridge-bind.network
├── 51-ethercat.network
└── examples
    ├── 25-wifi-ap.network
    ├── 40-bridge-device.netdev
    ├── 41-bridge-inherit-mac.link
    ├── 42-bridge-dhcp-client-and-static.network
    ├── 42-bridge-dhcp-client.network
    ├── 42-bridge-dhcp-server-and-static.network
    ├── 42-bridge-dhcp-server.network
    ├── 42-bridge-static.network
    ├── 43-bridge-bind.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 configure the wired network settings:

  • Configure default controller_ip_address (192.168.2.100)
  • Configure default wired network device (eth0)
  1. Navigate to the network directory:

    cd /etc/systemd/network
    
  2. Edit 42-bridge-dhcp-client-and-static.network:

    sudo nano 42-bridge-dhcp-client-and-static.network
    

    Displays the default configuration:

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

    This creates a br0 interface, with default ip address: 192.168.2.100/24. Change "Address=" to your preferred controller_ip_address.

  3. Edit cat 43-bridge-bind.network

    sudo nano cat 43-bridge-bind.network
    

    Displays the default configuration:

    [Match]
    Name=eth0
    
    [Network]
    Bridge=br0
    

    This binds the br0 interface to the eth0 device, per default the eth0 network device is reserved for wired network. Change "Name=" to configure the assigned network device to your own preference.

  1. Save the files and reboot your controller:

    sudo reboot
    

Now your wired network settings are changed!

EtherCAT Network Configuration

How to change the etherCAT network configuration:

  • Configure default etherCAT network device (eth1)
  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:

  • Configure default ssid (mcx-428c36)
  • Configure default psk (vectioneer)
  1. Navigate to the network directory:

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

    sudo nano 25-wifi-ap.network
    

    Displays the default configuration:

    # Wifi network settings
    [Match]
    Name=wlan0
    
    [Network]
    Address=192.168.0.1/24
    DHCPServer=yes
    
    [DHCPServer]
    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
    

Connect MCX-RTOS to the Internet

How to connect MCX-RTOS to the internet:

  • Via wired network (Use Ethernet HUB)

    image not found
  1. The default wired network settings are DHCP and static network. (42-bridge-dhcp-client-and-static.network)

  2. ssh to static controller IP ssh admin@192.168.2.100

  3. Use mcx-show-ip to find DHCP IP (br0) address:

    br0      192.168.179.83  2a02:a467:d9a9:1:201:c0ff:fe2e:8b23  fe80::1c81:e2ff:fe4e:e0b6  
    br0:0    192.168.2.100    
    eth0         
    eth1         
    wlan0    192.168.0.1  fe80::cae2:65ff:fe42:7c28  
    
  4. ssh to DHCP IP ssh admin@192.168.179.83. Now you established connection to controller with internet access.

  5. Test you connection: ping www.google.com

    PING www.google.com(ams17s12-in-x04.1e100.net (2a00:1450:400e:810::2004)) 56 data bytes
    64 bytes from ams17s12-in-x04.1e100.net (2a00:1450:400e:810::2004): icmp_seq=1 ttl=60 time=10.3 ms
    

Now your MCX-RTOS is connected to the internet.

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
    

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. Save the file and reboot your controller

    sudo reboot