Bug 1650433 - Route lost when restart network interface on Redhat 7.6
Summary: Route lost when restart network interface on Redhat 7.6
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: NetworkManager
Version: 7.6
Hardware: x86_64
OS: Linux
Target Milestone: rc
: ---
Assignee: Beniamino Galvani
QA Contact: Desktop QE
Depends On:
TreeView+ depends on / blocked
Reported: 2018-11-16 07:22 UTC by zhouweigang09
Modified: 2019-08-06 13:16 UTC (History)
8 users (show)

Fixed In Version: NetworkManager-1.18.0-0.3.20190408git43d9187c14.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-08-06 13:16:25 UTC
Target Upstream Version:

Attachments (Terms of Use)
Route lost after restart interface (15.42 KB, image/png)
2018-11-16 07:22 UTC, zhouweigang09
no flags Details

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2302 0 None None None 2019-08-06 13:16:51 UTC

Description zhouweigang09 2018-11-16 07:22:57 UTC
Created attachment 1506330 [details]
Route lost after restart interface

Description of problem:
We added some iscsi cards to the server and configured network on the interface, we use "ifconfig down" and "ifconfig up" command to restart the interface,and the route on the interface lost

Version-Release number of selected component (if applicable):
Redhat 7.6 Native

How reproducible:

Steps to Reproduce:
1.add iscsi card to the server
2.configure network on the interface
3.restart the interface

Actual results:
The route lost

Expected results:
The network configuration won't lost after restarting

Additional info:
See the attachment for details

Comment 2 Thomas Haller 2018-11-16 08:05:04 UTC
- NetworkManager is a daemon to configure the network based on connection profiles (type `nmcli `, for an overview of the NetworkManager configuration -- in case you are actually using NetworkManager).

- ifup/ifdown are scripts provided by initscripts package. initscripts provide an alternative way for configuring network based on ifcfg files in /etc/sysconfig/network-scripts. As such, it is also profile based (if you understand the ifcfg files as a profile).
Note, that if NetworkManager is enabled, then initscripts' ifup/ifdown command may (depending on configuration) call to NetworkManager to perform the action, instead of doing it themselves.

- ifconfig/route are deprecated tools which directly talk to kernel to configure networking devices, addresses and routes. Nowadays, it would be advisable to use iproute2 (ip link, ip addr, ip route) instead.

Anyway. So, your initial state is that your network is configured (be it via NetworkManager, initscripts, or even something else). Then you issue

  # ifconfig enp3s0f0 down

As said, this is not the same as

  # ifdown enp3s0f0


  # nmcli device disconnect enp3s0f0

Instead it is the same as:

  # ip link set enp3s0f0 down

which instructs kernel to set the interface down (as far as kernel is concerned, not as far as NetworkManager/iniscripts are concerned). When an interface goes down, kernel will delete all IPv4 routes on that interface. When you bring the interface up again (ifconfig enp3s0f0 up), somebody needs to re-add the lost route.

The first point: just don't do that! `ifconfig ... down` is the wrong thing. Issue either

   # ifdown enp3s0f0
   # ifup enp3s0f0

or (if you use NetworkManager) use `nmcli device connect enp3s0f0`. Or if you really want to manually configure the interface in kernel (with iproute2, ifconfig), then you should be prepared to manually re-add the route as well.

If your system is configured via initscripts (without NetworkManager), then what you are doing is not fixable. initscripts have no understanding what is happening and they don't know that you bring the interface up again and that they should do something about that.

If your system is configured via NetworkManager, then indeed NM will noticed that the link goes down, it will notices that it comes up again, and it should restore the route. That is similar to https://bugzilla.redhat.com/show_bug.cgi?id=1548237#c2 and should be improved.

Are you using NetworkManager or plain initscripts? What gives `nmcli device`?

TL;DR: don't call `ifconfig enp3s0f0 down`. It's probably not what you want.

Comment 3 zhouweigang09 2018-11-19 02:00:35 UTC
Hi Thomas

Thanks a lot for you help,it solved my problem.

Comment 4 Beniamino Galvani 2018-11-22 10:56:27 UTC
This upstream commit should improve NM behavior to note remove routes when the interface is brought down manually:


I think we should include it in RHEL 7.7.

Comment 5 Thomas Haller 2018-11-26 13:11:03 UTC
Also: let's not needlessly take the interface down: bug 1639274 and https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/54

Comment 9 Vladimir Benes 2019-04-18 10:28:11 UTC
This was fixed along the way in NetworkManager-1.12.0-10.el7_6. The functionality is preserved in 1.18 and ifconfig down/up doesn't break any routing.

Comment 11 errata-xmlrpc 2019-08-06 13:16:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.