【问题标题】:cannot make static ip in Debian 9无法在 Debian 9 中制作静态 IP
【发布时间】:2018-01-13 20:50:38
【问题描述】:

在我的新 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.

【问题讨论】:

    标签: debian debian-stretch


    【解决方案1】:

    我的 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
    

    【讨论】:

      【解决方案2】:

      我找到了解决方案。 我安装了新的 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
      

      【讨论】:

        【解决方案3】:

        在我的情况下,我必须手动编写 resolv.conf 文件并删除现有文件。某些原因系统在将其设置为静态 ip 时无法写入 resolv.conf 文件。

        之后就可以了!

        【讨论】:

        • 你能更好地解释一下write manually resolv.conf file in的意思吗?
        • 我在设置静态 ip 后遇到了 DNS 问题。这帮助了我。不是这个问题的具体答案,但在设置静态 ip 时可能会帮助其他面临这个问题的人
        猜你喜欢
        • 2019-10-26
        • 2015-05-05
        • 1970-01-01
        • 1970-01-01
        • 2016-03-09
        • 2021-04-12
        • 2020-11-02
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多