Skip to content

Network Interfaces

The ModuCop Edge Computer MEC01/02 provides several network interfaces to connect to the outside world. This section describes how to use these interfaces.

Ethernet

ModuCop provides two Ethernet interfaces, labelled ETH1 and ETH2 on the front panel.

Warning

In some variants of the ModuCop, the ETH2 interface is not populated.

Both are 1Gbit Ethernet interfaces, which can be used to connect to a network switch or router. The interfaces are configured via NetworkManager, which is the default network management tool in the ModuCop Yocto BSP.

The interface names in linux are:

  • end0 for ETH1
  • enp5s0 for ETH2

The default configurations are:

Interface Configuration
ETH1 DHCP
ETH2 Fixed IP: 192.168.25.99/24

If you don't want the fixed IP configuration for ETH2, you can just delete the configuration for it.

rm /etc/NetworkManager/system-connections/eth2.connection

Afterwards, it will be configured via DHCP like ETH1.

See also the Quickstart Guide for more examples.

WiFi

The ModuCop provides a WiFi interface, which is supporting both 2.4GHz and 5GHz bands. It can operate in both client and access point mode, even simultaneously.

Antenna configuration

On the MEC01/02 front, you see two antenna connectors, labelled WLAN1 and WLAN2. These are the antenna connectors for the WiFi interface. You can use either one or both of them, depending on your use case.

By default, both antenna connectors are enabled. However, if you only want to use one antenna (WLAN1), you must configure the WiFi interface accordingly. In this case, call

iw phy phy0 set antenna 0x1 0x1

Warning

This setting is not persistent across reboots, so you may want to add it to a systemd service or script that runs at boot time.

Warning

If you use only one antenna and you do not set the antenna configuration, the WiFi interface will still work, but it may not perform optimally.

Display available WiFi networks

To list all available WiFi networks, you can use the nmcli command:

nmcli --colors no dev wifi list

This will show you a list of all available WiFi networks, including their SSID, signal strength, and security type.

Info

The --colors no option disables colored output, which works around an issue with the busybox shell. You should use this option every time you use nmcli in the ModuCop Yocto BSP.

Connect to a WiFi network (Client Mode)

The network interface for client mode is called mlan0. To connect to a WiFi network, you can use the nmcli command:

nmcli -a device wifi connect your-ssid
Password: **************
Device 'mlan0' successfully activated with '50cf3ec8-fe0a-40cb-8f55-4e2d17ce7d2d

Now you should be able to ping a host on the Wi-Fi network, for example:

ping <host-ip> -I mlan0

Disconnect from a WiFi network

nmcli device disconnect mlan0

Configure WiFi in Access Point Mode

This section describes how to configure a Wi-Fi Access Point (AP) using hostapd. It also covers optional configuration steps for enabling traffic forwarding (shared AP mode).

1. Marking the Wi-Fi Interface as Unmanaged by NetworkManager

To ensure that the AP interface uap0 can be used reliably by hostapd, it must be marked as unmanaged by NetworkManager.

Create the file /etc/NetworkManager/conf.d/uap0-unmanaged.conf with the following content:

[keyfile]
unmanaged-devices=interface_name:uap0;

This prevents NetworkManager from attempting to configure or manage the uap0 interface.

2. Enabling hostapd at System Startup

Create a systemd service to automatically start hostapd when the system boots and when the uap0 device becomes available.

Create the file /etc/systemd/system/network.target.wants/hostapd-example.service with the following content:

[Unit]
Description=Activate Wireless Access Point
BindsTo=sys-subsystem-net-devices-uap0.device
After=sys-subsystem-net-devices-uap0.device

[Service]
Type=forking
PIDFile=/run/hostapd.pid
ExecStart=/usr/sbin/hostapd /etc/hostapd-tdx-demo-img.conf -P /run/hostapd.pid -B

[Install]
WantedBy=multi-user.target

3. Access Point Configuration

3.1 SSID and Password

To adjust the Wi-Fi name (SSID) and password, edit the hostapd configuration file /etc/hostapd-tdx-demo-img.conf:

interface=uap0
ssid=testwifi
hw_mode=g
channel=9
ieee80211n=1
own_ip_addr=192.168.8.1
wpa=2
wpa_passphrase=testwifipw

Modify ssid and wpa_passphrase according to your requirements.

3.2 DHCP

The configuration in /etc/hostapd-tdx-demo-img.conf contains the IP Address own_ip_addr of the Access Point interface uap0. Be aware that the networkd is configured to work with this IP Address and runs the DHCP-Server for the Access Point. It is possible to modify the own_ip_addr, for that you will also need to add a new networkd configuration file /etc/systemd/network/hostapd-example.network:

[Match]
Name=uap0
[Network]
Address=<IP Address>/<Subnetmask>
DHCPServer=yes

The <IP Address> has to be the same as own_ip_addr.

4. Enabling Shared Access Point Mode (Optional)

If the AP should share the upstream network available on end0, IP forwarding and NAT must be enabled.

4.1 Enable IP Forwarding

Create /etc/sysctl.d/30-ipforward.conf with:

net.ipv4.ip_forward=1
net.ipv6.conf.default.forwarding=1
net.ipv6.conf.all.forwarding=1

4.2 Apply iptables Rules

Execute:

iptables -t nat -A POSTROUTING -o end0 -j MASQUERADE
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i uap0 -o end0 -j ACCEPT

4.3 Persist iptables Rules

Save the configuration:

iptables-save > /etc/iptables/iptables.rules

5. Final Step

Reboot the device:

reboot

After rebooting, the Access Point should be operational.

Cellular

Most models of the ModuCop Edge Computer MEC01/02 are equipped with a cellular modem, which can be used to connect to a mobile network. The cellular modem is configured via NetworkManager, similar to the WiFi and Ethernet interfaces.

The network interface for the cellular modem is called wwu1u1i5.

See the Quickstart Guide for a step-by-step guide on how to set up the cellular modem and connect to the Internet.