Why can't I configure a static IP on my CentOS7 system?

14,308

In the /etc/sysconfig/network-scripts/ifcfg-eth0change BOOTPROTO to none instead of static then restart network using systemctl restart network

BOOTPROTO doesn't support static, it should be either none, bootp or dhcp

https://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-networkscripts-interfaces.html

Share:
14,308

Related videos on Youtube

Julian20151006
Author by

Julian20151006

Updated on September 18, 2022

Comments

  • Julian20151006
    Julian20151006 almost 2 years

    my /etc/sysconfig/network-scripts/ifcfg-eth0 is like this: /etc/sysconfig/network-scripst/ifcfg-eth0

    And I have issued the command "systemctl restart network". But when I issued "ifconfig", it shows that the ip on eth0 is 192.168.1.117,but I configured it as static ip 192.168.1.210 Then I issued "ip addr" , I did got ip 192.168.1.210, but the ip 192.168.1.117 also appeared, which I don't want to have at all: results as "ifconfig" and "ip addr"

    How can I handle it?

    • Serge
      Serge almost 8 years
      what happens if you do ifdown eth0; ifup eth0; ip addr ?
    • Julian20151006
      Julian20151006 almost 8 years
      when I issued "ifdown eth0",it shows that " Could not load file '/etc/sysconfig/network-scripts/ifcfg-eth0' " for 4 times.
    • Julian20151006
      Julian20151006 almost 8 years
      and when I issued "ifup eth0", it shows " Could not load file '/etc/sysconfig/network-scripts/ifcfg-eth0' " for 4 times ,too
    • Serge
      Serge almost 8 years
      Then check if the file exist and its permissions first.
    • Julian20151006
      Julian20151006 almost 8 years
      then I issued " ip addr ", it shows that "inet 192.168.1.117/24" and "192.168.1.210/24" and "inet6 fe80::20c:29ff:fee6:d6f3/64" are all under eth0
    • Rahul
      Rahul almost 8 years
      Post the output of chkconfig --list | grep -i netw
    • Julian20151006
      Julian20151006 almost 8 years
      I issued "stat ifcfg-eth0" , it shows the access is Access( 0644/-rw-r--r--).
    • Julian20151006
      Julian20151006 almost 8 years
      the output of "chkconfig --list | grep -i netw" is
    • Julian20151006
      Julian20151006 almost 8 years
      Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'. To see services enabled on particular target use 'systemctl list-dependencies [target]'. network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
    • Rahul
      Rahul almost 8 years
      @Julian20151006 try disabling n/w manager with sudo systemctl stop NetworkManager, sudo systemctl disable NetworkManager and finally run sudo service network restart command.
  • Julian20151006
    Julian20151006 almost 8 years
    yeah, your answer is like @Rahul's answers. Thank you!