Ethernet connectivity and bandwidth test between TX2 and RPi 4B

Hi,

Its probably a novice doubt since I am new to linux development.
I’m looking for a simple solution to send random Ethernet packets from TX2 to RPi 4B.

Host device: Jetson TX2 with Jetpack 4.2 (Ubuntu 18.04 LTS up & running)
RPi 4B running on latest NOOBs version.
Hardware: a simple Cat 6 cable
Bandwidth limitation: 1Gbit/s

Application: to test the Ethernet bandwidth between TX2 and RPi using random data (can be anything, video, files…) and monitor the latency. I want to maximize the Ethernet bandwidth for testing purposes.
The transmission can be bi-directional as well, regardless of who is sending TX2 or RPi.

So the questions are:

  1. How to setup a link between the two (from respect to software)?
  2. How to send/receive random traffic over these ports? on TX2 and RPi?
  3. Is it possible to somehow send a timestamp with every packet sent and monitor it on the receiver side to check the latency?

Any suggestions would be of great help! TIA!

Netcat is good for easy random testing (“ncat” is the actual program). The “cat” command simply reads out bytes, e.g., the bytes of a file. A README file could be read with “cat README”. “ncat” (“netcat” is the human readable name, not the program spelling) is a network extension of that idea. If you run “man ncat” you should see some examples and options (you might want to do this from the Ubuntu desktop since by default L4T Ubuntu probably did not install man pages).

Now the device special file “/dev/urandom” is not able to put out random characters quickly, but you can use this as an example data source. Locally:

cat /dev/urandom | strings
# Control-c when done.

You can find several examples online with a Google search for “linux ncat examples”. Basically this will allow you to send any program or file data to a socket, and then read that data from a different computer. In many cases you will need “sudo” to bind to sockets.

Hi linuxdev,

thanks for the suggestion! I’ll try out ncat.
But is there a possibility to read the timestamp of the packets via ncat?

and how do I install ncat on jetson? I tried to follow this example
https://www.linuxtechi.com/nc-ncat-command-examples-linux-systems/

but doesn’t seem to work.

how do I forward these strings on jetson’s ethernet port? and listen on Rpi’s port
cat /dev/urandom | strings

Plus, I connected RPi via LAN cable, but I cannot ping each other from terminal. Probably I need a cross-over cable?

Sorry to bother, but I a newbie in this area and don’t know those commands. Thanks for the help!

sudo apt-get install netcat

Cross-over might be required if one end does not support auto detect and there is no intervening switch. If you add a switch or a cross-over, and there is still no ping, then you’ll want to post the output of this for both the RPi and the Jetson:

ifconfig
route

Jetson output

ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:04:4b:8d:3d:e0  txqueuelen 1000  (Ethernet)
        RX packets 14  bytes 3206 (3.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 93  bytes 16346 (16.3 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 41  

l4tbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.55.1  netmask 255.255.255.0  broadcast 192.168.55.255
        inet6 fe80::30aa:85ff:fe37:d48  prefixlen 64  scopeid 0x20<link>
        inet6 fe80::1  prefixlen 128  scopeid 0x20<link>
        ether 7a:71:36:05:b6:25  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9  bytes 1425 (1.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 577  bytes 40649 (40.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 577  bytes 40649 (40.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

rndis0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 7a:71:36:05:b6:25  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 7a:71:36:05:b6:27  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.8.160  netmask 255.255.255.0  broadcast 192.168.8.255
        inet6 2a01:598:8989:a1f8:e4a7:c552:3e3e:3  prefixlen 128  scopeid 0x0<global>
        inet6 fde4:a7c5:523e:3e00:fcad:bf69:7d81:117d  prefixlen 64  scopeid 0x0<global>
        inet6 2a01:598:8989:a1f8:7051:9df3:5de5:10a8  prefixlen 64  scopeid 0x0<global>
        inet6 fde4:a7c5:523e:3e00:5e57:41d4:9f06:9770  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::e357:8c88:a917:7156  prefixlen 64  scopeid 0x20<link>
        inet6 2a01:598:8989:a1f8:fcad:bf69:7d81:117d  prefixlen 64  scopeid 0x0<global>
        ether 00:04:4b:8d:3d:de  txqueuelen 1000  (Ethernet)
        RX packets 1758  bytes 2207719 (2.2 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 938  bytes 130437 (130.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         homerouter.cpe  0.0.0.0         UG    600    0        0 wlan0
default         _gateway        0.0.0.0         UG    32766  0        0 l4tbr0
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 l4tbr0
192.168.8.0     0.0.0.0         255.255.255.0   U     600    0        0 wlan0
192.168.55.0    0.0.0.0         255.255.255.0   U     0      0        0 l4tbr0

RPi output

ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.13.221  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::a0f:d819:b7e1:7f13  prefixlen 64  scopeid 0x20<link>
        ether dc:a6:32:01:5c:be  txqueuelen 1000  (Ethernet)
        RX packets 45  bytes 11578 (11.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 32  bytes 6104 (5.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.8.161  netmask 255.255.255.0  broadcast 192.168.8.255
        inet6 fe80::f82e:cadf:1fea:7413  prefixlen 64  scopeid 0x20<link>
        inet6 fde4:a7c5:523e:3e00:103:848c:23b9:ce47  prefixlen 64  scopeid 0x0<global>
        inet6 2a01:598:8989:a1f8:70b:cbf4:5715:58e  prefixlen 64  scopeid 0x0<global>
        ether dc:a6:32:01:5c:bf  txqueuelen 1000  (Ethernet)
        RX packets 525  bytes 123927 (121.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 86  bytes 13574 (13.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         homerouter.cpe  0.0.0.0         UG    303    0        0 wlan0
link-local      0.0.0.0         255.255.0.0     U     202    0        0 eth0
192.168.8.0     0.0.0.0         255.255.255.0   U     303    0        0 wlan0

I tried opening a port on Rpi via ncat

nc -vvlnp 12345 >/dev/null
Listening on [0.0.0.0] (family 2, port 12345)

and to send gigabyte of zeros from Jetson

dd if=/dev/zero bs=1M count=1K | nc -vvn 0.0.0.0 12345
nc: connect to 0.0.0.0 port 12345 (tcp) failed: Connection refused

but couldn’t figure out the problem. Is it the static IP addressing? I don’t know why Rpi’s ethernet ip is so weird?

“Connection refused” is either the port is not open, or some sort of firewall or other rule is blocking the port. IP address 0.0.0.0 is a broadcast port, which you don’t want to use. The result is that some router somewhere in the system is being asked to do whatever it can since you don’t know where you are trying to go…broadcast is generally a privileged function on routers.

Are you using ethernet over the ethernet port? If so, then the Jetson never had an IP address assigned (a router would usually assign the address).

The 169.254.x.x address block (the RPi shows 169.254.13.221) is usually what you get if router setup fails. Technically there might be cases where a private network (not touching the internet) could actually use this to talk to other computers on that same subnet. However, it’s probably better to start with the assumption that there is no valid IP address setup on the RPi.

Are you using the wired ethernet connection, and are you going through a router and/or switch?

Okay, understood.

Yes, I am using Ethernet over Ethernet port. The Jetson and Rpi is connected directly with a Cat6 cable, no router or switches in between.

Yes, it seems the IPs are not assigned to both of them.
I tried to give a static IP on both, I followed some tutorials but couldn’t succeed with a connection. Although, I could set up a connection between Rpi and Windows PC successfully, by assigning static IP on Rpi of Windows’s IP 169.254.X.X block. But the same for Jetson and Windows PC didn’t work, also Jetson and Rpi didn’t work.

I followed this link for Rpi and Windows PC connection:
http://www.circuitbasics.com/how-to-set-up-a-static-ip-on-the-raspberry-pi/

Also, can I assign the static IP on Jetson the same way I did on Rpi? Or is there a different file/command for it? Because, I opened the sudo vi /etc/dhcpcd.conf file and it was empty, no lines written in it.

Jetson static IP address setup is just standard “Ubuntu”, and so any tutorials you find on the internet for Ubuntu 18.04 network setup should be valid. WiFi is (in my opinion) much harder to set up versus wired, and so far you are using wired, so there won’t be any particularly difficult issues. A google search such as this would get things started:
https://www.google.com/search?source=hp&ei=88VmXaGiIsvi-gSIqhw&q=ubuntu+18.04+static+ip+address&oq=%22ubuntu+18.04%22+static+ip&gs_l=psy-ab.3.1.0l10.1048.5606…9936…0.0…0.66.1481.24…0…1…gws-wiz…0i131.BMiQ1Q9GaRk

This is the one I liked for static IP setup description in Ubuntu 18.04:
https://www.tecmint.com/configure-network-static-ip-address-in-ubuntu/

RPi setup shouldn’t be any different than how you set up for previously, but I’d suggest using the “192.168.1.x” private subnet (netmask either “/24” or “255.255.255.0”). Example, use “192.168.1.2” on the Jetson, and “192.168.1.3” on the RPi.

Hi,

I finally used a switch which was much more easier, since I could not get any cross-over cables in time.

I configured TX2 to static IP 192.168.1.1 (using the GUI for network settings)
I configured Rpi to static IP 192.168.1.2 (using the GUI for network settings)

Connected them via a Gigabit Ethernet switch and the ping was successful.

I then ran iperf3 on both. TX2 as client and Rpi as server and maximized the bandwidth for about 10secs.

Followed this tutorial for iperf3:
https://www.tecmint.com/test-network-throughput-in-linux/

Thanks @linuxdev for your help!