Raspberry-Pi

ssh:連接到主機 raspberry 埠 22:沒有到主機的路由

  • April 18, 2019

我無法登錄 ssh 來加密已安裝 dropbear 的 luks 加密設備,但我可以在 rpi 被解密時。我收到錯誤:ssh:連接到主機覆盆子埠 22:沒有到主機的路由。啟動 pi 時出現錯誤:ipconfig: eth0: SIOCGIFINDEX: No such device at boot。該設備是安裝了 Raspbian 9 Stretch 作業系統的 Raspberry Pi。我正在關注本指南https://stinkyparkia.wordpress.com/2014/10/14/remote-unlocking-luks-encrypted-lvm-using-dropbear-ssh-in-ubuntu-server-14-04-1-帶靜態 ipst/。我想配置遠端解鎖 crypt luks 加密的 rpi 設備。我已設置NO_START為 0 並複制了 ssh 密鑰。命令的結果ifconfig -a

$ sudo ifconfig -a
enxb827eb1b2a72: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 192.168.1.5  netmask 255.255.255.0  broadcast 192.168.1.255
       inet6 fe80::83:5d01:52b3:b571  prefixlen 64  scopeid 0x20<link>
       ether b8:27:eb:1b:2a:72  txqueuelen 1000  (Ethernet)
       RX packets 1141  bytes 115055 (112.3 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 843  bytes 132826 (129.7 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 1  (Local Loopback)
       RX packets 102  bytes 7746 (7.5 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 102  bytes 7746 (7.5 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 192.168.1.1  netmask 255.255.255.0  broadcast 192.168.1.255
       inet6 fe80::1c84:9d97:1351:eec4  prefixlen 64  scopeid 0x20<link>
       ether ec:08:6b:0b:fa:a1  txqueuelen 1000  (Ethernet)
       RX packets 384  bytes 21449 (20.9 KiB)
       RX errors 0  dropped 135  overruns 0  frame 0
       TX packets 57  bytes 8368 (8.1 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

請注意,192.168.1.5 是我設置的靜態 IP 地址/etc/network/interfaces

我在 DEVICE= 行下添加了靜態 IP /etc/initramfs-tools/initramfs.conf

IP=192.168.1.5::192.168.1.254:255.255.255.0::enxb827eb1b2a72:off

和文件底部/usr/share/initramfs-tools/scripts/init-bottom/dropbear

ifconfig enxb827eb1b2a72 0.0.0.0 down

但它沒有任何作用。

命令的結果sudo ip route show

$ sudo ip route show
default via 192.168.1.254 dev enxb827eb1b2a72 src 192.168.1.5 metric 202 
default via 192.168.1.254 dev wlan0 src 192.168.1.1 metric 203 
192.168.1.0/24 dev enxb827eb1b2a72 proto kernel scope link src 192.168.1.5 metric 202 
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.1 metric 203

我通過添加net.ifnames=0 biosdevname=0到 /boot/cmdline.txt 解決了它。介面名稱錯誤。

引用自:https://unix.stackexchange.com/questions/374747