LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-07-2014, 02:19 AM   #1
rexus
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Rep: Reputation: 0
Question Which configuration file modified the /etc/resolv.conf ?


Hello Everyone,


I have 2 linux VM in my laptop that has been setup in similar way but one of them behaves differently every time it gets rebooted.
This is OEL6 update 5
I configured 4 interfaces:

eth0 - eth3 is setup with NAT-Network to be able to communicate with other VMs only.
eth4 is setup with bridged network.

I've configured the ifcfg-eth# scripts as follows:
Code:
┌-----------┬-------------------------------------------┬-------------------------------------------┐
│ Interface │ Server 1                                  │ Server 2                                  │
├-----------┼-------------------------------------------┼-------------------------------------------┤
│ eth0      │ DEVICE=eth0                               │ DEVICE=eth0                               │
│           │ TYPE=Ethernet                             │ TYPE=Ethernet                             │
│           │ UUID=8cb50704-029f-469a-b031-da44b4a49b74 │ UUID=f10e7ab5-7b7e-4bcf-9ddb-a2ab439a776a │
│           │ ONBOOT=yes                                │ ONBOOT=yes                                │
│           │ NM_CONTROLLED=no                          │ NM_CONTROLLED=no                          │
│           │ BOOTPROTO=none                            │ BOOTPROTO=none                            │
│           │ IPADDR=10.1.2.71                          │ IPADDR=10.1.2.72                          │
│           │ PREFIX=24                                 │ PREFIX=24                                 │
│           │ GATEWAY=10.1.2.1                          │ GATEWAY=10.1.2.1                          │
│           │ DNS1=10.1.2.90                            │ DNS1=10.1.2.90                            │
│           │ DEFROUTE=yes                              │ DEFROUTE=yes                              │
│           │ IPV4_FAILURE_FATAL=yes                    │ IPV4_FAILURE_FATAL=yes                    │
│           │ IPV6INIT=no                               │ IPV6INIT=no                               │
│           │ NAME="System eth0"                        │ NAME="System eth0"                        │
│           │ HWADDR=08:00:27:12:F8:42                  │ HWADDR=08:00:27:45:56:13                  │
│           │ LAST_CONNECT=1389967507                   │ LAST_CONNECT=1389968121                   │
├-----------┼-------------------------------------------┼-------------------------------------------┤
│ eth1      │ DEVICE=eth1                               │ DEVICE=eth1                               │
│           │ TYPE=Ethernet                             │ TYPE=Ethernet                             │
│           │ UUID=568d8c14-d28e-48f7-82e5-dd7764968648 │ UUID=dc09606a-5126-4d2c-a0bc-ea11ce0dc80f │
│           │ ONBOOT=yes                                │ ONBOOT=yes                                │
│           │ NM_CONTROLLED=no                          │ NM_CONTROLLED=no                          │
│           │ BOOTPROTO=none                            │ BOOTPROTO=none                            │
│           │ IPADDR=192.168.5.81                       │ IPADDR=192.168.5.82                       │
│           │ PREFIX=24                                 │ PREFIX=24                                 │
│           │ GATEWAY=192.168.5.1                       │ GATEWAY=192.168.5.1                       │
│           │ DEFROUTE=yes                              │ DEFROUTE=yes                              │
│           │ IPV4_FAILURE_FATAL=yes                    │ IPV4_FAILURE_FATAL=yes                    │
│           │ IPV6INIT=no                               │ IPV6INIT=no                               │
│           │ NAME="System eth1"                        │ NAME="System eth1"                        │
│           │ HWADDR=08:00:27:B1:D9:D6                  │ HWADDR=08:00:27:15:7B:39                  │
│           │                                           │ LAST_CONNECT=1389968121                   │
├-----------┼-------------------------------------------┼-------------------------------------------┤
│ eth2      │ DEVICE=eth2                               │ DEVICE=eth2                               │
│           │ TYPE=Ethernet                             │ TYPE=Ethernet                             │
│           │ UUID=6e6858b9-9709-4334-9b58-bb6f02a30e94 │ UUID=283b2c5c-04e1-47ca-8375-6c52d333099f │
│           │ ONBOOT=yes                                │ ONBOOT=yes                                │
│           │ NM_CONTROLLED=no                          │ NM_CONTROLLED=no                          │
│           │ BOOTPROTO=none                            │ BOOTPROTO=none                            │
│           │ IPADDR=192.168.7.51                       │ IPADDR=192.168.7.52                       │
│           │ PREFIX=24                                 │ PREFIX=24                                 │
│           │ GATEWAY=192.168.7.1                       │ GATEWAY=192.168.7.1                       │
│           │ DEFROUTE=yes                              │ DEFROUTE=yes                              │
│           │ IPV4_FAILURE_FATAL=yes                    │ IPV4_FAILURE_FATAL=yes                    │
│           │ IPV6INIT=no                               │ IPV6INIT=no                               │
│           │ NAME="System eth2"                        │ NAME="System eth2"                        │
│           │ HWADDR=08:00:27:9C:16:71                  │ HWADDR=08:00:27:A8:44:45                  │
│           │                                           │ LAST_CONNECT=1389968121                   │
├-----------┼-------------------------------------------┼-------------------------------------------┤
│ eth3      │ DEVICE=eth3                               │ DEVICE=eth3                               │ 
│           │ TYPE=Ethernet                             │ TYPE=Ethernet                             │ 
│           │ UUID=ecca01b5-e18f-4f7f-b617-0cfe50e17638 │ UUID=9f2f8b5a-2650-412b-9d12-49de5484a877 │ 
│           │ ONBOOT=yes                                │ ONBOOT=yes                                │ 
│           │ NM_CONTROLLED=no                          │ NM_CONTROLLED=no                          │ 
│           │ BOOTPROTO=none                            │ BOOTPROTO=none                            │ 
│           │ IPADDR=192.168.9.51                       │ IPADDR=192.168.9.52                       │ 
│           │ PREFIX=24                                 │ PREFIX=24                                 │ 
│           │ GATEWAY=192.168.9.1                       │ GATEWAY=192.168.9.1                       │ 
│           │ DEFROUTE=yes                              │ DEFROUTE=yes                              │ 
│           │ IPV4_FAILURE_FATAL=yes                    │ IPV4_FAILURE_FATAL=yes                    │ 
│           │ IPV6INIT=no                               │ IPV6INIT=no                               │ 
│           │ NAME="System eth3"                        │ NAME="System eth3"                        │ 
│           │ HWADDR=08:00:27:5C:F8:96                  │ HWADDR=08:00:27:27:0F:F0                  │ 
│           │                                           │ LAST_CONNECT=1389968136                   │ 
├-----------┼-------------------------------------------┼-------------------------------------------┤
│ eth4      │ HWADDR=08:00:27:EC:60:F2                  │ HWADDR=08:00:27:FD:E7:7E                  │
│           │ TYPE=Ethernet                             │ TYPE=Ethernet                             │
│           │ BOOTPROTO=none                            │ BOOTPROTO=none                            │
│           │ NM_CONTROLLED=no                          │ NM_CONTROLLED=no                          │
│           │ DEFROUTE=no                               │ DEFROUTE=no                               │
│           │ PEERDNS=no                                │ PEERDNS=no                                │
│           │ PEERROUTES=yes                            │ PEERROUTES=yes                            │
│           │ IPV4_FAILURE_FATAL=yes                    │ IPV4_FAILURE_FATAL=yes                    │
│           │ IPV6INIT=no                               │ IPV6INIT=no                               │
│           │ IPADDR=192.168.1.30                       │ IPADDR=192.168.1.31                       │
│           │ DNS1=192.168.1.90                         │ DNS1=192.168.1.90                         │
│           │ NAME=eth4                                 │ NAME=eth4                                 │
│           │ UUID=6c6afa4f-48ce-47c7-9968-3419b4e5f8ea │ UUID=0ca62e7e-6770-45aa-a7a2-bca42cf3ed9c │
│           │ ONBOOT=yes                                │ ONBOOT=yes                                │
│           │ LAST_CONNECT=1393844453                   │ LAST_CONNECT=1393849919                   │
└-----------┴-------------------------------------------┴-------------------------------------------┘

However, each time I rebooted, these are the difference on the /etc/resolv.conf and the other configuration:
Code:
Server 1
========
/etc/resolv.conf    ; generated by /sbin/dhclient-script
                    search wrx4.vm
                    nameserver 10.1.2.90
                    nameserver 103.11.48.126

chkconfig --list NetworkManager
                    NetworkManager  0:off   1:off   2:off   3:off   4:off   5:off   6:off

service NetworkManager status
                    NetworkManager is stopped


Server 2
========
/etc/resolv.conf    # Generated by NetworkManager
                    search wrx4.vm
                    
                    
                    # No nameservers found; try putting DNS servers into your
                    # ifcfg files in /etc/sysconfig/network-scripts like so:
                    #
                    # DNS1=xxx.xxx.xxx.xxx
                    # DNS2=xxx.xxx.xxx.xxx
                    # DOMAIN=lab.foo.com bar.foo.com
                    nameserver 10.1.2.90

chkconfig --list NetworkManager
                    NetworkManager  0:off   1:off   2:off   3:off   4:off   5:off   6:off

service NetworkManager status
                    NetworkManager is stopped
I never setup any dhcp client configuration before, but each time the VM is rebooted or started it seems that the /etc/resolv.conf always gets overwritten again.
What I want to achieve is like the one in the server 1 where the nameserver I got from the ISP is also configured there.
That will made it easier if I need to download just a small file from the internet.

Other than that, I also wanted to understand what other configuration that could affect this /etc/resolver gets overwritten, which configuration and how to configure it.

Thanks in advance for your help.
 
Old 04-07-2014, 02:32 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

maybe I'm missing something here, but in the /etc/resolv.conf there is a comment indicating that it was generated by /sbin/dhclient-script. Digging a little deeper it seems you can be explicit about what is requested from the dhcp server. Eg in your /etc/dhclient.conf you can have
Code:
request subnet-mask, broadcast-address, time-offset, routers,
        domain-search, domain-name, domain-name-servers, host-name;
require subnet-mask, domain-name-servers;
So, presumably if you don't want dhclient to touch your /etc/resolv.conf you could try omitting "domain-name-servers" in both "request" and "require". See the dhclient.conf man page for more details.

HTH,

Evo2.
 
Old 04-07-2014, 03:48 AM   #3
rexus
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Hi Evo2,

Thanks for replying.
However, my problem is more on to the Server 2 which cannot get the "nameserver 103.11.48.126" configuration.
I had to write it manually each time the server gets rebooted.

I don't even setup a dhclient service.
Can you tell me what service name should I be looking at if the dhclient is running?

Thank you.
 
Old 04-07-2014, 07:31 PM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

sorry it seems I did not read your first post carefully enough. I think I understand your situation now.

What I'm curious about is why the /etc/resolv.conf on server 2 has a comment indicating that it was generated by Network Manager even though you have shown that that service is not being run.

I also wonder why there is a comment in the resolv.conf for server 1 indicating it was written by dhclient, since you don't seem to be using dhcp at all. Is that perhaps left over from earlier in the life of the VM?

Do you know what happens if you delete /etc/resolv.conf and then reboot server 2? What would be in /etc/resolv.conf after the reboot?
Or perhaps instead of rebooting just try a "service network restart".

Have tried uninstalling NetworkManager?

I think you have two options for getting "nameserver 103.11.48.126" in either resolv.conf are to eithe put it there by hand or
to put "DNS2=103.11.48.126" in you iface-eth4 files.

Please note that I'm not so experienced with network configuration on RHEL based systems, but want to help you sort this out since my first post was so unhelpful and took away your zero replies status.

Evo2.
 
Old 04-09-2014, 07:55 PM   #5
rexus
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Hi Evo2,

Thanks a lot for helping.

Quote:
Originally Posted by evo2 View Post
Do you know what happens if you delete /etc/resolv.conf and then reboot server 2? What would be in /etc/resolv.conf after the reboot?
Or perhaps instead of rebooting just try a "service network restart".
That's actually a great idea and I didn't even think about it. probably because I'm afraid to break something.
Now I do know what happens when I deleted the /etc/resolv.conf as well as the /etc/resolv.conf.save files.
When I rebooted the server again, the content of the /etc/resolv.conf will be left with one line:
Code:
nameserver 10.1.2.90
Then, I tried adding the "search" directive and restart again.
Code:
search wrx4.vm
After reboot, I'm getting 2 lines:
Code:
search wrx4.vm
nameserver 10.1.2.90
so at least this solves one mystery. the NetworkManager does not play role anymore, it is the ifcfg-eth# scripts now.


Quote:
Originally Posted by evo2 View Post
Have tried uninstalling NetworkManager?
I was trying to do that but I guess, after trying your first suggestion, I think I could just leave it here.

Quote:
Originally Posted by evo2 View Post
I think you have two options for getting "nameserver 103.11.48.126" in either resolv.conf are to either put it there by hand or
to put "DNS2=103.11.48.126" in you iface-eth4 files.
I tried this but unfortunately still it doesn't add the nameserver directive automatically to the /etc/resolv.conf file.
my intention with the eth4 was so that I'm able to connect to internet from my vm.
Apparently why I need to do was to set up the ifcfg-eth4 script by adding GATEWAY=192.168.1.1 which is the internal router IP address.
Once I did this, I can connect to the internet easily.

Quote:
Originally Posted by evo2 View Post
Please note that I'm not so experienced with network configuration on RHEL based systems, but want to help you sort this out since my first post was so unhelpful and took away your zero replies status.

Evo2.
Not a problem at all, I really appreciate your suggestion and willingness to help in the first place.

Thanks,
rexus

Last edited by rexus; 04-09-2014 at 07:58 PM.
 
Old 04-09-2014, 09:07 PM   #6
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

with everything you reported in your last post and from checking https://access.redhat.com/site/docum...nterfaces.html I understand why putting "DNS2=103.11.48.126" in ifcfg-eth4 didn't add that dns to the resolv.conf file. The DNS1 and DNS2 values will only be added to the resolv.conf if PEERDNS is yes. In ifcfg-eth0 it is set to no (default is yes).

In ifcfg-eth0 PEERNDS is not set so it defaults to yes. So I think if you add "DNS2=103.11.48.126" to ifcfg-eth0 I think you'll have your resolv.conf as you want it.

Cheers,

Evo2.
 
Old 04-10-2014, 11:07 AM   #7
rexus
LQ Newbie
 
Registered: Apr 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Thumbs up

Quote:
Originally Posted by evo2 View Post
Hi,

with everything you reported in your last post and from checking https://access.redhat.com/site/docum...nterfaces.html I understand why putting "DNS2=103.11.48.126" in ifcfg-eth4 didn't add that dns to the resolv.conf file. The DNS1 and DNS2 values will only be added to the resolv.conf if PEERDNS is yes. In ifcfg-eth0 it is set to no (default is yes).

In ifcfg-eth0 PEERNDS is not set so it defaults to yes. So I think if you add "DNS2=103.11.48.126" to ifcfg-eth0 I think you'll have your resolv.conf as you want it.

Cheers,

Evo2.
I don't think I might need to add the DNS2 on the ifcfg-eth4 after I put the GATEWAY directive there.
it can connect to internet and the same network as my router..
the goal is achieved now, just need to move on to the next step which is the Oracle database RAC cluster setup.

Thank you,
rexus
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] DNS configuration file /etc/resolv.conf gets updated after every reboot yogesh_attarde Linux - Software 3 02-11-2014 01:40 AM
how to avoid resolv.conf been modified by dhcp-client septanla Linux - Networking 3 03-18-2006 05:25 PM
how to avoid resolv.conf been modified by dhcp-client septanla Linux - Networking 1 03-07-2006 07:40 AM
resolv.conf gets modified when dialing... jaitropfaim Linux - Networking 2 02-16-2003 02:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration