임베디드 Linux 장치에 ping 또는 ssh를 실행할 수 없습니다. eno1에는 IPv4 주소가 없습니다.

임베디드 Linux 장치에 ping 또는 ssh를 실행할 수 없습니다. eno1에는 IPv4 주소가 없습니다.

ssh나는 Ubuntu 서버(우리가 부르겠습니다)를 실행하는 임베디드 Linux 장치(우리가 부르겠습니다) 에 연결하려고 합니다 . 그리고 직접 이더넷 케이블과 직렬 UART를 통해 연결하세요. 직렬 터미널()을 사용하여 장치에 연결할 수 있지만 시간이 초과됩니다. 기기도 사용할 수 없습니다. 그래서 저는 이것이 두 가지 중 하나라고 믿습니다.petalinux22.04oippetalinuxoipminicomsshping

  • 네트워크 설정이 호환되지 않습니다(서브넷 마스크, 게이트웨이 등).
  • 내장형 Linux 장치의 방화벽이 트래픽을 허용하지 않습니다.

oip첫 번째를 확인하기 위해 IP 주소를 찾아보았습니다 . 그러나 다음과 관련된 IPv4가 표시되지 않습니다 eno1.

편집(ifconfig, arp, netstat 및 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

측면은 oipip addr직접적이다. 여기서는 eth0IP를 정적으로 설정했습니다. 편집(ifconfig, arp, netstat 및 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

또한 SSH 서버장치에서 실행할 명령을 확인하십시오 sudo systemctl status sshd. 최종 목표는 장치에 액세스 할 수 없거나 ping액세스할 수 없는 이유를 디버깅하는 것입니다.ssh

답변1

192.168.0.10/24가 설정되었습니다.꽃잎리눅스~의이더넷 0다음으로 연결~의1번, oip와 Petalinux 간의 통신을 허용하려면 다음을 설정하십시오.(처럼뿌리user, 이는 아마도 sudo)로 시작해야 함을 의미합니다.

ip addr add 192.168.0.11/24 dev eno1

그게 전부입니다. 이제 모든 사람이 상대방의 IP 주소인 192.168.0.10 또는 192.168.0.11(둘 다 192.168.0.0/24 내)을 사용하여 상대방에게 연결할 수 있습니다. 중복된 정보(libvirt 및 Docker도 실행 중) 외에는 이상한 문제가 보이지 않습니다.

노트:꽃잎리눅스PC에서 직접 접근할 수 없음(in논평) 둘 다 통과할 수 없습니다적어도 두 가지 이유가 있습니다. Ubuntu의 Docker는 filter/FORWARD를 DROP으로 설정하고 PC에 192.168.0.0/24에 대한 경로가 충분하지 않을 수 있습니다. 그러나 그것은 문제의 일부가 아닙니다.

관련 정보