Hi,
I recently tried to edit (as su) my
ifcfg-enp0s31f6
in folder /etc/sysconfig/network-scripts
ifcfg-enp0s31f6
I wanted to modify the file to create a static IP address. I made a backup copy before editing the file.
After making modifications to the file I ran the following command
systemctl restart network
I opened up my router using the Ip address in the file but have been unable to connect with Filezilla to FTP and out through my firewall.
I copied the backup of original config file ifcfg-enp0s31f6 back into the directory /etc/sysconfig/network-scripts.
Now when I run «systemctl restart network» I get errors which are in listed below after running
«Job for network.service failed because the control process exited with error code. See «systemctl status network.service» and «journalctl -xe» for details.»
When I run
systemctl status network.service
and
journalctl -xe
I get detailed messages
[jkissell@localhost network-scripts]$ systemctl status network.service
● network.service — LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2022-02-21 15:53:12 MST; 14min ago
Docs: man:systemd-sysv-generator(8)
Process: 5074 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
Feb 21 15:53:12 localhost.localdomain network[5074]: RTNETLINK answers: File exists
Feb 21 15:53:12 localhost.localdomain network[5074]: RTNETLINK answers: File exists
Feb 21 15:53:12 localhost.localdomain network[5074]: RTNETLINK answers: File exists
Feb 21 15:53:12 localhost.localdomain network[5074]: RTNETLINK answers: File exists
Feb 21 15:53:12 localhost.localdomain network[5074]: RTNETLINK answers: File exists
Feb 21 15:53:12 localhost.localdomain network[5074]: RTNETLINK answers: File exists
Feb 21 15:53:12 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1
Feb 21 15:53:12 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
Feb 21 15:53:12 localhost.localdomain systemd[1]: Unit network.service entered failed state.
Feb 21 15:53:12 localhost.localdomain systemd[1]: network.service failed.
[jkissell@localhost network-scripts]$ journalctl -xe
Feb 21 16:10:25 localhost.localdomain dhclient[6098]: exiting.
Feb 21 16:10:25 localhost.localdomain network[5908]: Bringing up interface myqwest4255: [ OK ]
Feb 21 16:10:25 localhost.localdomain network[5908]: RTNETLINK answers: File exists
Feb 21 16:10:25 localhost.localdomain network[5908]: RTNETLINK answers: File exists
Feb 21 16:10:25 localhost.localdomain network[5908]: RTNETLINK answers: File exists
Feb 21 16:10:25 localhost.localdomain network[5908]: RTNETLINK answers: File exists
Feb 21 16:10:25 localhost.localdomain network[5908]: RTNETLINK answers: File exists
Feb 21 16:10:25 localhost.localdomain network[5908]: RTNETLINK answers: File exists
Feb 21 16:10:25 localhost.localdomain network[5908]: RTNETLINK answers: File exists
Feb 21 16:10:25 localhost.localdomain network[5908]: RTNETLINK answers: File exists
Feb 21 16:10:25 localhost.localdomain network[5908]: RTNETLINK answers: File exists
Feb 21 16:10:25 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1
Feb 21 16:10:25 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
— Subject: Unit network.service has failed
Can this be fixed so when I run
systemctl restart network
this restarts the network without errors?
What was wrong with my process?
Any suggestions on how to setup a static IP address to would be helpful?
Thanks
John Kissell
[email address redacted, you really don’t want all the SPAM)
Text
[root@64-140-169-250 ~]# systemctl restart network Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details. [root@64-140-169-250 ~]# systemctl status network.service ● network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2017-04-21 10:47:35 PDT; 47s ago Docs: man:systemd-sysv-generator(8) Process: 23715 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE) Apr 21 10:47:35 64-140-169-250.static.webnx.com network[23715]: RTNETLINK answers: File exists Apr 21 10:47:35 64-140-169-250.static.webnx.com network[23715]: RTNETLINK answers: File exists Apr 21 10:47:35 64-140-169-250.static.webnx.com network[23715]: RTNETLINK answers: File exists Apr 21 10:47:35 64-140-169-250.static.webnx.com network[23715]: RTNETLINK answers: File exists Apr 21 10:47:35 64-140-169-250.static.webnx.com network[23715]: RTNETLINK answers: File exists Apr 21 10:47:35 64-140-169-250.static.webnx.com network[23715]: RTNETLINK answers: File exists Apr 21 10:47:35 64-140-169-250.static.webnx.com systemd[1]: network.service: control process exited, code=exited status=1 Apr 21 10:47:35 64-140-169-250.static.webnx.com systemd[1]: Failed to start LSB: Bring up/down networking. Apr 21 10:47:35 64-140-169-250.static.webnx.com systemd[1]: Unit network.service entered failed state. Apr 21 10:47:35 64-140-169-250.static.webnx.com systemd[1]: network.service failed.
Below is one of the file with the main IP of the server; [B]ifcfg-enp2s0[/B]
Text
TYPE=Ethernet BOOTPROTO=none DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=enp2s0 UUID=408bc797-50a8-4b41-8991-d1c7386929d4 DEVICE=enp2s0 ONBOOT=yes IPADDR=xx.xxx.xxx.xxx PREFIX=29 GATEWAY=xx.xxx.xxx.xxx DNS1=4.2.2.2 DNS2=8.8.8.8 IPV6_PEERDNS=yes IPV6_PEERROUTES=yes
And below is a copy of one of the modified file by nmtui
Text
# Generated by dracut initrd NAME="enp3s0" DEVICE="enp3s0" ONBOOT=yes NETBOOT=yes UUID="f1874649-c01c-4888-af29-6e3618051d21" IPV6INIT=yes BOOTPROTO=dhcp TYPE=Ethernet IPADDR=xx.xxx.xxx.xxx PREFIX=32 DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no
Thanks for your help and support.
Job for network.service failed because the control process exited with error code. See “systemctl status network.service” and “journalctl -xe” for details.
1、 The xshell is down and the reconnection failed. First Ping to see if the network is connected. Second, restart the network service and find an error. Third, view the error information according to the prompt. Fourth, solutions. First, check whether the configuration file is wrong. Second, there may be a conflict with the network manager service. Just close the service directly
3. If the two methods 1 and 2 still fail, try to delete all the other irrelevant network card location files under/etc/sysconfig/network scripts to avoid unnecessary influence. 5. Verify the network
Standby for a while, found that xshell connection failed, found that network connection failed, and restart failed.
1、 The xshell is down and the reconnection failed. Ping first to see if the network is connected
[[email protected] ~]# ping www.google.com
ping: www.google.com: Unknown name or service
2、 Restart the network service and find an error
[[email protected] ~]# systemctl restart network
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
3、 Check the error information according to the prompt
[[email protected] ~]# systemctl status network.service
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since 四 2021-06-03 05:23:42 CST; 23s ago
Docs: man:systemd-sysv-generator(8)
Process: 8821 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
6月 03 05:23:42 db01 network[8821]: RTNETLINK answers: File exists
6月 03 05:23:42 db01 network[8821]: RTNETLINK answers: File exists
6月 03 05:23:42 db01 network[8821]: RTNETLINK answers: File exists
6月 03 05:23:42 db01 network[8821]: RTNETLINK answers: File exists
6月 03 05:23:42 db01 network[8821]: RTNETLINK answers: File exists
6月 03 05:23:42 db01 network[8821]: RTNETLINK answers: File exists
6月 03 05:23:42 db01 systemd[1]: network.service: control process exited, code=e...s=1
6月 03 05:23:42 db01 systemd[1]: Failed to start LSB: Bring up/down networking.
6月 03 05:23:42 db01 systemd[1]: Unit network.service entered failed state.
6月 03 05:23:42 db01 systemd[1]: network.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
4、 Solutions
1. Check whether the configuration file is wrong
[[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
NAME=ens33
UUID=b5672928-cbbb-4428-a752-8bd9c14098e7
····
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.10.102
PREFIX=24
GATEWAY=192.168.10.2
DNS1=114.114.114.114
DNS2=8.8.8.8
DNS3=119.29.29.29
[[email protected] ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 00:0c:29:3f:0f:29 brd ff:ff:ff:ff:ff:ff
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:3a:15:b7 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:3a:15:b7 brd ff:ff:ff:ff:ff:ff
2. There may be a conflict with the NetworkManager service. Just close the service directly
[[email protected] ~]# systemctl stop NetworkManager
[[email protected] ~]# systemctl restart network
3. If both methods 1 and 2 fail after verification, try to delete all other irrelevant network card location files under/etc/sysconfig/network scripts to avoid unnecessary influence
[[email protected] network-scripts]# ls
ifcfg-ens33 ifdown-ipv6 ifdown-tunnel ifup-isdn ifup-TeamPort
ifcfg-ens33.bak ifdown-isdn ifup ifup-plip ifup-tunnel
ifcfg-lo ifdown-post ifup-aliases ifup-plusb ifup-wireless
ifdown ifdown-ppp ifup-bnep ifup-post init.ipv6-global
ifdown-bnep ifdown-routes ifup-eth ifup-ppp network-functions
ifdown-eth ifdown-sit ifup-ib ifup-routes network-functions-ipv6
ifdown-ib ifdown-Team ifup-ippp ifup-sit
ifdown-ippp ifdown-TeamPort ifup-ipv6 ifup-Team
5、 Verification Network
[[email protected] ~]# ping www.google.com
PING www.baidu.com (39.156.66.14) 56(84) bytes of data.
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=1 ttl=128 time=55.8 ms
64 bytes from 39.156.66.14 (39.156.66.14): icmp_seq=2 ttl=128 time=42.8 ms
^C
--- www.baidu.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 42.825/49.312/55.800/6.491 ms
[[email protected] ~]#
In this article, we will look into the possible reasons of getting network.service failed to start LSB: Bring up/down networking error in RHEL/CentOS 7/8 based systems and the number of solutions that can be done to solve this issue. This error is quite common now a days for all the Linux Professionals to deal with. Some nice day you might want to change certain settings in your network related configuration file and suddenly after restarting the network service you will start getting the network.service failed to start LSB: Bring up/down networking error. We will try to understand all the possible reasons and the solutions that can done as we go through below details.
Sometimes when you try to restart your network service then you probably end up with the error "network.service Failed to start LSB: Bring up/down networking"
as can be seen below.
[root@localhost ~]# systemctl status network.service -l network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled) Active: failed (Result: exit-code) since Fri... 23min ago Docs: man:systemd-sysv-generator(0) Process: 1161 ExecStart=/etc/rc.d/init.dnetwork start (code=exited, status=1/FAILURE) Jun 12 04:08:28 localhost.localdomain systemd[1]: starting LSB: Bring up/down networking... Jun 12 04:08:28 localhost.localdomain network[1161]: Bringing up loopback interface: [ OK ] Jun 12 04:08:28 localhost.localdomain network[1161]: Bringing up interface enp0s3: ERROR : [/etc/sysconfig/network-scripts/ifup-eth] Device has different MAC address than expected, ignoring. Jun 12 04:08:28 localhost.localdomain network[1161]: [FAILED] Jun 12 04:08:28 localhost.localdomain systemd[1]: network.service control process exited, code=exited status=1 Jun 12 04:08:28 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking. Jun 12 04:08:28 localhost.localdomain systemd[1]: Unit network.service entered failed state. Jun 12 04:08:28 localhost.localdomain systemd[1]: network.service failed.
This error could occur due to various reasons. We will try to see all of the possible reasons due to which this error could occur and what can be done to resolve this issue. For the above "network.service Failed to start LSB: Bring up/down networking"
error, you might observe it is due to incorrect MAC Address. After providing correct MAC Address in /etc/sysconfig/network-scripts/ifcfg-enp0s3
and restarting network service should resolve this error.
[root@localhost ~]# systemctl status network -l ● network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled) Active: active (exited) since Fri 2020-06-12 04:08:37 EDT; 1min 4s ago Docs: man:systemd-sysv-generator(8) Process: 8767 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS) Process: 8951 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS) Jun 12 04:08:28 localhost.localdomain systemd[1]: Stopped LSB: Bring up/down networking. Jun 12 04:08:28 localhost.localdomain systemd[1]: Starting LSB: Bring up/down networking... Jun 12 04:08:29 localhost.localdomain network[8951]: Bringing up loopback interface: [ OK ] Jun 12 04:08:33 localhost.localdomain network[8951]: Bringing up interface enp0s3: [ OK ] Jun 12 04:08:37 localhost.localdomain network[8951]: Bringing up interface enp0s3.bkp: RTNETLINK answers: File exists Jun 12 04:08:37 localhost.localdomain network[8951]: [ OK ] Jun 12 04:08:37 localhost.localdomain systemd[1]: Started LSB: Bring up/down networking.
In some other case you might see below "RNETLINK answers: File exists"
error. This error message might not be a error and this messages might be caused by static routes. When starting networking and because the static routes already exist so you will see the messages getting printed for each static route the script /etc/rc.d/init.d/network
will try to add.
[root@localhost ~]# systemctl status network.service network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network) Active: failed (Result: exit-code) since Fri 2019-06-12 22:30:46 GMT; 28s ago Process: 3657 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE) Jun 12 04:08:28 localhost.localdomain network[4857]: RTNETLINK answers: File exists Jun 12 04:08:28 localhost.localdomain network[4857]: RTNETLINK answers: File exists Jun 12 04:08:28 localhost.localdomain network[4857]: RTNETLINK answers: File exists Jun 12 04:08:28 localhost.localdomain network[4857]: RTNETLINK answers: File exists Jun 12 04:08:28 localhost.localdomain network[4857]: RTNETLINK answers: File exists Jun 12 04:08:28 localhost.localdomain network[4857]: RTNETLINK answers: File exists Jun 12 04:08:28 localhost.localdomain network[4857]: RTNETLINK answers: File exists Jun 12 04:08:28 localhost.localdomain systemd[1]: network.service: control process exited, code=exited status=1 Jun 12 04:08:28 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking. Jun 12 04:08:28 localhost.localdomain systemd[1]: Unit network.service entered failed state.
You can also see above messages when root filesystem has the _netdev
mount option enabled. If the above messages are due to this reason then you need to look at the /etc/rc.d/init.d/network
script before doing anything. In case if this is not the reason then you can try disabling the NetworkManager
by using below systemctl
commands and check the status again.
[root@localhost ~]# systemctl stop NetworkManager [root@localhost ~]# systemctl disable NetworkManager [root@localhost ~]# systemctl status NetworkManager -l ● NetworkManager.service - Network Manager Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled) Active: inactive (dead) since Fri 2020-06-12 05:43:49 EDT; 2s ago Docs: man:NetworkManager(8) Process: 11686 ExecStart=/usr/sbin/NetworkManager --no-daemon (code=exited, status=0/SUCCESS) Main PID: 11686 (code=exited, status=0/SUCCESS) Jun 12 05:43:39 localhost.localdomain NetworkManager[11686]: <info> [1591955019.5607] device (virbr0): Activation: successful, device activated. Jun 12 05:43:39 localhost.localdomain NetworkManager[11686]: <info> [1591955019.5618] device (virbr0-nic): state change: secondaries -> activated (reason 'none', sys-iface-state: 'external') Jun 12 05:43:39 localhost.localdomain NetworkManager[11686]: <info> [1591955019.5758] device (virbr0-nic): Activation: successful, device activated. Jun 12 05:43:39 localhost.localdomain NetworkManager[11686]: <info> [1591955019.5775] manager: startup complete Jun 12 05:43:49 localhost.localdomain NetworkManager[11686]: <info> [1591955029.9160] caught SIGTERM, shutting down normally. Jun 12 05:43:49 localhost.localdomain systemd[1]: Stopping Network Manager... Jun 12 05:43:49 localhost.localdomain NetworkManager[11686]: <info> [1591955029.9181] manager: NetworkManager state is now CONNECTED_LOCAL Jun 12 05:43:49 localhost.localdomain NetworkManager[11686]: <info> [1591955029.9195] device (virbr0): bridge port virbr0-nic was detached Jun 12 05:43:49 localhost.localdomain NetworkManager[11686]: <info> [1591955029.9345] exiting (success) Jun 12 05:43:49 localhost.localdomain systemd[1]: Stopped Network Manager.
NOTE:
Please be careful in disabling NetworkManager
in Production Systems as it might be disastrous sometimes. Please rethink before running above command.
In some cases this issue might happen when you will set BOOTPROTO=static
for using static IP Addresses where you will provide the manual IP Address, netmask and other details. This kind of issues will get resolved when you set BOOTPROTO=none
instead of static and then just restart your network service.
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=none IPADDR=192.168.0.103 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 DNS1=8.8.8.8 DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=enp0s3 UUID=0b881737-d9c9-4a69-b29a-3193877817e5 DEVICE=enp0s3 ONBOOT=yes
Now just restart the network service to reflect the changes.
[root@localhost ~]# service network restart Restarting network (via systemctl): [ OK ]
In case you are still getting the same error then you also might want to check if /etc/sysconfig/network
file is available in your system. Usually this file gets created by the Anaconda daemon but if it is not there then you can simply create it by running touch /etc/sysconfig/network
command as shown below.
[root@localhost ~]# touch /etc/sysconfig/network
If you are still not understanding the issue due to which you are getting network.service failed to start LSB: Bring up/down networking error then you need to take a look at the journalctl output to understand the error further.
[root@localhost ~]# journalctl -xe
Hopefully, this article has helped you in solving network.service failed to start LSB: Bring up/down networking error. Please let me know your feedback on the comment box.
Popular Recommendations:-
How to Compare Strings in Python
How to Enable or Disable SELinux Temporarily or Permanently on RedHat/CentOS 7/8
10 Popular Examples of sudo command in Linux(RedHat/CentOS 7/8)
9 useful w command in Linux with Examples
network.service failed to start LSB: Bring up/down networking — CentOS 7
Create a Self Signed Certificate using OpenSSL
11 Useful PSSH Command Examples to Perform Parallel SSH in Multiple Linux Servers
Solved: network.service failed to start LSB: Bring up/down networking
При выполнении команды ping в Linux может возникнуть системная ошибка. Причина её неочевидная.
Причина кроется в системе разрешения имён.
1. Отключение WINS:
Возможная причина ошибки — в использовании службы WINS при разрешении имён компьютеров, которое включается перед разрешением DNS, и «рушит» всю цепочку определения IP адреса по имени.
1) с использованием команды sudo nano исправить файл «/etc/nsswitch.conf»:
sudo nano /etc/nsswitch.conf
2) полностью удалить из файла «nsswitch.conf» упоминание «wins«.
3) Перезапустить службу сети:
sudo service networking restart
или
sudo systemctl restart networking
2. Указание правильного DNS севера
Проверка, что разрешение имён проходи корректно:
nslookup ya.ru
Если возникла ошибка
nslookup ya.ru
Server: 127.0.0.53
Address: 127.0.0.53#53
server can’t find ya.ru: SERVFAIL
значит проблема в локальной службе DNS. Исправить ошибку можно двумя способами:
СПОСОБ 1:
1) запускаем терминал и переходим в папку
cd /etc/resolvconf/resolv.conf.d
2) редактируем файл base
nano base
или одной командой с указанием полного имени файла:
sudo nano /etc/resolvconf/resolv.conf.d/base
Внимание! Если указать неправильный IP адрес сервера, возникнет ошибка «Временный сбой в разрешении имен»
Поэтому лучше файл base оставить пустым — см. РЕШЕНИЕ 2.
В файле base
можно указать или исправить нестандартный DNS сервер:
Например,
nameserver 77.88.8.1
или, например, DNS своего провайдера (109.172.10.70 — DNS Ростелеком).
СПОСОБ 2:
То же самое проделываем с файлом /etc/network/interfaces, если в нём указан параметр dns-nameservers:
cat /etc/network/interfaces | grep dns-nameservers
и редактируем ip-адреса серверов DNS — можно указать несколько через пробел. Например:
dns-nameservers 192.168.0.1 77.88.8.1 8.8.8.8
Сохраняем изменения в файл interfaces
.
3) после этого перезапускаем службу «networking»:
sudo service networking restart
или
sudo systemctl restart networking
Диагностика сетевой службы «networking.service»
sudo systemctl status networking
sudo journalctl -xeu networking.service
3. Устранение ошибки «Job for networking.service failed because the control process exited with error code.»
РЕШЕНИЕ:
sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager
4. Устранение ошибок «RTNETLINK answers: File exists ifup: failed to bring up» и «Произошел сбой юнита networking.service» и «systemd[1]: Failed to start Raise network interfaces.»
РЕШЕНИЕ:
sudo ip addr flush dev enp2s0
sudo systemctl restart networking
5. Устраняем причину ошибки «Временный сбой в разрешении имен» и «ping: ya.ru: Временный сбой в разрешении имен»
Ищем ошибки в файлах /etc/resolvconf/resolv.conf.d/base
и /etc/network/interfaces
.
Файл /etc/network/interfaces:
Настройка для статического IP адреса ПК:
auto lo
iface lo inet loopback
auto enp2s0
allow-hotplug enp2s0
iface enp2s0 inet static
address 192.168.0.70
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 192.168.0.1 77.88.8.1 8.8.8.8
dns-search local
Настройка для динамического ip-адреса ПК (DHCP):
auto lo
iface lo inet loopback
allow-hotplug enp2s0
auto enp2s0
iface eth0 inet dhcp
Файл /etc/resolvconf/resolv.conf.d/base
: строчку nameserver
лучше закомментировать:
# nameserver 192.168.0.1
Для применения изменений выполнить команды
sudo systemctl restart networking
6. Убираем апплет «Network Manager» из автозагрузки и панели задач
Если используется статический IP-адрес, апплет «Network Manager» не нужен, он занимает свободное место не экране.
В LXQT
Пуск — Настройки — Настройки LXQt — Настройки сеанса — снять галочку против «Сеть» (/etc/xdg/autostart/nm-applet.desktop), нажать «Закрыть»».
«Пуск» — «Выйти» — «Выйти из системы» и войти снова.
7. Как проверить, динамический или статический IP адрес?
Команда:
ip addr
Вывод команды для динамического IP адреса содержит слово «dynamic».
Похожие публикации
The Problem
Cannot reliably get networking to start on a server when using DHCP:
# sudo /etc/init.d/network restart Restarting network (via systemctl): Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details. [FAILED]
# journalctl -xe Nov 29 18:57:42 hostaname.domain.com dhclient[37653]: exiting. Nov 29 18:57:42 hostaname.domain.com network[37498]: [FAILED] Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com network[37498]: RTNETLINK answers: File Nov 29 18:57:42 hostaname.domain.com systemd[1]: network.service: control pr Nov 29 18:57:42 hostaname.domain.com systemd[1]: Failed to start LSB: Bring -- Subject: Unit network.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit network.service has failed. -- -- The result is failed. Nov 29 18:57:42 hostaname.domain.com systemd[1]: Unit network.service entere Nov 29 18:57:42 hostaname.domain.com systemd[1]: network.service failed. Nov 29 18:57:42 hostaname.domain.com polkitd[36998]: Unregistered Authentica
# sudo systemctl status -l network.service ● network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled) Active: failed (Result: exit-code) since Mon 2016-12-12 12:48:04 EST; 28s ago Docs: man:systemd-sysv-generator(8) Process: 17797 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS) Process: 18067 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE) Dec 12 12:47:58 hostname.domain.com network[18067]: [FAILED] Dec 12 12:47:58 hostname.domain.com network[18067]: Bringing up interface eth1: Dec 12 12:48:04 hostname.domain.com network[18067]: Determining IP information for eth1... failed; no link present. Check cable? Dec 12 12:48:04 hostname.domain.com network[18067]: [FAILED] Dec 12 12:48:04 hostname.domain.com network[18067]: /etc/rc.d/init.d/network: line 88: ifcfg-eth0:DEVICE=eth0: command not found Dec 12 12:48:04 hostname.domain.com network[18067]: /etc/rc.d/init.d/network: line 89: ifcfg-eth0:TYPE=Ethernet: command not found Dec 12 12:48:04 hostname.domain.com systemd[1]: network.service: control process exited, code=exited status=1 Dec 12 12:48:04 hostname.domain.com systemd[1]: Failed to start LSB: Bring up/down networking. Dec 12 12:48:04 hostname.domain.com systemd[1]: Unit network.service entered failed state. Dec 12 12:48:04 hostname.domain.com systemd[1]: network.service failed.
network config file:
# less /etc/sysconfig/network-scripts/ifcfg-eth0 # Generated by parse-kickstart IPV6INIT=yes BOOTPROTO=dhcp DEVICE=eth0 ONBOOT=yes UUID=ccb107d4-4be6-453b-80f2-f803acc5f897 TYPE=Ethernet DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no NAME="System eth0" PEERDNS=yes PEERROUTES=yes DHCP_HOSTNAME= IPV6_PEERDNS=yes IPV6_PEERROUTES=yes
The Solution
A CentOS/RHEL system configured for DHCP networking fails to acquire an IP address whilst restarting the network service. Adding parameter PERSISTENT_DHCLIENT to the network interface configuration file ensures the Oracle Linux DHCP client (dhclient) consistently requests an IP address lease from the DHCP server.
1. Append PERSISTENT_DHCLIENT directive in /etc/sysconfig/network file as follows:
# vi /etc/sysconfig/network NETWORKING=yes PERSISTENT_DHCLIENT=yes
2.Restart Network services:
# /sbin/service network restart ## For CentOS/RHEL 5/6 # /usr/bin/systemctl restart network ## For CentOS/RHEL 7/8
When creating a VM of box type generic/centos7 I’m getting following error message:
Bringing machine 'centos1' up with 'vmware_esxi' provider...
==> centos1: Box 'generic/centos7' could not be found. Attempting to find and install...
centos1: Box Provider: vmware_esxi, vmware, vmware_desktop, vmware_fusion, vmware_workstation
centos1: Box Version: >= 0
==> centos1: Loading metadata for box 'generic/centos7'
centos1: URL: https://vagrantcloud.com/generic/centos7
==> centos1: Adding box 'generic/centos7' (v1.5.0) for provider: vmware_desktop
centos1: Downloading: https://vagrantcloud.com/generic/boxes/centos7/versions/1.5.0/providers/vmware_desktop.box
==> centos1: Successfully added box 'generic/centos7' (v1.5.0) for 'vmware_desktop'!
==> centos1: Virtual Machine will be built.
VMware ovftool 4.3.0 (build-7948156)
==> centos1: --- WARNING : esxi_virtual_network[0] not set, using VM Network
==> centos1: --- --- ESXi Summary ---
==> centos1: --- ESXi host : 70.0.0.67
==> centos1: --- Virtual Network : ["VM Network"]
==> centos1: --- Disk Store : HDD
==> centos1: --- Resource Pool : /
==> centos1: --- --- Guest Summary ---
==> centos1: --- VM Name : centos1
==> centos1: --- Box : generic/centos7
==> centos1: --- Box Ver : 1.5.0
==> centos1: --- Memsize (MB) : 4096
==> centos1: --- CPUS : 2
==> centos1: --- Boot Disk Size : 50GB
==> centos1: --- Storage (GB) : [100]
==> centos1: --- Guest OS type : centos-64
==> centos1: --- --- Guest Build ---
Opening VMX source: /home/as/.vagrant.d/boxes/generic-VAGRANTSLASH-centos7/1.5.0/vmware_desktop/ZZZZ_centos1.vmx
Opening VI target: vi://root@70.0.0.67:443/
Deploying to VI: vi://root@70.0.0.67:443/
Transfer Completed
Completed successfully
==> centos1: --- VMID : 18
==> centos1: --- Extend Boot dsk : 50GB
==> centos1: --- Creating Storage: disk_0.vmdk (100GB)
==> centos1: --- VM has been Powered On...
==> centos1: --- Waiting for state "running"
==> centos1: --- Success, state is now "running"
==> centos1: Setting hostname...
centos1:
centos1: Vagrant insecure key detected. Vagrant will automatically replace
centos1: this with a newly generated keypair for better security.
centos1:
centos1: Inserting generated public key within guest...
centos1: Removing insecure key from the guest if it's present...
centos1: Key inserted! Disconnecting and reconnecting using new SSH key...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
# Update sysconfig
sed -i 's/(HOSTNAME=).*/1centos1/' /etc/sysconfig/network
# Update DNS
sed -i 's/(DHCP_HOSTNAME=).*/1"centos1"/' /etc/sysconfig/network-scripts/ifcfg-*
# Set the hostname - use hostnamectl if available
echo 'centos1' > /etc/hostname
if command -v hostnamectl; then
hostnamectl set-hostname --static 'centos1'
hostnamectl set-hostname --transient 'centos1'
else
hostname -F /etc/hostname
fi
# Prepend ourselves to /etc/hosts
grep -w 'centos1' /etc/hosts || {
sed -i'' '1i 127.0.0.1tcentos1tcentos1' /etc/hosts
}
# Restart network
service network restart
Stdout from the command:
/bin/hostnamectl
Restarting network (via systemctl): [FAILED]
Stderr from the command:
Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
Investigating further
journalctl -eu network
May 09 18:49:43 bazinga.localdomain network[865]: Bringing up loopback interface: [ OK ]
May 09 18:49:44 bazinga.localdomain network[865]: Bringing up interface ens33: Error: Connection activation failed: No suitable dev
May 09 18:49:44 bazinga.localdomain network[865]: [FAILED]
May 09 18:49:44 bazinga.localdomain systemd[1]: network.service: control process exited, code=exited status=1
May 09 18:49:44 bazinga.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
May 09 18:49:44 bazinga.localdomain systemd[1]: Unit network.service entered failed state.
May 09 18:49:44 bazinga.localdomain systemd[1]: network.service failed.
Looking at the VM there is no ens33 interface but rather ens32 interface:
[root@centos1 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:d2:89:48 brd ff:ff:ff:ff:ff:ff
inet 70.0.178.114/16 brd 70.0.255.255 scope global dynamic ens32
valid_lft 172158sec preferred_lft 172158sec
There is a relevant Vagrant issue concerning fusion provider:
hashicorp/vagrant#7533
They have a workaround where you can specify different PCI slot number, as such:
config.vm.provider 'vmware_fusion' do |vf|
vf.vmx['ethernet0.pcislotnumber'] = '33'
end
I was able to do a similar workaround in your provider
dom.vm.provider :vmware_esxi do |v|
v.guest_custom_vmx_settings = [['ethernet0.pcislotnumber','33']]
end
I was wondering if there was a way for a more permanent fix.