1
我在具有loopback和eth0網絡接口的目標上創建了Yocto映像。Yocto ifconfig在ifdown後不乾淨-a
當我使用靜態IP配置/ etc/network/interface時,網絡關閉命令起作用。在命令ifdown之後 - ifconfig不返回任何內容。
在靜態模式下我的/ etc /網絡/接口:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# Main wired interface
auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
我的問題就來了,如果我在配置DHCP模式下的eth0:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# Main wired interface
auto eth0
iface eth0 inet dhcp
一個了ifup -a命令後,使用ifconfig回報即:
eth0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
inet addr:192.168.1.133 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: <ipv6 address> Scope:Link
inet6 addr: <ipv6 address> Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:553 errors:0 dropped:106 overruns:0 frame:0
TX packets:98 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:70121 (68.4 KiB) TX bytes:11022 (10.7 KiB)
Interrupt:33
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:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:140 (140.0 B) TX bytes:140 (140.0 B)
然而,經過ifdown你-a -v
run-parts /etc/network/if-down.d
ifconfig lo 127.0.0.1 down
run-parts /etc/network/if-post-down.d
run-parts /etc/network/if-down.d
kill `cat /var/run/udhcpc.eth0.pid` 2>/dev/null
ifconfig eth0 down
run-parts /etc/network/if-post-down.d
使用ifconfig返回如下:
eth0 Link encap:Ethernet HWaddr fc:c2:3d:0d:bb:93
inet6 addr: fe80::fec2:3dff:fe0d:bb93/64 Scope:Link
inet6 addr: 2a02:1205:c69a:b970:fec2:3dff:fe0d:bb93/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1304 errors:0 dropped:272 overruns:0 frame:0
TX packets:158 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:148500 (145.0 KiB) TX bytes:16490 (16.1 KiB)
Interrupt:33
eth0接口不徹底清洗,這是我的問題,因爲我用它的狀態來管理我的系統其他的東西。
我精確我使用的添加ifdown你的腳本(在DHCP的情況下不使用)
貓/etc/network/if-down.d/resolvconf包需要resolvconf:
#!/bin/sh
#
# ifdown hook script for resolvconf
#
# This file is part of the resolvconf package.
#
[ -x /sbin/resolvconf ] || exit 0
case "$ADDRFAM" in
inet|inet6) : ;;
*) exit 0 ;;
esac
/sbin/resolvconf -d "${IFACE}.${ADDRFAM}" || :
有你有什麼錯誤的想法?