当我运行时ifup ens33
,出现此错误:
/etc/network/interfaces:5: misplaced option
ifup: couldn't read interfaces file "/etc/network/interfaces"
尝试重新启动网络时的结果是
midhun@server:~$ systemctl status networking.service
● networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2021-03-18 18:17:52 IST; 16min ago
Docs: man:interfaces(5)
Process: 6615 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
Process: 6612 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && u
Main PID: 6615 (code=exited, status=1/FAILURE)
Mar 18 18:17:52 server.example.com systemd[1]: Starting Raise network interfaces...
Mar 18 18:17:52 server.example.com sh[6612]: /etc/network/interfaces:5: misplaced option
Mar 18 18:17:52 server.example.com sh[6612]: ifquery: couldn't read interfaces file "/etc/network/interfaces"
Mar 18 18:17:52 server.example.com ifup[6615]: /etc/network/interfaces:5: misplaced option
Mar 18 18:17:52 server.example.com ifup[6615]: /sbin/ifup: couldn't read interfaces file "/etc/network/interfaces"
Mar 18 18:17:52 server.example.com systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Mar 18 18:17:52 server.example.com systemd[1]: networking.service: Failed with result 'exit-code'.
Mar 18 18:17:52 server.example.com systemd[1]: Failed to start Raise network interfaces.
lines 1-16/16 (END)
我尝试重新启动系统几次,但没有成功,请帮助我
这是我的网络接口的配置...请帮帮我
midhun@server:~$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto ens33
ifname ens33 inet static
address 192.168.1.25
netmask 255.255.255.0
答案1
内容是ifname
,不在iface
第 5 行。