Networking
KVM 橋接介面未啟動 - inet, inet6 , bridge
我正在設置 KVM 主機,它將有多個從外部可見的虛擬機,其
/etc/network/interfaces
配置與此 類似# The loopback network interface auto lo iface lo inet loopback auto eth0 iface eth0 inet manual iface eth0 inet6 static address 2001:0000:1004:1019:: netmask 64 post-up /sbin/ip -family inet6 route add 2001:0000:1004:10ff:ff:ff:ff:ff dev eth0 post-up /sbin/ip -family inet6 route add default via 2001:0000:1004:10ff:ff:ff:ff:ff pre-down /sbin/ip -family inet6 route del default via 2001:0000:1004:10ff:ff:ff:ff:ff pre-down /sbin/ip -family inet6 route del 2001:0000:1004:10ff:ff:ff:ff:ff dev eth0 auto br0 iface br0 inet static address 41.100.60.25 netmask 255.255.255.0 network 41.100.60.0 broadcast 41.100.60.255 gateway 41.100.60.254 bridge_ports eth0 bridge_maxwait 12 bridge_fd 9 bridge_hello 2 bridge_maxage 12 bridge_stp off dns-nameservers 8.8.8.8 dns-search ovh.net post-up ip link set br0 address xx:xx:xx:xx:xx:xx post-up ip addr add 164.123.123.123/32 dev br0 broadcast 164.123.123.123 post-down ip addr del 164.123.123.123/32 dev br0 post-up ip route add default via 41.100.60.254 dev br0 post-down ip route del default via 41.100.60.254 dev br0 post-down brctl delbr br0
並且 eth0 和 br0 介面最終都被調出(它們工作)但是當我查看引導螢幕時我看到了這一點(由於某種原因它不在引導日誌中):
Waiting for network configuration Waiting upto 60 more seconds for network configuration" Booting system without full network configuration
另外當我跑步時
ifquery --state
或者
cat /run/network/ifstate
我可以看到缺少 eth0 和 br0
lo=lo
編輯1:
通過使用以下命令
ifup br0 --no-act
如果您願意,我會得到以下正在執行的命令集
ifup br0
run-parts /etc/network/if-pre-up.d ip addr add 41.100.60.25/255.255.255.0 broadcast 41.100.60.255 dev br0 label br0 ip link set dev br0 up ip route add default via 41.100.60.254 dev br0 ip link set br0 address xx:xx:xx:xx:xx:xx ip addr add 164.123.123.123/32 dev br0 broadcast 164.123.123.123 ip route add default via 41.100.60.254 dev br0 run-parts /etc/network/if-up.d
這告訴我這個命令被重複了
ip route add default via 41.100.60.254 dev br0
所以從我的配置中刪除它之後
post-up ip route add default via 41.100.60.254 dev br0 post-down ip route del default via 41.100.60.254 dev br0
我可以看到
run-parts /etc/network/if-pre-up.d ip addr add 41.100.60.25/255.255.255.0 broadcast 41.100.60.255 dev br0 label br0 ip link set dev br0 up ip route add default via 41.100.60.254 dev br0 ip link set br0 address xx:xx:xx:xx:xx:xx ip addr add 164.123.123.123/32 dev br0 broadcast 164.123.123.123 run-parts /etc/network/if-up.d
這解決了我執行時重新啟動後缺少 br0 的問題
ifquery --state # or cat /run/network/ifstate
因為我可以看到
lo=lo br0=br0
我決定暫時刪除 inet6 靜態配置,所以在“編輯 1”之後我很好。
我認為在執行 ifup 和 ifdown 時,為 inet 和 inet6 配置了兩種不同類型的配置,例如“靜態”和“手動”會導致一些命令重複。