Skip to main content

Network

The carrier boards have one or two Gigabit Ethernet connectors. Most CPUs only support one Ethernet interface as shown in the table below.

BoardInterfaces in U-BootInterfaces in Linux
iMX6 SoloX COM12
iMX6 Quad COM11
iMX6 DualLite COM11
iMX6 UltraLite COM12
iMX7 Dual (u)COM11
iMX7ULP uCOMNot supportedNot supported
iMX8M Quad COM11
iMX8M Mini uCOM11
iMX8M Nano uCOM11
iMX93 uCOM12 *
* - The iMX93 is only supported on the uCOM Carrier Board. The default Ethernet interface is 1Gbit using the onboard connector. An external adapter is needed to use the second, 100Mbit interface.

To test the network one or two network cables, a network with a DHCP server and access to Internet is required. The examples assume that the network is 192.168.5.0/255.255.255.255. Replace the IP addresses below to match the network configuration that the board is connected to.

U-Boot

The U-Boot has basic network functionality but only for the first/primary interface.

Use the ping command to test the network. It only handles IP addresses, that is, no host names. It also requires the ipaddr variable to have a valid IP address.

setenv ipaddr 192.168.5.7
ping 192.168.5.22
Using FEC0 device
host 192.168.5.22 is alive

Linux

The Linux image has full support for several Ethernet interfaces.

Status of network interfaces

ifconfig
eth0    Link encap:Ethernet HWaddr 00:1A:F1:01:9B:E7
inet addr:192.168.5.71 Bcast:192.168.5.255 mask:255.255.255.0
inet6 addr: fe80::21a:f1ff:fe01:9be7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:27 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2624 (2.5 KiB) TX bytes:5643 (5.5 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Start interface

If the interface cannot be seen when running ifconfig it can be started with ifup.

ifup eth1
fec 21b4000.ethernet eth1: Freescale FEC PHY driver [Generic PHY]
(mii_bus:phy_addr=2188000.ethernet:02, irq=-1)
IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
udhcpc (v1.22.1) started
Sending discover...
Sending discover...
libphy: 2188000.ethernet:02 - Link is Up - 1000/Full
IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
Sending discover...
Sending select for 192.168.5.72...
Lease of 192.168.5.72 obtained, lease time 691200
/etc/udhcpc.d/50default: Adding DNS 192.168.5.2

As can be seen above the interface is detected and DHCP is used to get an IP address.

One way to test the network is with the ping program. Unlike the U-Boot version the Linux version handles host names as well (use Ctrl-C to end the program).

ping www.sunet.se
PING www.sunet.se (192.36.171.231): 56 data bytes
64 bytes from 192.36.171.231: seq=0 ttl=56 time=16.412 ms
64 bytes from 192.36.171.231: seq=1 ttl=56 time=18.279 ms
64 bytes from 192.36.171.231: seq=2 ttl=56 time=19.125 ms
64 bytes from 192.36.171.231: seq=3 ttl=56 time=17.355 ms
^C
--- www.sunet.se ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 16.412/17.792/19.125 ms

The ping command uses the first interface (eth0) by default. To specify that it should use another interface use the –I option.

ping -I eth1 www.sunet.se

When using the second interface (eth1) it is possible that the ping program fails. This is most likely because the routing table does not handle the interface. To fix this first look at the current routing table.

route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.5.1 0.0.0.0 UG 0 0 0 eth0
192.168.5.0 * 255.255.255.0 U 0 0 0 eth0
192.168.5.0 * 255.255.255.0 U 0 0 0 eth1

The default route is only for eth0, so remove it and add a default route for eth1 instead.

route del default
route add default gw 192.168.5.1 eth1

After this change the eth1 is the default Ethernet interface instead.

Iperf3

Ping is a great way to test if the hardware is connected to the network, or not, but to really test the network interface it is better to use a program like iperf3. The program works with a client and a server. The client is typically run on the board and the server software can either be installed on a computer on the local network https://iperf.fr/iperf-download.php or one of the online servers can be used https://iperf.fr/iperf-servers.php.

If iperf3 is not available on the file system then it can be added when building the file system by adding iperf3 to IMAGE_INSTALL_append.

IMAGE_INSTALL_append = " \
iperf3 \
"

To run the test first start the server by running the program with the -s switch. On a server running Linux the command looks like this.

iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

The next step is to run the client on the target hardware.

iperf3 -c 192.168.1.128 -p 5201 -i 1 -P 4

The most important parameter is the URL or IP number of the server, in this case 192.168.1.128 and the port number reported by the server, in this case 5201. There are a lot of options that can be given to the program. Use the --help option to see them all.

The client prints a lot during the test phase and in the end it prints a summary like this.

[ ID] Interval           Transfer     Bandwidth       Retr
[ 4] 0.00-10.02 sec 146 MBytes 122 Mbits/sec 0 sender
[ 4] 0.00-10.02 sec 145 MBytes 122 Mbits/sec receiver
[ 6] 0.00-10.02 sec 151 MBytes 126 Mbits/sec 0 sender
[ 6] 0.00-10.02 sec 150 MBytes 126 Mbits/sec receiver
[ 8] 0.00-10.02 sec 146 MBytes 122 Mbits/sec 0 sender
[ 8] 0.00-10.02 sec 145 MBytes 121 Mbits/sec receiver
[ 10] 0.00-10.02 sec 156 MBytes 131 Mbits/sec 0 sender
[ 10] 0.00-10.02 sec 156 MBytes 130 Mbits/sec receiver
[SUM] 0.00-10.02 sec 599 MBytes 502 Mbits/sec 0 sender
[SUM] 0.00-10.02 sec 596 MBytes 499 Mbits/sec receiver

The last two lines display the bandwidth for send (502Mbit/sec) and receive (499Mbit/sec). Note that this number is limited by several factors: max bandwidth of the board's CPU, any network switches, network card in the PC and the PC performance.