設(shè)備有兩張網(wǎng)卡,在 debian 9 會(huì)有兩個(gè)默認(rèn)路由$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Ifacedefault gateway 0.0.0.0 UG 100 0 0 enp0s8default gateway 0.0.0.0 UG 101 0 0 enp0s310.0.2.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s3link-local 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s8192.168.20.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s8必須刪除一個(gè)才能連接外網(wǎng)由于找不到相關(guān)設(shè)置,所以就想使用腳本開機(jī)自動(dòng)執(zhí)行刪除命令route del -net default netmask 0.0.0.0 dev enp0s8在開機(jī)的時(shí)候該腳本執(zhí)行失敗,而且還有一個(gè)問題,如何保證該腳本在網(wǎng)絡(luò)配置完成后運(yùn)行。所以該如何保證只有一個(gè)默認(rèn)路由呢?所以該如何保證只有一個(gè)默認(rèn)路由呢?所以該如何保證只有一個(gè)默認(rèn)路由呢?
2 回答

DIEA
TA貢獻(xiàn)1820條經(jīng)驗(yàn) 獲得超3個(gè)贊
可修改 debian 網(wǎng)絡(luò)設(shè)置文件 /etc/network/interfaces,兩種參考方法
對不需要設(shè)置網(wǎng)關(guān)的接口,用靜態(tài) IP,不用 DHCP,如
auto eth_master inet dhcpauto eth_slave inet static address 192.168.20.0 netmask 255.255.255.0
添加回答
舉報(bào)
0/150
提交
取消