![Debian 11 服务器无法删除默认网关](https://linux22.com/image/772088/Debian%2011%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%97%A0%E6%B3%95%E5%88%A0%E9%99%A4%E9%BB%98%E8%AE%A4%E7%BD%91%E5%85%B3.png)
我无法从我的 Debian 11 服务器中删除默认网关:-
peter@discovery:~$ sudo route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.13 0.0.0.0 UG 0 0 0 enp6s0f0
0.0.0.0 0.0.0.0 0.0.0.0 U 1002 0 0 enp8s0
91.187.223.128 0.0.0.0 255.255.255.128 U 0 0 0 enp6s0f1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 enp6s0f1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 enp8s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp6s0f0
192.168.1.13 0.0.0.0 255.255.255.255 UH 0 0 0 enp6s0f0
peter@discovery:~$ sudo route del default gw 192.168.1.13
peter@discovery:~$ sudo route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.13 0.0.0.0 UG 0 0 0 enp6s0f0
0.0.0.0 0.0.0.0 0.0.0.0 U 1002 0 0 enp8s0
91.187.223.128 0.0.0.0 255.255.255.128 U 0 0 0 enp6s0f1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 enp6s0f1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 enp8s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp6s0f0
192.168.1.13 0.0.0.0 255.255.255.255 UH 0 0 0 enp6s0f0
然后还有:-
peter@discovery:~$ sudo ip route del default via 192.168.1.13
peter@discovery:~$ sudo route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.13 0.0.0.0 UG 0 0 0 enp6s0f0
0.0.0.0 0.0.0.0 0.0.0.0 U 1002 0 0 enp8s0
91.187.223.128 0.0.0.0 255.255.255.128 U 0 0 0 enp6s0f1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 enp6s0f1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 enp8s0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 enp6s0f0
192.168.1.13 0.0.0.0 255.255.255.255 UH 0 0 0 enp6s0f0
peter@discovery:~$
默认网关 192.168.1.13 非常顽固,不想走。请问我该如何摆脱它。我有一台 Debian 11 Bullseye 服务器。
非常感谢
只需添加以下 /etc/network/interfaces 文件:-
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
auto enp6s0f0
iface enp6s0f0 inet static
address 192.168.1.130
netmask 255.255.255.0
gateway 192.0.2.254
auto enp6s0f0:0
iface enp6s0f0:0 inet static
address 192.168.1.131
netmask 255.255.255.0
auto enp6s0f0:1
iface enp6s0f0:1 inet static
address 192.168.1.132
netmask 255.255.255.0
auto enp6s0f0:2
iface enp6s0f0:2 inet static
address 192.168.1.133
netmask 255.255.255.0
auto enp6s0f0:3
iface enp6s0f0:3 inet static
address 192.168.1.134
netmask 255.255.255.0
auto enp6s0f0:4
iface enp6s0f0:4 inet static
address 192.168.1.135
netmask 255.255.255.0
auto enp6s0f0:5
iface enp6s0f0:5 inet static
address 192.168.1.136
netmask 255.255.255.0
auto enp6s0f0:6
iface enp6s0f0:6 inet static
address 192.168.1.136
netmask 255.255.255.0
auto enp6s0f0:7
iface enp6s0f0:7 inet static
address 192.168.1.137
netmask 255.255.255.0
auto enp6s0f0:8
iface enp6s0f0:8 inet static
address 192.168.1.138
netmask 255.255.255.0
auto enp6s0f0:9
iface enp6s0f0:9 inet static
address 192.168.1.139
netmask 255.255.255.0
auto enp6s0f1
iface enp6s0f1 inet static
address 91.187.223.129
netmask 255.255.255.128
auto enp6s0f1:0
iface enp6s0f1:0 inet static
address 91.187.223.134/25
netmask 255.255.255.128
auto enp6s0f1:1
iface enp6s0f1:1 inet static
address 91.187.223.210
netmask 255.255.255.128
auto enp6s0f1:2
iface enp6s0f1:2 inet static
address 91.187.223.211
netmask 255.255.255.128
auto enp6s0f1:3
iface enp6s0f1:3 inet static
address 91.187.223.212
netmask 255.255.255.128
auto enp6s0f1:4
iface enp6s0f1:4 inet static
address 91.187.223.213
netmask 255.255.255.128
auto enp6s0f1:5
iface enp6s0f1:5 inet static
address 91.187.223.214
netmask 255.255.255.128
auto enp6s0f1:6
iface enp6s0f1:6 inet static
address 91.187.223.215
netmask 255.255.255.128
auto enp6s0f1:7
iface enp6s0f1:7 inet static
address 91.187.223.216
netmask 255.255.255.128
auto enp6s0f1:8
iface enp6s0f1:8 inet static
address 91.187.223.217
netmask 255.255.255.128
auto enp6s0f1:9
iface enp6s0f1:9 inet static
address 91.187.223.218
netmask 255.255.255.128
auto enp6s0f1:10
iface enp6s0f1:10 inet static
address 91.187.223.219
netmask 255.255.255.128