
您好,我在 voyage 作業系統上遇到故障轉移處理問題。我有一個具有 eth0 和 ppp0 介面的系統,其中 eth0 是主要流量路徑,ppp0 是輔助流量路徑。
root@voyage:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.40.1 0.0.0.0 UG 0 0 0 eth0
0.0.0.0 0.0.0.0 0.0.0.0 U 10 0 0 ppp0
10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
10.255.255.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.40.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
當我拔下或 ifdown eth0 時,eth0 的預設路由條目將被刪除,流量將流經 ppp0 接口,因為它的指標高於 eth0。當我插入 eth0 時,會建立 eth0 的預設路由條目,並且流量流經 eth0 介面。但是,當 LAN 因 eth0 在 LAN 上而關閉時,預設路由不會被刪除,因此不會發生故障轉移。請任何人告訴我有沒有辦法做到這一點,當 LAN 關閉時,預設路由會在一段時間後自動從路由表中刪除。
答案1
可能為時已晚,但可以節省其他人的時間...您可以使用複製到的腳本/etc/network/if-down.d/,使其可執行,從而刪除你的預設路由(route add default ...)。要使其運行,您需要新增:post-up /etc/network/if-down.d/ 中/etc/網路/接口在 eth0 部分。
希望它會有所幫助...