2

I have edited the /etc/sysconfig/network-scripts/ifcfg-enpos2:

BOOTPROTO="static"
IPADDR=192.168.1.105
NETMASK=255.255.255.0
NM_CONTROLLED=no

I can't surf the web when I reboot. How do I start my network again?

systemctl restart network.service

The network isn't connected. Let's see the status.

network.service - LSB: Bring up/down networking
       Loaded: loaded (/etc/rc.d/init.d/network)
       Active: active (exited) since Wed 2015-08-26 17:21:53 CST; 21s ago
      Process: 3494 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS)
      Process: 3674 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)


Aug 26 17:21:50 localhost.localdomain network[3674]: Bringing up loopback interface:  Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Aug 26 17:21:50 localhost.localdomain network[3674]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Aug 26 17:21:50 localhost.localdomain network[3674]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Aug 26 17:21:50 localhost.localdomain network[3674]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Aug 26 17:21:50 localhost.localdomain network[3674]: [  OK  ]
Aug 26 17:21:53 localhost.localdomain network[3674]: Bringing up interface enp2s0:  [  OK  ]
Aug 26 17:21:53 localhost.localdomain systemd[1]: Started LSB: Bring up/down networking.

Here is my ifcfg-lo file:

cat /etc/sysconfig/network-scripts/ifcfg-lo
DEVICE=lo
IPADDR=127.0.0.1
NETMASK=255.0.0.0
NETWORK=127.0.0.0
# If you're having problems with gated making 127.0.0.0/8 a martian,
# you can change this to something else (255.255.255.255, for example)
BROADCAST=127.255.255.255
ONBOOT=yes
NAME=loopback

Why can't I load it? How do I set my IP address static and make it connect to the Internet properly?

  • there must be a NetworkManager service. Try service NetworkManager restart (or) service network-manager restart – Madhavan Aug 26 '15 at 3:52
  • please read bugs.centos.org/view.php?id=7351, add "TYPE=Loopback" to avoid "Could not load file....) – munish Mar 7 '16 at 23:09
1

CentOS 7 switched to systemd - use systemctl restart network.service to restart your network.

For static network settings like yours you may want to install NetworkManager-config-server RPM package using yum

  • It is more complicated than you think,please see my re-edited post. – it_is_a_literature Aug 26 '15 at 10:07
  • Maybe the selinux labels are broken. Try restorecon -FRv /etc/sysconfig/ and reload network. – MLu Aug 26 '15 at 11:44
0

it cost me also lot of time but at least trying this:

# service NetworkManager stop
Redirecting to /bin/systemctl stop NetworkManager.service
# chkconfig NetworkManager off

removed the lo error since the Manger was blocking it.

Just I still dont get internet on my fresh centos 7 installation

0

Looks like you disabled NetworkManager and now your ifcfg-enp0s2 file doesn't have enough information in it. In addition to:

BOOTPROTO="static"
IPADDR=192.168.1.105
NETMASK=255.255.255.0
NM_CONTROLLED=no

You also need:

# Specify the default gateway
GATEWAY=<ip of your router>
# Bring the interface up on boot
ONBOOT=yes
# Specify your dns server
DNS1=<ip of your router>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.