1 2 Previous Next 21 Replies Latest reply: Apr 10, 2014 7:20 AM by Catch~22 RSS

    Which configuration file modified the /etc/resolv.conf ?

    Adhika W

      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:

       

      Interfaceserver 1server 2
      eth0

      DEVICE=eth0

      TYPE=Ethernet

      UUID=8cb50704-029f-469a-b031-da44b4a49b74

      ONBOOT=yes

      NM_CONTROLLED=no

      BOOTPROTO=none

      IPADDR=10.1.2.71

      PREFIX=24

      GATEWAY=10.1.2.1

      DNS1=10.1.2.90

      DEFROUTE=yes

      IPV4_FAILURE_FATAL=yes

      IPV6INIT=no

      NAME="System eth0"

      HWADDR=08:00:27:12:F8:42

      LAST_CONNECT=1389967507

      DEVICE=eth0

      TYPE=Ethernet

      UUID=f10e7ab5-7b7e-4bcf-9ddb-a2ab439a776a

      ONBOOT=yes

      NM_CONTROLLED=no

      BOOTPROTO=none

      IPADDR=10.1.2.72

      PREFIX=24

      GATEWAY=10.1.2.1

      DNS1=10.1.2.90

      DEFROUTE=yes

      IPV4_FAILURE_FATAL=yes

      IPV6INIT=no

      NAME="System eth0"

      HWADDR=08:00:27:45:56:13

      LAST_CONNECT=1389968121

      eth1

      DEVICE=eth1

      TYPE=Ethernet

      UUID=568d8c14-d28e-48f7-82e5-dd7764968648

      ONBOOT=yes

      NM_CONTROLLED=no

      BOOTPROTO=none

      IPADDR=192.168.5.81

      PREFIX=24

      GATEWAY=192.168.5.1

      DEFROUTE=yes

      IPV4_FAILURE_FATAL=yes

      IPV6INIT=no

      NAME="System eth1"

      HWADDR=08:00:27:B1:D9:D6

      DEVICE=eth1

      TYPE=Ethernet

      UUID=dc09606a-5126-4d2c-a0bc-ea11ce0dc80f

      ONBOOT=yes

      NM_CONTROLLED=no

      BOOTPROTO=none

      IPADDR=192.168.5.82

      PREFIX=24

      GATEWAY=192.168.5.1

      DEFROUTE=yes

      IPV4_FAILURE_FATAL=yes

      IPV6INIT=no

      NAME="System eth1"

      HWADDR=08:00:27:15:7B:39

      LAST_CONNECT=1389968121

      eth2

      DEVICE=eth2

      TYPE=Ethernet

      UUID=6e6858b9-9709-4334-9b58-bb6f02a30e94

      ONBOOT=yes

      NM_CONTROLLED=no

      BOOTPROTO=none

      HWADDR=08:00:27:9C:16:71

      IPADDR=192.168.7.51

      PREFIX=24

      GATEWAY=192.168.7.1

      DEFROUTE=yes

      IPV4_FAILURE_FATAL=yes

      IPV6INIT=no

      NAME="System eth2"

      DEVICE=eth2

      TYPE=Ethernet

      UUID=283b2c5c-04e1-47ca-8375-6c52d333099f

      ONBOOT=yes

      NM_CONTROLLED=no

      BOOTPROTO=none

      IPADDR=192.168.7.52

      PREFIX=24

      GATEWAY=192.168.7.1

      DEFROUTE=yes

      IPV4_FAILURE_FATAL=yes

      IPV6INIT=no

      NAME="System eth2"

      HWADDR=08:00:27:A8:44:45

      LAST_CONNECT=1389968121

      eth3

      DEVICE=eth3

      TYPE=Ethernet

      UUID=ecca01b5-e18f-4f7f-b617-0cfe50e17638

      ONBOOT=yes

      NM_CONTROLLED=no

      BOOTPROTO=none

      HWADDR=08:00:27:5C:F8:96

      IPADDR=192.168.9.51

      PREFIX=24

      GATEWAY=192.168.9.1

      DEFROUTE=yes

      IPV4_FAILURE_FATAL=yes

      IPV6INIT=no

      NAME="System eth3"

      DEVICE=eth3

      TYPE=Ethernet

      UUID=9f2f8b5a-2650-412b-9d12-49de5484a877

      ONBOOT=yes

      NM_CONTROLLED=no

      BOOTPROTO=none

      IPADDR=192.168.9.52

      PREFIX=24

      GATEWAY=192.168.9.1

      DEFROUTE=yes

      IPV4_FAILURE_FATAL=yes

      IPV6INIT=no

      NAME="System eth3"

      HWADDR=08:00:27:27:0F:F0

      LAST_CONNECT=1389968136

      eth4

      HWADDR=08:00:27:EC:60:F2

      TYPE=Ethernet

      BOOTPROTO=none

      NM_CONTROLLED=no

      DEFROUTE=no

      PEERDNS=no

      PEERROUTES=yes

      IPV4_FAILURE_FATAL=yes

      IPV6INIT=no

      IPADDR=192.168.1.30

      DNS1=192.168.1.90

      NAME=eth4

      UUID=6c6afa4f-48ce-47c7-9968-3419b4e5f8ea

      ONBOOT=yes

      LAST_CONNECT=1393844453

      HWADDR=08:00:27:FD:E7:7E

      TYPE=Ethernet

      BOOTPROTO=none

      NM_CONTROLLED=no

      DEFROUTE=no

      PEERDNS=no

      PEERROUTES=yes

      IPV4_FAILURE_FATAL=yes

      IPV6INIT=no

      IPADDR=192.168.1.31

      DNS1=192.168.1.90

      NAME=eth4

      UUID=0ca62e7e-6770-45aa-a7a2-bca42cf3ed9c

      ONBOOT=yes

      LAST_CONNECT=1393849919

       

      however, each time I rebooted, these are the difference on the /etc/resolv.conf and the other configuration

      ConfigServer 1Server 2
      /etc/resolv.conf

      ; generated by /sbin/dhclient-script

      search wrx4.vm

      nameserver 10.1.2.90

      nameserver 103.11.48.126

      # 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 NetworkManagerNetworkManager  0:off   1:off   2:off   3:off   4:off   5:off   6:offNetworkManager  0:off   1:off   2:off   3:off   4:off   5:off   6:off
      service NetworkManager statusNetworkManager is stoppedNetworkManager 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.

      However, in Server 1, somehow the dhcp client is working and getting the right DNS server IP address.

      What I want to achieve for the Server 2 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/resolve.conf file gets overwritten, which configuration and how to configure it.

       

      Thanks in advance for your help in advance.

       

      Adhika

       

      Message was edited by: Adhika W

        • 1. Re: Which configuration file modified the /etc/resolv.conf ?
          Catch~22

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

           

          NAT can typically not be used to communicate with other VM's as it is meant for making outgoing connections on behalf of the host computer only. Also NAT typically requires DHCP, provided by the virtual machine to function.

          • 2. Re: Which configuration file modified the /etc/resolv.conf ?
            Adhika W

            Thanks for replying Dude!,

             

            I'm using VirtualBox here and my intention with setting up the NAT Network is so that I do not consume my home IP addresses and so that I can bring my VM anywhere without having to worry about connected to a router or not.

            I am setting up a fixed IP here, as you can see from the ifcg-eth# scripts I typed on the first posting, so I believe DHCP is not required.

            My intention was only to solve the /etc/resolv.conf file issue.

             

            Cheers,

            Adhika

            • 3. Re: Which configuration file modified the /etc/resolv.conf ?
              Catch~22

              Solving /etc/reslov.conf is not the solution, because it is not the problem.

               

              The standard NAT adapter requires DHCP, provided by the built-in DHCP service of VirtualBox and will not let your virtual machines communicate with each other. NAT is meant to make outgoing connections on behalf of your host computer, including DNS, and is shielding outgoing connections due to the private networking concept, unless you configure specific port forwarding.

               

              VirtualBox 4.3 recently introduced a new NAT adapter,  named “NAT Network”, which can be configured to allow virtual machines to communicate to each other on the same host, but it needs to be configured appropriately and just adds to the confusion. This is not a question of Oracle Linux, but VirtualBox.

               

              A NAT adapter and bridged networking as you decided does not really make sense. You need to check the VirtualBox documentation and understand how networking works, including NAT concepts in order to choose the right adapter for your purpose.

              • 4. Re: Which configuration file modified the /etc/resolv.conf ?
                Catch~22

                On a second thought, you could use NAT for outgoing internet connections and use the bridged adapter for communication between your virtual machines and host computer. In this case you can configure your bridged adapter with any private TCP/IP address that does interfere with the network of your host system. You do not need to configure DNS for you bridged network since it will be done by NAT.

                • 5. Re: Which configuration file modified the /etc/resolv.conf ?
                  Paul In 'T Hout-Oracle

                  Hi Adhika,

                   

                  The dhcp client is triggered when one of the interfaces has BOOTPROTO=DHCP configured. Are you sure that on server1 none of the interfaces have this.

                  You can check by doing:

                  cd /etc/sysconfig/network-scripts

                  grep -i dhcp *

                  This will return a number of lines, hopefully giving you some clue's as to where DHCP is configuredPEERDNS

                   

                  Also, in ifcfg-ethx the setting PEERDNS=yes/no controls if /etc/resolve.conf will be updated or not.

                  • 6. Re: Which configuration file modified the /etc/resolv.conf ?
                    Adhika W

                    Hi Dude!,

                     

                    Thanks for replying.

                    I'm using the NAT-Network for the eth0, eth1, eth2, and eth3. There's no problem with those interfaces and I'm only trying to solve the issue with the /etc/resolv.conf which I think it should be getting the nameserver IP address from the router because that is the only interface I set to "Bridged Network".

                     

                    With NAT-Network, I can communicate with any new VM created by using the eth0.

                    eth1 is meant to be used for heartbeat.

                    eth2 and eth3 are meant to be used for connection with the iSCSI target.

                     

                    Thank you,

                    Adhika

                    • 7. Re: Which configuration file modified the /etc/resolv.conf ?
                      Adhika W

                      Hi Paul,

                       

                      As you can see above, I set the BOOTPROTO=none for all of the interfaces there.

                      The PEERDNS directives was only set in the eth4 on each servers.

                      I'm really sure about this because put the content of the configuration one by one when I wrote this thread in the beginning.

                       

                      What other thing that will overwrite the /etc/resolv.conf file other than the ifcfg-eth# scripts and the dhclient-script?

                      How do I check what is actually happening when I start the machine?

                      I wanted to know which program overwrites that /etc/resolv.conf.

                       

                      Although it is written as /sbin/dhclient-script or NetworkManager, I really need to check whether these guys are actually doing the writing.

                      I'm positive that it is not NetworkManger because I already turned it off.

                       

                      Regards,

                      Adhika

                      • 8. Re: Which configuration file modified the /etc/resolv.conf ?
                        Catch~22

                        I'm using the NAT-Network for the eth0, eth1, eth2, and eth3. There's no problem with those interfaces and I'm only trying to solve the issue with the /etc/resolv.conf which I think it should be getting the nameserver IP address from the router because that is the only interface I set to "Bridged Network".

                         

                        Sorry, what? Why should you need to configure your NAT interface to use the DNS server of your router? Haven't you configured DNS on your host system? And what does this have to do with the Bridged Network? Maybe you are not understanding that the NAT interface has to use DHCP and is making connections on behalf of your host system and host TCP/IP configuration. Traffic in NAT is translated and routed inside the VirtualBox router - not using your Bridged network adapter.

                         

                        Why are you creating such a complex setup using NAT Network adapters? You will also most likely run into port forwarding issues later. I suggest to simply use a NAT adapter for eth0 with DHCP for all outgoing connections, including DNS. And use bridged adapters or host-only for the rest of your networking needs.

                         

                        Also, you need to compare the MAC hardware addresses of the virtual adapters with the ones discovered in your virtual machine. Adapter 1 does not necessarily correspond to eth0, etc. For instance, if you enabled adapter 2 first, then this would be configured as eth0, etc.

                        • 9. Re: Which configuration file modified the /etc/resolv.conf ?
                          Adhika W

                          Hi Dude!,

                           

                          To make it simpler, I can simply delete those interfaces (eth0, eth1, eth2, & eth3) right now and left with eth4 which I think can be directed to the actual question I was asking.

                          So here's the result of ipconfig on my host:



                          Ethernet adapter Local Area Connection:

                           

                             Connection-specific DNS Suffix  . :

                             Description . . . . . . . . . . . : Realtek PCIe GBE Family Controller

                             Physical Address. . . . . . . . . : 00-90-F5-CC-F9-DB

                             DHCP Enabled. . . . . . . . . . . : No

                             Autoconfiguration Enabled . . . . : Yes

                             IPv4 Address. . . . . . . . . . . : 192.168.1.5(Preferred)

                             Subnet Mask . . . . . . . . . . . : 255.255.255.0

                             Default Gateway . . . . . . . . . : 192.168.1.1

                             DNS Servers . . . . . . . . . . . : 192.168.1.1

                                                                 103.11.48.126

                             NetBIOS over Tcpip. . . . . . . . : Enabled

                           

                           

                          As you can see from that result, if you compare the Server 1 and Server 2, the /etc/resolv.conf from Server 1 managed to get that 103.11.48.126, whereas the one in the Server 2 couldn't.

                          This is exactly what I'm trying to resolve.

                          Does this make any sense to you?

                          Just forget about the other interfaces.

                           

                          Thank you,

                          Adhika

                          • 10. Re: Which configuration file modified the /etc/resolv.conf ?
                            Catch~22

                            Those are actually not valid TCP/IP addresses that can be used for a virtual machine under VirtualBox for either NAT or Host-only adapter. NAT should be a 10.2.0.x number and host-only is using the 192.168.56 network. What you have posted or looking at seems to be the TCP/IP configuration of you Windows host. If you want to use DHCP provided by your host network then you need to use the Bridged adapter type. I suggest to compare the MAC hardware addresses of your VM with the once shown in the virtual machine adpater setting to verify you are using the right interfaces.

                            • 11. Re: Which configuration file modified the /etc/resolv.conf ?
                              Adhika W

                              Hi Dude!,

                               

                              What I want to achieve with my eth4 or the bridged network is to be in the same network as the host, which is 192.168.1.x in my current environment.

                              In my case, I know that any PC connecting to my router would be in the lower range which is the 192.168.1.2 until 192.168.1.20, that's why I'm using 192.168.1.30 and 192.168.1.31 for the bridged network.

                              That's why the DNS is supposed to be the 103.11.48.126 right?

                               

                              So my question was to add this that DNS IP automatically to /etc/resolve.conf everytime the machine is started.

                               

                              Thank you,

                              Adhika

                              • 12. Re: Which configuration file modified the /etc/resolv.conf ?
                                Catch~22

                                192.168 is a private network, so you router, where your PC is connected to must do NAT in order to communicate with your DNS server and public Internet. The same concept is used inside VirtualBox when you use NAT. NAT requires DHCP and assigns the VM the same DNS server that is used by your host system.

                                 

                                Perhaps you see a difference between server1 and server2 because eth0's are not corresping to the same virtual network adatper types. You might be using DHCP with the Bridged network adapter, which assigend the DCHP configuration by your ISP network router. That's why I suggested you compare the MAC addresses of the eth devices inside your virtual machine with the MAC addresses used by your configured VM network adapter type (1 - 4). eth0 is not necessariiy adapter 1.

                                 

                                You can use the bridged network adapter with any TCP/IP address that does not conflict with your host system. VirtualBox will provide the bridge between your host and guest to allow communication even if your host and guest system are on different networks. Of course you can also use the Bridged network adapter with static or dynamic DHCP addressing.

                                • 13. Re: Which configuration file modified the /etc/resolv.conf ?
                                  Adhika W

                                  Hi Dude!,

                                   

                                  I have checked the MAC address for each interfaces between each VM and the hosts, there was no conflicting MAC address.

                                  The interface configured with the Bridged Network was set to a static IP, even my laptop is also set to static IP, so I perfectly know that there won't be an IP conflict.

                                   

                                  How do I know which program actually overwrite the /etc/resolv.conf?

                                  Every time I startup or reboot, it always get's updated but I don't have any idea which program updated that file.

                                  I don't find any clue in /var/log/message as well as dmesg, do you have any other suggestion to check which program update this file?

                                   

                                  Thank you,

                                  • 14. Re: Which configuration file modified the /etc/resolv.conf ?
                                    Catch~22

                                    I did not mean to look for a MAC address conflict, but to check whether eth0, etc1, etc. correspond to the right virtual machine adapter.

                                     

                                    Looking at your config files, there should only be one default gateway unless you are configuring a router and want to do specific source routing. You have configured a gateway with each interface and also set the DEFROUTE option. Sorry, this does not really make sense for your purpose and won't work. Based on your description you only need a default gateway to communicate with networks for which your system has no routing information. For instance, if you want to connect to 8.8.8.8, your system will query the default gateway and use the interface which matches the network of the gateway address. If your default gateway is e.g. 10.0.2.1 and your NAT interface is 10.0.2.5, then querying routing information for 8.8.8.8 will use the NAT interface. If you want to connect to 192.168.5.2 and you have a 192.168.5.1 interface, then you do not need or use a gateway, since ARP is simply managed by default broadcasting. You can configure the default gateway in in /etc/sysconfig/network.

                                     

                                    I suggest to remove the following from all ifcfg-ethx files:

                                     

                                    DEFROUTE

                                    DNS1

                                    UUID

                                     

                                    Regarding what overwrites /etc/resolv.conf: It's usually overwritten by the DHCP client, unless you have PEERDNS=no. Are you using DHCP? It's mandatory in VirtualBox for NAT to function.

                                    1 2 Previous Next