Linux

Ubuntu 14.04 中缺少網路環回設備

  • January 24, 2019

我想通過 JTAG 對 FPGA 進行程式,並且 xmd 腳本連接到 127.0.0.1:3121 來執行此操作。幾個月來效果很好。重新啟動後,此連接突然不再存在,我也無法 ping 127.0.0.1 或 localhost(仍解析為 127.0.0.1)。ifconfig 缺少“lo”。我有兩個網卡 eth4 和 eth5 的條目,但沒有。完整的輸出在問題的末尾。與其他電腦的連接工作正常。我如何讓它再次執行?

我嘗試手動啟動它,但這並沒有改變任何東西:

> ifup lo
ifup: interface lo already configured

> ifup --force lo  
(no output)

這也不起作用:

> route add -host 127.0.0.1 dev lo  
SIOCADDRT: No such device

一些診斷輸出:

> route -n  
Kernel IP routing table  
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface  
0.0.0.0         192.168.153.1   0.0.0.0         UG    0      0        0 eth5  
192.168.10.0    0.0.0.0         255.255.255.0   U     1      0        0 eth4  
192.168.153.0   0.0.0.0         255.255.255.0   U     1      0        0 eth5  

> cat /var/run/network/ifstate  
lo=lo

> cat /etc/network/interfaces  
# interfaces(5) file used by ifup(8) and ifdown(8)  
auto lo  
iface lo inet loopback

> iptables -L  
Chain INPUT (policy ACCEPT)  
target     prot opt source               destination           

Chain FORWARD (policy ACCEPT)  
target     prot opt source               destination           

Chain OUTPUT (policy ACCEPT)  
target     prot opt source               destination

我沒有 /etc/iptables.conf

我也嘗試過sudo rm -rf /var/run/network/*這個問題。我做了apt-get updateapt-get upgrade。不用找了。

> ifconfig 127.0.0.1 lo  
lo: Unknown host  
ifconfig: `--help' gives usage information.

ifconfig 的輸出:

eth4      Link encap:Ethernet  HWaddr 00:24:e8:45:8f:10    
         inet addr:192.168.10.2  Bcast:192.168.10.255  Mask:255.255.255.0  
         inet6 addr: fe80::224:e8ff:fe45:8f10/64 Scope:Link  
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1  
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0  
         TX packets:67 errors:0 dropped:0 overruns:0 carrier:0  
         collisions:0 txqueuelen:1000   
         RX bytes:0 (0.0 B)  TX bytes:10916 (10.9 KB)  
         Interrupt:21 Memory:f7fe0000-f8000000   

eth5      Link encap:Ethernet  HWaddr d8:eb:97:71:be:e5    
         inet addr:192.168.153.124  Bcast:192.168.153.255  Mask:255.255.255.0  
         inet6 addr: fe80::daeb:97ff:fe71:bee5/64 Scope:Link  
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1  
         RX packets:35392 errors:0 dropped:0 overruns:0 frame:0  
         TX packets:28754 errors:0 dropped:0 overruns:0 carrier:0  
         collisions:0 txqueuelen:1000   
         RX bytes:20734790 (20.7 MB)  TX bytes:4354467 (4.3 MB) 

編輯:

> ip link  
1: ttyUSB0: <LOOPBACK> mtu 65536 qdisc noop state DOWN mode DEFAULT group default  
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00  
2: eth5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000  
link/ether d8:eb:97:71:be:e5 brd ff:ff:ff:ff:ff:ff  
3: eth4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000  
link/ether 00:24:e8:45:8f:10 brd ff:ff:ff:ff:ff:ff 

Dennis:我已經在/etc/network/interfaces中有這兩行並且已經嘗試過ifup lo了。當我這樣做時,我會說“介面已經配置”,或者如果我添加--force.

Ginnungagap 的想法是正確的。我可以將 ttyUSB0 從“DOWN”帶到“UNKNOWN”:

> sudo ip link set ttyUSB0 up

現在輸出是

1: ttyUSB0: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

現在它再次工作,既可以 ping 又可以對 FPGA 進行程式。

非常感謝你。

引用自:https://serverfault.com/questions/950505