change_resolv_conf() function in network-functions corrupts /etc/resolv.conf leaving only option settings

Solution Verified - Updated -

Issue

  • The function change_resolv_conf() in /etc/sysconfig/network-scripts/network-functions deletes all rows from /etc/resolv.conf except options when it's defined. For example, consider /etc/resolv.conf has the following contents:

    # cat /etc/resolv.conf
    ; generated by /sbin/dhclient-script
    search pnq.redhat.com. redhat.com. csb
    nameserver 192.168.10.10
    nameserver 192.168.10.11
    options timeout:1
    
  • By restarting the network service or recycling a network interface, the contents gets rewritten as follows:

    # cat /etc/resolv.conf
    options timeout:1
    

Environment

  • Red Hat Enterprise Linux 7
    • initscripts-9.49.24-1.el7 (or older)
    • grep version 2.20 (or newer)
  • Red Hat Enterprise Linux 6
    • initscripts < 9.03.49-1.el6 (or older)
    • grep version 2.20 (or newer)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content