Why can't I configure a static IP on my CentOS7 system?
14,308
In the /etc/sysconfig/network-scripts/ifcfg-eth0
change 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
Related videos on Youtube
![Julian20151006](https://i.stack.imgur.com/SjpnR.jpg?s=256&g=1)
Author by
Julian20151006
Updated on September 18, 2022Comments
-
Julian20151006 almost 2 years
my /etc/sysconfig/network-scripts/ifcfg-eth0 is like this:
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:
How can I handle it?
-
Serge almost 8 yearswhat happens if you do
ifdown eth0; ifup eth0; ip addr
? -
Julian20151006 almost 8 yearswhen I issued "ifdown eth0",it shows that " Could not load file '/etc/sysconfig/network-scripts/ifcfg-eth0' " for 4 times.
-
Julian20151006 almost 8 yearsand when I issued "ifup eth0", it shows " Could not load file '/etc/sysconfig/network-scripts/ifcfg-eth0' " for 4 times ,too
-
Serge almost 8 yearsThen check if the file exist and its permissions first.
-
Julian20151006 almost 8 yearsthen 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 almost 8 yearsPost the output of
chkconfig --list | grep -i netw
-
Julian20151006 almost 8 yearsI issued "stat ifcfg-eth0" , it shows the access is Access( 0644/-rw-r--r--).
-
Julian20151006 almost 8 yearsthe output of "chkconfig --list | grep -i netw" is
-
Julian20151006 almost 8 yearsNote: 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 almost 8 years@Julian20151006 try disabling n/w manager with
sudo systemctl stop NetworkManager
,sudo systemctl disable NetworkManager
and finally runsudo service network restart
command.
-
-
Julian20151006 almost 8 yearsyeah, your answer is like @Rahul's answers. Thank you!