This is a beginner's question on networking. I tried to find a solution on the web, but to no success.
Goal: Establish a TCP/IP connection over ethernet directly between my linux host pc and an STM32MP157 board, so I could then send and receive packets using C sockets and simple client/server programs (like these ones).
- In this question I’m referring to a BeagleBone Black as an extra test case. I assume that whatever I’m missing is relevant to both, but please mind that my goal is to communicate with the STM32MP1 board.
Host PC: Kernel version 5.15.0-117-generic
Details: I conducted some testing, connecting ethernet cable in different situations, and this what comes up:
When I connect my linux host straight to my home router, connection is established, IPv4:
10.100.102.47/24When I connect the STM32MP1 straight to my home router, connection is established:
root@stm32mp1:~# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: end0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 10:e7:7a:e1:8b:a4 brd ff:ff:ff:ff:ff:ff altname ethernet0 altname ethernet0.ethernet inet 10.100.102.46/24 metric 10 brd 10.100.102.255 scope global dynamic end0 valid_lft 3568sec preferred_lft 3568sec inet6 fe80::12e7:7aff:fee1:8ba4/64 scope link valid_lft forever preferred_lft forever 3: usb0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000 link/ether 7e:8f:a7:2e:04:e5 brd ff:ff:ff:ff:ff:ff root@stm32mp1:~# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=7.27 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=6.17 ms - When I connect the BBB straight to my home router, connection is established:
root@bela:~# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether e0:ff:f1:d8:ee:5d brd ff:ff:ff:ff:ff:ff inet 10.100.102.44/24 brd 10.100.102.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::e2ff:f1ff:fed8:ee5d/64 scope link valid_lft forever preferred_lft forever 3: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether be:1a:f1:d8:ee:5f brd ff:ff:ff:ff:ff:ff inet 192.168.6.2/24 brd 192.168.6.255 scope global usb0 valid_lft forever preferred_lft forever inet6 fe80::bc1a:f1ff:fed8:ee5f/64 scope link valid_lft forever preferred_lft forever 4: usb1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether be:1a:f1:d8:ee:62 brd ff:ff:ff:ff:ff:ff inet 192.168.7.2/24 brd 192.168.7.255 scope global usb1 valid_lft forever preferred_lft forever inet6 fe80::bc1a:f1ff:fed8:ee62/64 scope link valid_lft forever preferred_lft forever root@bela:~# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=6.36 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=5.79 ms 192.168.6.2/24 and 192.168.7.2/24 are assigned before the connection to the router.
- When I connect the STM32MP1 (as well as with the BBB) straight to my linux host PC, connection is not established:
root@stm32mp1:~# [ 65.854953] stm32-dwmac 5800a000.ethernet end0: Link is Up - 1Gbps/Full - flow control rx/tx [ 65.862162] IPv6: ADDRCONF(NETDEV_CHANGE): end0: link becomes ready root@stm32mp1:~# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: end0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 10:e7:7a:e1:8b:a4 brd ff:ff:ff:ff:ff:ff altname ethernet0 altname ethernet0.ethernet inet6 fe80::12e7:7aff:fee1:8ba4/64 scope link valid_lft forever preferred_lft forever 3: usb0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000 link/ether e2:40:83:22:5d:7a brd ff:ff:ff:ff:ff:ff root@stm32mp1:~# Issue:
Check #1 shows that my host’s ethernet port is able to function.
Checks #2,3 show that the target boards’ ethernet ports are able to function.
Check #4 shows that connection isn’t established between the host and a target board.
Instead, when connecting the host and the STM32MP1: As long as the cable is plugged in, an error message saying “Connection failed: activation of network connection failed” would pop on the host screen in a periodic fashion.
How can this be solved? Thank you
Additional info: If I connect both the target (eth cable) and the host (wireless) to the router, I manage to communicate over the network. But I need a direct connection between the machine, without the router in the middle.
STM’s guide on how to configure STM32MP1’s ethernet interface suggests:
If a DHCP server is not available, one can set the Ethernet IP address with : Board $> ifconfig end0 uuu.xxx.yyy.zzz I did that, but it doesn’t matter because connection is never established with the host.