Announcement

Collapse
No announcement yet.

Replace domain name in search path

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Replace domain name in search path

    I am running dnsmasq on a fully up to date Kubuntu 12.04 (admittedly under VMWARE but that shouldn't worry you).
    I am trying to change the domain search path for unqualified computer names after a blunder at installation.
    I have spent an hour searching the kde gui and the web looking for the window in which to type my new domain search path without success.
    I found a page labeled "Configure service discovery" (no useful help available on the page) and added in my domain but it did not appear in resolv.conf. So, failing any apparent means of doing it using the Kde gui, I went back to the command line and nano.

    My /etc/resolv.conf reads:

    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver 127.0.0.1
    search home


    I know that I need to replace "search home" with "search mydomain.com"
    Ah but, read the warning, it isn't so easy any more.
    So, to the man pages for resolvconf which explains where it keeps information amongst other much more confusing stuff.
    I may have found the source information (but not sure) and it doesn't warn about not editing.
    That is /run/resolvconf/interface where a file called "NetworkManager" contains:

    domain home
    search home
    nameserver 127.0.0.1


    Where "home" is the bad domain name. I am nervous about editing this file containing no comments and perhaps re-written by something (who knows?)

    However, apart from the obscurity of the resolvconf man pages, it does read "Normally resolvconf is run only by hook scripts"
    and explains several invokers.
    One of them is ifup (Ah! something I recognise) "using settings in /etc/network/interfaces" (Something else I recognise).

    Quickly turning to my trusty terminal, /etc/network/interfaces contains:

    auto lo
    iface lo inet loopback

    No ethernets in there!
    When I do sudo ifdown eth0
    quick as a flash comes back:
    ifdown: interface eth0 not configured

    BUT Ha! when I open the window "network management settings", select "network connections" and click "edit" for the wired connection it claims it is using "eth0" - fooled me! - but where is the configuration for it? AAAARRRRGGGHHHHHH.

    Really I don't mind this labyrinthine structure - I presume there is a reason for it but all I want to do is change the **** domain name.

    Anybody any thoughts about how to go about changing the domain search path - it just can't be THAT hard?
    PS this is getting more like MS windows with each new release.
    Last edited by rayfoulkes; Jan 02, 2013, 04:43 PM. Reason: [SOLVED]

    #2
    /etc/resolve.conf is writen by network manager when you connect to a network, /run is also not the place to write changes you want to stick around.

    However, network manager settings > wired > your wired connection > edit > ipv4 addresses | additional search domains

    is probally what you are looking for. After changing this to "test" and reconnecting I get

    Code:
    cat /etc/resolv.conf
    # Generated by NetworkManager
    search test
    nameserver 8.8.8.8
    nameserver 8.8.4.4
    Notes: Networkmanager configs are stored in /etc/NetworkManager/ (this includes system and user connections)
    Last edited by james147; Dec 31, 2012, 08:36 AM.

    Comment


      #3
      Hi James, thanks for the response. However network manager settings > wired > your wired connection > edit >ipv4address
      has 3 options, "basic settings", "additional addresses" and "routes", all of which are looking for Ip addresses and netmasks.
      I think I have searched all the options pretty diligently but cannot find "additional search domains".
      I am using a dhcp server for all dns and ip addresses in "basic settings"
      I have uploaded the screen image to https://plus.google.com/photos/10175...34810215263425
      Any thoughts as to why your setup and mine are different?

      Comment


        #4
        NetworkManager.conf

        PS less NetworkManager.conf gives:
        [main]
        plugins=ifupdown,keyfile
        dns=dnsmasq

        no-auto-default=00:0C:29:F3:AE:2A,

        [ifupdown]
        managed=false



        I gotta be missing something obvious "it just can't be this hard"
        Last edited by rayfoulkes; Dec 31, 2012, 09:54 AM. Reason: Missed details.

        Comment


          #5
          What version of kde are your running? I am on 4.9 here.

          Also the option is on your screen shot, but greyed out, try changing the method option.
          Last edited by james147; Dec 31, 2012, 02:48 PM.

          Comment


            #6
            In that image you linked to, the "Search Domains" field is grayed out. I'm not immediately sure why that's happening. However, since the field is labeled "Search Domains," that indicates you've chosen the "Automatic (DHCP) addresses only" method. If you change the method to "Automatic (DHCP)," then the lower fields for DNS and domains will change to "Additional...". Can you then add more search domains, if you make the method change?

            Compare to mine:



            Another option would be to edit the file /etc/dhcp/dhclient.conf and at the bottom add the line
            Code:
            append domain-search [i]domain.foo[/i]
            Then restart DHCP with
            Code:
            sudo pkill -HUP dhclient

            Comment


              #7
              Originally posted by james147 View Post
              What version of kde are your running? I am on 4.9 here.
              Hi James and Happy New Year to you and your family. Apologies for not responding last night but being an old fart (67) went to bed early.
              AFAIK I am using the recommended LTS version for Kubuntu 12.04 i.e. "Platform Version 4.8.5 (4.8.5)" according to "help - about kde" in Kate.

              Originally posted by james147 View Post
              Also the option is on your screen shot, but greyed out, try changing the method option.
              Well, there is an option "Search domains" greyed out when I use "Automatic (DHCP)". If I change that to "Automatic (DHCP) addresses only" it isn't greyed.
              I can then add in my (not internet enabled) domain name which is "heuchin.bingen.org". However, whatever it is doing, it does not appear in /etc/resolv.conf
              I also do a test using nslookup. If I write "nslookup gandalf" I get error NXDOMAIN. If I write "nslookup gandalf.heuchin.bingen.org" then I get an address albeit one from my local ISP who kindly resolves all unknown addresses to something against my wishes. So it does not look like the domain substitution is working.
              Just for your interest I have previously done:
              sudo apt-get update && sudo apt-get install --reinstall kubuntu-desktop
              just in case I screwed up something else.
              When I run "nmcli -p dev list" it is clear that the domain is still set to "home"; here are the details:
              ================================================== =============================
              Device details
              ================================================== =============================
              GENERAL.DEVICE: eth0
              GENERAL.TYPE: 802-3-ethernet
              GENERAL.VENDOR: Advanced Micro Devices [AMD]
              GENERAL.PRODUCT: 79c970 [PCnet32 LANCE]
              GENERAL.DRIVER: vmxnet
              GENERAL.HWADDR: 00:0C:29:F3:AE:2A
              GENERAL.STATE: 100 (connected)
              GENERAL.REASON: 0 (No reason given)
              GENERAL.UDI: /sys/devices/pci0000:00/0000:00:11.0/0000:02:01.0/net/eth0
              GENERAL.IP-IFACE: eth0
              GENERAL.NM-MANAGED: yes
              GENERAL.FIRMWARE-MISSING: no
              GENERAL.CONNECTION: /org/freedesktop/NetworkManager/ActiveConnection/0
              -------------------------------------------------------------------------------
              CAPABILITIES.CARRIER-DETECT: yes
              CAPABILITIES.SPEED: 1000 Mb/s
              -------------------------------------------------------------------------------
              WIRED-PROPERTIES.CARRIER: on
              -------------------------------------------------------------------------------
              IP4.ADDRESS[1]: ip = 192.168.1.80/24, gw = 192.168.1.254
              IP4.DNS[1]: 192.168.1.254
              IP4.DOMAIN[1]: home
              -------------------------------------------------------------------------------
              DHCP4.OPTION[1]: domain_name = home
              DHCP4.OPTION[2]: expiry = 1356993970
              DHCP4.OPTION[3]: broadcast_address = 192.168.1.255
              DHCP4.OPTION[4]: dhcp_message_type = 5
              DHCP4.OPTION[5]: dhcp_lease_time = 86400
              DHCP4.OPTION[6]: ip_address = 192.168.1.80
              DHCP4.OPTION[7]: routers = 192.168.1.254
              DHCP4.OPTION[8]: subnet_mask = 255.255.255.0
              DHCP4.OPTION[9]: domain_name_servers = 192.168.1.254
              DHCP4.OPTION[10]: network_number = 192.168.1.0
              DHCP4.OPTION[11]: dhcp_server_identifier = 192.168.1.254
              -------------------------------------------------------------------------------

              where you will note that the domain remains stuck at "home".
              I have also tried ifdown -a followed by ifup -a without any noticeable change.
              Yesterday I also tried "sudo sysctl kernel.domainname="heuchin.bingen.org"" which seems to have stuck i.e. when now I do "sudo sysctl kernel.domainname" it responds:
              kernel.domainname = heuchin.bingen.org so at least linux knows what it ought to be.

              You have given me one other thought though about dhcp provisioning and the fact that the option was greyed out. Life is a bit complicated. Here I am with my main computer in Glasgow where I do not run my own dns BIND9 server (which would normally serve heuchin.bingen.org) but I am trying to get the various Os' working together. My normal location is in France with the DNS server operational. I am now wondering if the "home" is being served from the local dhcp server which is a netgear prosafe fvs318g which is serving up "home" as the domain, rather than it just being my fault on installation. Before I go any further and add work for you and other helpers, I shall go and investigate that and do some rebooting ; that is once all the Windows/ipads/telephones on my local network are less busy wishing everybody Happy New Year. Thanks for your help so far.

              Comment


                #8
                Well, now I know the problem.

                Hi Steve Riley (happy New Year to you) and James (already wished)...
                I have been doing some experiments. Thanks Steve, you were spot on. When I changed from "Automatic(DHCP)" to "Automatic (DHCP) addresses only" the greyed out field appeared. I entered the IP addresses of two DNS servers and put in my domain name. This "stuck" i.e. the next time I go into that page, they are still shown. So far so good.

                The bad news is that /etc/resolv.conf is not updated i.e. it does not reflect what the gui of kde is showing as the current state of the domain name. i.e. after updating the domain from "home" resolv.conf shows:
                # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
                # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
                nameserver 127.0.1.1
                search home

                I have checked this also on a clean installation of Kubuntu 12.10 - exactly the same results. What I don't yet know is what DNSMASQ is using of all this and from where it gets its dns info.

                I found the culprit for propagating "home" (my FVS318G router) caused by me leaving the default in the DHCP setup when I set it up. When I change that and reboot everything (getting more and more like Windows every day) only then does resolv.conf get changed. It would seem therefore that only DHCP client is updating /run/resolvconf/resolv.conf (which is where resolv.conf points). This inconsistency looks to me like a bug in the way that KDE is carrying out its updating of networks. One thing I can confirm is that the time and date stamps on /run/resolvconf/resolv.conf are not the last time the kde gui was used - it makes no attempt to update it. Even ifdown and ifup failed to change the timestamps..

                Offhand it would seem that the only way of updating resolv.conf once you have loaded it with "Automatic(DHCP)" is to repeat the process.

                I don't think I have the time or patience to delve further into that. I have solved the problem by installing hosts and lmhosts file on all my linux installations so avoiding the dns lookup problems entirely. Maybe some future kde will fix the problem.

                Meanwhile, thanks for all your help and, since it seems unlikely that we will find a real resolution, I guess we should close the query.
                Regards, Ray

                Comment


                  #9
                  If you change the settings in network manager then you need to restart the network through network manager not ifup/ifdown for the changes to take effect. You do not need to reboot.

                  Comment


                    #10
                    OK, I admit, I used ifdown -a and ifup -a because I couldn't find anything on the kde "network connections - System settings" gui which read "restart network" or anything like it. I just fell back to what I knew assuming that if somebody had changed things then they would have replaced the ifup with either an explanation of what to do now, or an automated link to the new way of doing things.

                    I read briefly about "network manager" but couldn't find the gui in Kubuntu other than "network connections - System settings". I found nmcli and read, but did not understand, the man pages. It contains "Initscripts: ifup/ifdown can utilize NetworkManager via nmcli instead of having to manage connections itself and possibly interfere with NetworkManager" - er right, but do they? I guess not given your comments.

                    So many thanks James, it would seem that the incantations:
                    sudo nmcli -p nm enable false
                    sudo nmcli -p nm enable true
                    do stop and start the network. There is nothing (useful or otherwise) reported on the command line, but the syslog contains lots of details about networks going down and up. I just gotta remember about ifdown and ifup doing nothing useful any more.

                    So, that is the solution - use the "network connections - System settings" gui to put the changes in then go to a terminal and type the two lines above. Pity the gui couldn't do it instead isn't it?
                    I'm glad I am not a novice trying to use Linux. Whew.
                    Regards, Ray

                    Comment


                      #11
                      Originally posted by rayfoulkes View Post
                      So, that is the solution - use the "network connections - System settings" gui to put the changes in then go to a terminal and type the two lines above. Pity the gui couldn't do it instead isn't it?
                      I'm glad I am not a novice trying to use Linux. Whew.
                      Regards, Ray
                      You can use the network manager widget to stop and start the connection.

                      Comment


                        #12
                        OK, I admit, I cannot find that. Do you mean a desktop widget? I tried "add new widgets" and searched for "network manager" but all I found was a wifi signal strength one. Where do I get that in KDE?

                        Comment


                          #13
                          OK, I think I found it just after "microblogging". I had no idea that there were functions not available in menus in aparently random order on a scroll bar. I have never used any widgets before. It is now stuck on my desktop behind all my working windows. OMG what a mess. It looks almost the same as the window as that in the menu but has a button "enable networking". What are these developers thinking about? Anyway thanks for the info. Unless I can convert that sort of thing to a structured menu system I will stick with a file of useful terminal commands to replace gui actions and leave it open on my desktop. I think it might grow large.

                          Comment


                            #14
                            It should be added to the system tray by default.., if not you can add it back by ight clicking the system tray > system tray settings.

                            But if you really don;t like network manager then you can disable its service and run the commands manually.

                            Comment


                              #15
                              James, OK, at last I got it. It is truly amazing how I can make mistakes. I have ALWAYS left clicked that icon. Which gives 3 options the relevant one being "network management settings" which I have always selected. That permits you to do all the manipulations that I have been trying with the exception of restarting the network system. What I NEVER noticed is that if you left click there is a button labelled "enable networking" - AARRGGHH.
                              What totally baffles me is why someone has designed a system where, in order to implement a change you MUST disable and enable networking but a) doesn't do it automatically and b) puts the button to do it on another page. Well, you got me there but it took a long time. Thanks for your patience.

                              Comment

                              Working...
                              X