Announcement

Collapse
No announcement yet.

knetworkmanager and custom hosts files?

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

    knetworkmanager and custom hosts files?

    Anyone know how to get a custom hosts file to stick in knetworkmanager?
    I have a fairly large /etc/hosts file that I don't want to have to manually insert all the aliases in knetworkmanager.
    Every time I copy the hosts file into /etc/ it gets replaced with a default one by knetworkmanager.


    0
    yes
    0%
    0
    no
    0%
    0
    Dont pretend you havent noticed my cardboard box, Julia, because I know you have!

    #2
    Re: knetworkmanager and custom hosts files?

    I am afraid I don't know what the /etc/hosts is for, but you could always write a little script to replace the original hosts file...

    My 2cs worth
    Once your problem is solved please mark the topic of the first post as SOLVED so others know and can benefit from your experience! / FAQ

    Comment


      #3
      Re: knetworkmanager and custom hosts files?

      @devnulljp: I could look a lot smarter than I really am by giving you a collection of references that took all of five seconds to generate with google/linux, but instead I'll simply tell you to google/linux for "/etc/hosts" where you will find things like this.

      @toad:
      The /etc/hosts file contains IP addresses for systems on your network. It predates DNS and is nice to have for small networks without dedicated DNS servers, especially on a network with private addresses. The syntax is simple: you have an IP address, followed by the hostname(s).
      This is also from one of the references, (a different one).

      Comment


        #4
        Re: knetworkmanager and custom hosts files?

        Originally posted by askrieger
        @devnulljp: I could look a lot smarter than I really am by giving you a collection of references that took all of five seconds to generate with google/linux, but instead I'll simply tell you to google/linux for "/etc/hosts" where you will find things like this.

        @toad:
        The /etc/hosts file contains IP addresses for systems on your network. It predates DNS and is nice to have for small networks without dedicated DNS servers, especially on a network with private addresses. The syntax is simple: you have an IP address, followed by the hostname(s).
        This is also from one of the references, (a different one).
        Thanks for that - I'm not the guy who doesn't know what a /etc/hosts file is for though...I'm guessing you directing the (slightly condescending) "Search Before You Ask" stuff at toad?

        I'm trying to get knetworkmanager to stop overwriting my custom hosts file I've built up over several years. I know how to google, I know what a hosts file is and what it's for.
        I've been doing this manually for years, but I'm giving the graphical tools a go now and finding them somewhat lacking...

        So, can anyone answer the question?

        knetworkmanager is mangling my hosts file.
        I don't want to have to add hundreds of entries manually through the limited interface.
        copying the hosts file into /etc after every network change is a clumsy cludge

        Should I just give it up and disable the dumb graphical tools and go back to /etc/network/interfaces

        Dont pretend you havent noticed my cardboard box, Julia, because I know you have!

        Comment


          #5
          Re: knetworkmanager and custom hosts files?

          SHould I just give it up and disable the dumb graphical tools and go back to /etc/network/interfaces
          Yes

          Comment


            #6
            Re: knetworkmanager and custom hosts files?

            Have you tried "sudo chmod 444 /etc/hosts" ? It's kind of a band-aid solution, but it would probably work.

            I'm using KNetworkManager to switch between connections, 2-3 different wireless, and 1 wired, network at least twice a day and I have no problems. I also log in and out multiple times quite often (different screen configurations at work and at home).

            For KNetworkManager to function properly (AFAIK) in the first place I had to edit my /etc/network/interfaces file, removing any entries except the loopback. It looks exactly like this:

            Code:
            auto lo
            iface lo inet loopback
            I'm not sure how the interfaces file could cause KNetworkManager to rewrite the hosts file...

            A completely different thought...

            You say you're copying the hosts file to /etc...maybe the format of the one you're copying is missing something that KNetworkManager is expecting...?

            I would recommend appending the changes to the existing hosts file. I did that a month ago to block off most advertisement sites and I haven't had to make any changes to the hosts file since.

            Code:
            127.0.0.1    localhost
            127.0.1.1    mylaptop-hp.myhost.net    mylaptop-hp
            
            # The following lines are desirable for IPv6 capable hosts
            ::1   ip6-localhost ip6-loopback
            fe00::0 ip6-localnet
            ff00::0 ip6-mcastprefix
            ff02::1 ip6-allnodes
            ff02::2 ip6-allrouters
            ff02::3 ip6-allhosts
            
            
            # This MVPS HOSTS file is a free download from:      #
            # [url]http://www.mvps.org/winhelp2002/[/url]             #
            #                             #
            # Notes: the browser does not read this "#" symbol     #
            # You can create your own notes, after the # symbol    #
            # This *must* be the first line: 127.0.0.1   localhost  #
            # *********************************************************#
            # ----------------- Updated: April-22-2008 ----------------#
            # *********************************************************#
            #                             #
            # Entries with comments are all searchable via Google.   #
            #                             #
            # Disclaimer: this file is free to use for personal use  #
            # only. Furthermore it is NOT permitted to copy any of the #
            # contents or host on any other site without permission or #
            # meeting the full criteria of the below license terms.  #
            #                             #
            # This work is licensed under the Creative Commons     #
            # Attribution-NonCommercial-ShareAlike License.      #
            # [url]http://creativecommons.org/licenses/by-nc-sa/3.0/[/url]    #
            #
            #
            #
            #start of lines added by WinHelp2002
            # [Misc A - Z]
            127.0.0.1 ad.a8.net
            127.0.0.1 asy.a8ww.net
            127.0.0.1 [url]www.abx4.com[/url] #[Adware.ABXToolbar]
            Works fine for me...does the modified hosts file that you're copying over contain the appropriate localhost information, and IPv6 information?

            PS: I used vi to edit my hosts file from the console.

            Comment


              #7
              Re: knetworkmanager and custom hosts files?

              Thanks for the reply.
              The host file format is fine...created with vi and used in Debian installs for years.
              I've tried the permissions thing too and it doesn't seem to matter, knetworkmanager still replaces it seemingly at random.
              I didn't think knetworkmanager used the /etc/network/interfaces file at all?


              As a workaround, I deleted all my knetworkmanager settings, copied my hosts file to /etc, and then recreated the settings -- that seems to stick.

              Thanks
              Dont pretend you havent noticed my cardboard box, Julia, because I know you have!

              Comment

              Working...
              X