大网数据广告活动
服务器运维问答

Centos server keeps jumping to address instead of static assigned address

· 52CE 我爱测

I have a headless Centos server that I've configured with a static IP address. I've disabled Network Manager, avahi-daemon etc. Whenever I restart the network it just jumps to 10.155.90.100 instead of the required 10.155.90.61 wi…

问题原文

原帖链接 · blarg · CC BY-SA 3.0

I have a headless Centos server that I've configured with a static IP address. I've disabled Network Manager, avahi-daemon etc. Whenever I restart the network it just jumps to 10.155.90.100 instead of the required 10.155.90.61 with no explanation:

Here is my ifcfg-eth0:

   # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
    DEVICE=eth0
    BOOTPROTO=static
    ONBOOT=yes
    #HWADDR=00:50:56:b0:5a:57
    IPADDR=10.155.90.61
    NETMASK=255.255.255.0
    GATEWAY=10.155.90.1
    TYPE=Ethernet
    USERCTL=no
    IPV6INIT=no
    PEERDNS=yes
    NM_CONTROLLED=no

It seems to be running DHCP anyway. I cant seem to get a more detailed log than this in /var/log/messges:

Jul 11 12:50:33 NET[4767]: /sbin/dhclient-script : updated /etc/resolv.conf
Jul 11 12:50:34 kernel: 8021q: adding VLAN 0 to HW filter on device eth0
Jul 11 12:50:34 kernel: ADDRCONF(NETDEV_UP): eth0: link is not ready
Jul 11 12:50:34 kernel: e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
Jul 11 12:50:34 kernel: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Jul 11 12:50:36 dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x39edae98)
Jul 11 12:50:36 dhclient: DHCPACK from 10.155.50.20 (xid=0x39edae98)
Jul 11 12:50:36 NET[5157]: /sbin/dhclient-script : updated /etc/resolv.conf
Jul 11 12:50:36 dhclient: bound to 10.155.90.100 -- renewal in 255205 seconds.

How can I turn off DHCP and stop the server jumping for the wrong IP?

社区高分解答

原帖链接 · Nathan C · CC BY-SA 3.0

You don't need PEERDNS since you're using a static IP. This is causing dhclient to run and update your resolv.conf file (as it's designed to do). In the process, it also requests an IP address when it requests the nameservers from DHCP.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-07-11)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。