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 1610411 - PEERDNS=no does not avoid to updating /etc/resolv.conf
Summary: PEERDNS=no does not avoid to updating /etc/resolv.conf
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: initscripts
Version: 7.5
Hardware: All
OS: Linux
urgent
medium
Target Milestone: rc
: ---
Assignee: David Kaspar // Dee'Kej
QA Contact: Daniel Rusek
Mirek Jahoda
URL:
Whiteboard:
Depends On:
Blocks: 1622040 1622533
TreeView+ depends on / blocked
 
Reported: 2018-07-31 14:46 UTC by João Avelino Bellomo Filho
Modified: 2021-12-10 16:50 UTC (History)
7 users (show)

Fixed In Version: initscripts-9.49.46-1.el7
Doc Type: Bug Fix
Doc Text:
Previously, a condition for handling the RESOLV_MODS option was not set correctly. As a consequence, the /etc/resolv.conf could be updated even if the PEERDNS option was set to "no". With this update, the condition has been fixed, and "PEERDNS=no" is no longer ignored.
Clone Of:
: 1622040 1622533 (view as bug list)
Environment:
Last Closed: 2018-10-30 10:16:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1623196 0 low CLOSED search option in /etc/resolv.conf is not persistent 2021-09-09 15:26:12 UTC
Red Hat Knowledge Base (Solution) 3628101 0 Troubleshoot None ifup-post ignores PEERDNS=no and updates /etc/resolv.conf 2019-04-18 07:58:15 UTC
Red Hat Product Errata RHBA-2018:3131 0 None None None 2018-10-30 10:16:37 UTC

Internal Links: 1623196

Description João Avelino Bellomo Filho 2018-07-31 14:46:36 UTC
Description of problem:

The PEERDNS set as 'no' is not avoiding the change of 'resolv.conf' file.

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

initscripts-9.49.41-1.el7.x86_64

How reproducible:


Steps to Reproduce:

1. Disable the NetworkManager service:

# systemctl stop NetworkManager
# systemctl disable NetworkManager

2. Configure a network device with a static IP address and DNS entries:

=== ifcfg-ens3 ===
NAME=ens3
GATEWAY=192.168.122.1
DNS1=8.8.8.8
DNS2=8.8.4.4
DEVICE=ens3
ONBOOT=yes
USERCTL=no
BOOTPROTO=static
NETMASK=255.255.255.0
IPADDR=192.168.122.100
PEERDNS=yes

3. Restart the network service:

# systemctl restart network

4. Check the current 'resolv.conf' content:

# cat /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

5. Change the PEERDNS to 'no':

=== ifcfg-ens3 ===
NAME=ens3
GATEWAY=192.168.122.1
DNS1=8.8.8.8
DNS2=8.8.4.4
DEVICE=ens3
ONBOOT=yes
USERCTL=no
BOOTPROTO=static
NETMASK=255.255.255.0
IPADDR=192.168.122.100
PEERDNS=no

6. Change the 'resolv.conf' content. For example:

# cat /etc/resolv.conf

nameserver 8.8.8.8
nameserver 192.168.1.1

7. Restart the network service:

# systemctl restart network

8. Check the 'resolv.conf' content:

# cat /etc/resolv.conf

Actual results:

nameserver 8.8.8.8
nameserver 8.8.4.4


Expected results:

nameserver 8.8.8.8
nameserver 192.168.1.1

Additional info:

A previous version of the initscripts had a condition where was checked if the definition of 'RESOLV_MODS' was empty:

...
if ! is_false "$PEERDNS" || [ -n "$RESOLV_MODS" ] && ! is_false "$RESOLV_MODS"; then
...

The current version only checks if the 'RESOLV_MODS' is 'no':
...
if ! is_false "${PEERDNS}" || ! is_false "${RESOLV_MODS}"; then
...

But the 'RESOLV_MODS' is not defined. So, it is treated as 'yes'.

A single way to deal with the issue is to define the default value as 'no' if it is empty:

if ! is_false "${PEERDNS}" || ! is_false "${RESOLV_MODS:-no}"; then

Comment 3 David Kaspar // Dee'Kej 2018-08-20 12:24:08 UTC
(In reply to João Avelino Bellomo Filho from comment #0)
> Description of problem:
> 
> The PEERDNS set as 'no' is not avoiding the change of 'resolv.conf' file.
> 
> Version-Release number of selected component (if applicable):
> 
> initscripts-9.49.41-1.el7.x86_64
> 
> How reproducible:
> 
> 
> Steps to Reproduce:
> 
> 1. Disable the NetworkManager service:
> 
> # systemctl stop NetworkManager
> # systemctl disable NetworkManager
> 
> 2. Configure a network device with a static IP address and DNS entries:
> 
> === ifcfg-ens3 ===
> NAME=ens3
> GATEWAY=192.168.122.1
> DNS1=8.8.8.8
> DNS2=8.8.4.4
> DEVICE=ens3
> ONBOOT=yes
> USERCTL=no
> BOOTPROTO=static
> NETMASK=255.255.255.0
> IPADDR=192.168.122.100
> PEERDNS=yes
> 
> 3. Restart the network service:
> 
> # systemctl restart network
> 
> 4. Check the current 'resolv.conf' content:
> 
> # cat /etc/resolv.conf
> 
> nameserver 8.8.8.8
> nameserver 8.8.4.4
> 
> 5. Change the PEERDNS to 'no':
> 
> === ifcfg-ens3 ===
> NAME=ens3
> GATEWAY=192.168.122.1
> DNS1=8.8.8.8
> DNS2=8.8.4.4
> DEVICE=ens3
> ONBOOT=yes
> USERCTL=no
> BOOTPROTO=static
> NETMASK=255.255.255.0
> IPADDR=192.168.122.100
> PEERDNS=no
> 
> 6. Change the 'resolv.conf' content. For example:
> 
> # cat /etc/resolv.conf
> 
> nameserver 8.8.8.8
> nameserver 192.168.1.1
> 
> 7. Restart the network service:
> 
> # systemctl restart network
> 
> 8. Check the 'resolv.conf' content:
> 
> # cat /etc/resolv.conf
> 
> Actual results:
> 
> nameserver 8.8.8.8
> nameserver 8.8.4.4
> 
> 
> Expected results:
> 
> nameserver 8.8.8.8
> nameserver 192.168.1.1
> 
> Additional info:
> 
> A previous version of the initscripts had a condition where was checked if
> the definition of 'RESOLV_MODS' was empty:
> 
> ...
> if ! is_false "$PEERDNS" || [ -n "$RESOLV_MODS" ] && ! is_false
> "$RESOLV_MODS"; then
> ...
> 
> The current version only checks if the 'RESOLV_MODS' is 'no':
> ...
> if ! is_false "${PEERDNS}" || ! is_false "${RESOLV_MODS}"; then
> ...
> 
> But the 'RESOLV_MODS' is not defined. So, it is treated as 'yes'.
> 
> A single way to deal with the issue is to define the default value as 'no'
> if it is empty:
> 
> if ! is_false "${PEERDNS}" || ! is_false "${RESOLV_MODS:-no}"; then

Sorry for the late reply, João. I had a vacation last week. Anyway I was looking into the code and you are right. We introduced a new bug with the last patch for that section of code...

Since the is_true functions returns true value only if RESOLV_MODS variable is both set and it has true value, then changing the condition to:

if ! is_false "${PEERDNS}" || is_true "${RESOLV_MODS}"; then

should work as before...

I will prepare a patch for this.

Comment 5 David Kaspar // Dee'Kej 2018-08-20 12:47:07 UTC
https://github.com/fedora-sysv/initscripts/pull/238

Comment 14 errata-xmlrpc 2018-10-30 10:16:21 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-2018:3131


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