我正在将 ubuntu 服务器 11.10 配置为从 dhcp 转为静态,每当我尝试重新启动网络管理器时,都会收到错误:命令运行:
sudo /etc/init.d/networking restart
输出:
*Running /etc/init.d/networking restart is depricated because it may not enable
again some interfaces
*Reconfiguring network interfaces...
/etc/network/interfaces:10: unknown method
ifdown: couldn't read interfaces file "/etc/network/interfaces"
/etc/network/interfaces:10: unknown method
ifup: couldn't read interfaces file "/etc/network/interfaces"
[fail]
我假设“:10:”表示接口文件的第 10 行,但我将在此处发布我的接口文件:
#This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
#The loopback interface
auto lo
iface lo inet loopback
#The primary network device
auto eth0
iface eth0 inet static
address 10.x.x.210
netmask 255.255.255.0
network 10.x.x.0
broadcast 10.x.x.255
gateway 10.x.x.1
有什么问题吗?我该如何解决这个错误?
iface eth0 inet static
以前是
iface eth0 inet dhcp
是这个原因吗?我正在尝试配置它来运行 DNS 服务器、Web 服务器、邮件服务器和文件服务器。有人能帮忙吗?
注意:我已尝试删除网络管理器,但它不允许我这样做。
答案1
如果您手动配置它,那么类似这样的操作将设置默认网关(网络、广播和网关是可选的):
auto eth0
iface eth0 inet static
address 192.0.2.7/24
gateway 192.0.2.254
不要使用“网络”语法网络掩码 255.255.255.0