无法在我的新Debian 9中获取静态IP。
在我的etc / network / interfaces中我有以下
# This file describes the network interfaces available on your system
# and how to activate them
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.88.10
netmask 255.255.255.0
gateway 192.168.88.1 // this is my router ip
network 192.168.88.0 // this is I don't know why, but I saw it in most of instructions
broadcast 192.168.88.255
dns-nameservers 192.168.88.1
然后我这样做
service networking restart
我收到了错误
Job for networking.service failed because the control process exited with error code.
See "systemctl status networking.service" and "journalctl -xe" for details.
答案 0 :(得分:5)
我的Debian版本9
uname -a
4.9.0-5-amd64 #1 SMP Debian 4.9.65-3+deb9u2 (2018-01-04) x86_64 GNU/Linux
尝试以下方式,它适合我。
文件名:/etc/network/interfaces
auto eth0
iface eth0 inet static
hwaddress 3a:c6:b2:43:7b:ab (you MAC address)
address 192.168.88.10
netmask 255.255.255.0
gateway 192.168.88.1
然后重启服务:
systemctl restart networking.service
答案 1 :(得分:0)
我找到了解决方案。 我在新系统上安装了Debian的新实例并检查了设置。
问题出在接口名称eth0中。 正确的名字是ens3。
auto ens3
allow-hotplug ens3
iface ens3 inet static
address 192.168.88.10
netmask 255.255.255.0
network 192.168.88.0
broadcast 192.168.88.255
gateway 192.168.88.1
dns-nameservers 192.168.88.1
答案 2 :(得分:0)
就我而言,我必须手动写入resolv.conf文件并删除现有文件。将系统设置为静态ip时,系统无法写入resolv.conf文件。
之后就可以了!