删除网络管理器包并删除 resolvconf 应用程序后,我可以/etc/network/interfaces
使用 ifup 和 ifdown 进行管理以及手动管理我的/etc/resolv.conf
文件,在尝试启动以太网和无线接口时收到以下错误。
以太网接口:
root@user-computer:/etc/network# ifup eno1
/etc/network/interfaces:21: unknown or no method and no inherits keyword specified
ifup: couldn't read interfaces file "/etc/network/interfaces"
无线接口wlp3s0:
root@user-computer:/etc/network# ifup wlp3s0
/etc/network/interfaces:21: unknown or no method and no inherits keyword specified
ifup: couldn't read interfaces file "/etc/network/interfaces"
以下是重新启动计算机后的步骤 - 首先,当我重新启动时,我的主以太网接口关闭:
步骤1:
root@user-computer:/home/user# ifconfig
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:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:240 (240.0 B) TX bytes:240 (240.0 B)
:vibr0
适用于我的虚拟机。
virbr0 Link encap:Ethernet HWaddr aa:bb:cc:dd:ee:gg
inet addrx.xx.xx.xx Bcastx.xx.255.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
第2步:
然后我会尝试提出这个问题:
root@user-computer:/home/user# ifup eno1
/etc/network/interfaces:21: unknown or no method and no inherits keyword specified
ifup: couldn't read interfaces file "/etc/network/interfaces"
步骤3:
我阅读了我的/etc/network/interfaces
文件以确保一切正常:
root@user-computer:/home/user# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
#eno1
auto eno1
iface eno1 inet static
address xx.xx.xx.xx
netmask 255.255.255.0
gateway xx.xx.xx.xx
up route add -net xx.xx.0.0 netmask 255.255.0.0 gw xx.xx.xx.xx
up route add -net xx.xx.0.0 netmask 255.128.0.0 gw xx.xx.xx.xx
up route add -net xx.xx.0.0 netmask 255.255.0.0 gw xx.xx.xx.xx
up route add -net xx.xx.0.0 netmask 255.255.0.0 gw xx.xx.xx.xx
dns-nameservers xx.xx.xx.xx xx.xx.xx.xx xx.xx.xx.xx
dns-search local1.local local2.local local2.local local3.local local4.local
# wlp3s0
auto wlp3s0
iface wlp3s0 inet statc
address xx.xx.xx.xx
netmask 255.255.255.0
gateway xx.xx.xx.xx
wireless-essid xxxx
wireless-mode managed
步骤4:
我可以使用以下命令调出界面ifconfig eno1 up
:
root@user-computer:/home/user#ifconfig eno1 up
root@user-computer:/home/user# ifconfig
eno1 Link encap:Ethernet HWaddr aa:bb:cc:dd:ee:ff
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:20 Memory:f7d00000-f7d20000
步骤5:
我可以让界面运行的唯一方法是运行dhclient eno1
:
root@user-computer:/home/user# dhclient eno1
root@user-computer:/home/user# ifconfig
eno1 Link encap:Ethernet HWaddr aa:bb:cc:dd:ee:ff
inet addrx.xx.xx.xx Bcastx.xx.xx.xx Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1535 errors:0 dropped:0 overruns:0 frame:0
TX packets:1274 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1963415 (1.9 MB) TX bytes:108139 (108.1 KB)
Interrupt:20 Memory:f7d00000-f7d20000
其他事宜:
尝试启动 WiFi:
root@user-computer:/home/user/Downloads# ifup wlp3s0
/etc/network/interfaces:21: unknown or no method and no inherits keyword specified
ifup: couldn't read interfaces file "/etc/network/interfaces"
root@user-computer:/home/user/Downloads# ifconfig wlp3s0 up
SIOCSIFFLAGS: Operation not possible due to RF-kill
最终的:
我需要使用 ifup && ifdown 来控制我的网络接口以及文件,/etc/network/interfaces
同时控制我的/etc/resolv.conf
文件:
现在我的 dhclient 再次覆盖了 resolv.conf - 我特意删除了 resolvconf 包以停止这种行为。
这是一个错误还是发生了什么事情,我该如何解决这个问题,才能让 ifup 和 ifdown 适用于以太网和 WiFi 接口。