RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1650433 - Route lost when restart network interface on Redhat 7.6
Summary: Route lost when restart network interface on Redhat 7.6
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: NetworkManager
Version: 7.6
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Beniamino Galvani
QA Contact: Desktop QE
URL:
Whiteboard:
Depends On:
Blocks:
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:
Environment:
Last Closed: 2019-08-06 13:16:25 UTC
Target Upstream Version:
Embargoed:


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


Links
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

nor

  # 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:

https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=f069c98cc95494891215ddf261661afb742744ba

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.

https://access.redhat.com/errata/RHBA-2019:2302


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