0

I am trying to ssh into an embedded Linux device (let's call it petalinux) connected to my Ubuntu server running 22.04 (let's call it oip). petalinux and oip are connected by a direct ethernet cable and a serial UART. I am able to connect to the device using a serial terminal (minicom), but ssh times out. I am also unable to ping the device. So, I believe it is one of two things:

  • Network settings are incompatible (subnet mask, gateway, etc.), or
  • The firewall on the embedded Linux device is not letting traffic through.

In order to check the first one, I tried finding the IP address of oip; however, I do not see an IPv4 associated with eno1:

EDIT (add output of ifconfig, arp, netstat, and ip route)

$ 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: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether cc:48:3a:66:a3:b3 brd ff:ff:ff:ff:ff:ff
    altname enp0s31f6
    inet6 fe80::91fe:23e9:430c:4c90/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:5d:96:04 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
4: wlp60s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 18:47:3d:31:82:dd brd ff:ff:ff:ff:ff:ff
    inet 192.168.29.146/24 brd 192.168.29.255 scope global dynamic noprefixroute wlp60s0
       valid_lft 40510sec preferred_lft 40510sec
    inet6 2405:201:d001:8b9b:6aa1:628a:c18a:852c/64 scope global temporary dynamic
       valid_lft 4186sec preferred_lft 4186sec
    inet6 2405:201:d001:8b9b:9fbf:f0f:d3d4:34f5/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 4186sec preferred_lft 4186sec
    inet6 fe80::8d6c:7a7c:f242:2c67/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
5: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 02:42:0c:f4:0a:c5 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
6: br-71e276fedf6f: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 02:42:93:94:0b:70 brd ff:ff:ff:ff:ff:ff
    inet 172.19.0.1/16 brd 172.19.255.255 scope global br-71e276fedf6f
       valid_lft forever preferred_lft forever

$ ifconfig -a
br-71e276fedf6f: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.19.0.1  netmask 255.255.0.0  broadcast 172.19.255.255
        ether 02:42:93:94:0b:70  txqueuelen 0  (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

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:0c:f4:0a:c5  txqueuelen 0  (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

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether cc:48:3a:66:a3:b3  txqueuelen 1000  (Ethernet)
        RX packets 12827  bytes 1018633 (1.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3854  bytes 679852 (679.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xed700000-ed720000

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 31692  bytes 4654677 (4.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 31692  bytes 4654677 (4.6 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:5d:96:04  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

wlp60s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.29.146  netmask 255.255.255.0  broadcast 192.168.29.255
        inet6 fe80::8d6c:7a7c:f242:2c67  prefixlen 64  scopeid 0x20<link>
        inet6 2405:201:d001:8b9b:9fbf:f0f:d3d4:34f5  prefixlen 64  scopeid 0x0<global>
        inet6 2405:201:d001:8b9b:2e48:2aca:eaf7:f31b  prefixlen 64  scopeid 0x0<global>
        ether 18:47:3d:31:82:dd  txqueuelen 1000  (Ethernet)
        RX packets 7661151  bytes 11185482986 (11.1 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2146363  bytes 514484076 (514.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

$ arp -an
? (192.168.29.73) at 5c:e9:1e:9c:3a:b0 [ether] on wlp60s0
? (192.168.29.1) at a8:da:0c:c0:06:48 [ether] on wlp60s0

$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.29.1    0.0.0.0         UG        0 0          0 wlp60s0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 virbr0
172.17.0.0      0.0.0.0         255.255.0.0     U         0 0          0 docker0
172.19.0.0      0.0.0.0         255.255.0.0     U         0 0          0 br-71e276fedf6f
192.168.29.0    0.0.0.0         255.255.255.0   U         0 0          0 wlp60s0
192.168.122.0   0.0.0.0         255.255.255.0   U         0 0          0 virbr0

$ ip route
default via 192.168.29.1 dev wlp60s0 proto dhcp metric 600
169.254.0.0/16 dev virbr0 scope link metric 1000 linkdown
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
172.19.0.0/16 dev br-71e276fedf6f proto kernel scope link src 172.19.0.1 linkdown
192.168.29.0/24 dev wlp60s0 proto kernel scope link src 192.168.29.146 metric 600
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown

On oip's side, the ip addr is more straightforward. Here, I have set the eth0 IP statically. EDIT (add output of ifconfig, arp, netstat, and ip route)

$ 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: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
3: can0: <NOARP,ECHO> mtu 16 qdisc noop state DOWN group default qlen 10
    link/can
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether a6:e6:68:9d:46:5f brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.10/24 brd 192.168.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::a4e6:68ff:fe9d:465f/64 scope link
       valid_lft forever preferred_lft forever

$ ifconfig -a
can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          NOARP  MTU:16  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:10
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:47

eth0      Link encap:Ethernet  HWaddr A6:E6:68:9D:46:5F
          inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::a4e6:68ff:fe9d:465f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:77 errors:0 dropped:0 overruns:0 frame:0
          TX packets:692 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:17852 (17.4 KiB)  TX bytes:54248 (52.9 KiB)
          Interrupt:48

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:626 errors:0 dropped:0 overruns:0 frame:0
          TX packets:626 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:56300 (54.9 KiB)  TX bytes:56300 (54.9 KiB)

sit0      Link encap:IPv6-in-IPv4
          NOARP  MTU:1480  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:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

$ arp -an
-sh: arp: command not found

$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG        0 0          0 eth0
192.168.0.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0

$ ip route
default via 192.168.0.1 dev eth0 proto static
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.10

In addition, the SSH server is running on the device, as checked via the sudo systemctl status sshd command. The end-goal is to debug why I am unable to ping or ssh to the device.

8
  • Show us the tutorial / blog / documentation URL you relied on when setting this up. Were you hoping the ubuntu server would respond to a DHCP broadcast request from the embedded device? (Also, please tell us what the two hostnames are, so we can conveniently refer to them.) The two hosts have to agree on routing details, so ifconfig -a, arp -an, and netstat -rn are all relevant. It sounds like server does not have a useful link IP address, nor does the embedded device. You can ping from either direction, and observe with tcpdump (wireshark) on the other host. Commented Oct 23, 2023 at 19:04
  • Do you have a route set up so you can access the 192.168.0.0/24 network from your 192.168.29.0/24 host? What does ip route return? Commented Oct 23, 2023 at 19:40
  • The fe80::/64 address on your eno1 is a link-scope address usable only for things like DHCP; since you don't have a real v6 addr or any v4 addr almost certainly that interface/link isn't actually connected. Your wlp60s0 is connected to something, but what? Is it in the same collision domain (i.e. link-set)? It's certainly not the same subnet, as @doneal24 notes. Commented Oct 24, 2023 at 3:07
  • @J_H and @doneal24, I have edited the question to add the output of the relevant commands. Have also named the two systems: oip is the Ubuntu server, and petalinux is the embedded device. Also, to be clear, oip and petalinux are connected directly by an ethernet cable and a serial UART (have edited this into the question as well). Commented Oct 24, 2023 at 3:26
  • @dave_thompson_085, wlp60s0 is connected to my PC, which I am using to remote into the server. Overall, it is PC -> server (oip) -> embedded device (petalinux). Between oip and petalinux, there is only a direct ethernet connection. Commented Oct 24, 2023 at 4:12

1 Answer 1

1

With 192.168.0.10/24 already set on petalinux's eth0 linked to oip's eno1, to allow communication between oip and petalinux, run this on oip (as root user, meaning it probably should be prepended by sudo ):

ip addr add 192.168.0.11/24 dev eno1

And that's it: each should now be able to reach the other using the other's IP address: 192.168.0.10 or 192.168.0.11 (both being within 192.168.0.0/24). I don't see any strange problem here, except the superfluous information (libvirt and Docker are running too).

Note: petalinux won't be reachable directly from the PC (mentioned in comment) nor can it reach "outside" through oip for at least two reasons: Ubuntu's Docker sets filter/FORWARD to DROP, and the PC probably doesn't have an adequate route to 192.168.0.0/24. But that's not part of the question.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.