After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 632157 - [enh] add custom aliases to default IP address mapping lines
[enh] add custom aliases to default IP address mapping lines
Status: RESOLVED OBSOLETE
Product: NetworkManager
Classification: Platform
Component: general
0.8.x
Other Linux
: Normal enhancement
: ---
Assigned To: Dan Williams
Dan Williams
Depends on:
Blocks:
 
 
Reported: 2010-10-14 16:00 UTC by David Megginson
Modified: 2010-12-17 04:48 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description David Megginson 2010-10-14 16:00:55 UTC
I develop several web sites on my laptop, and each one is a different virtual host through Apache. Until Lucid, I was able to alias these hosts in /etc/hosts, like this

  127.0.0.1 localhost localhost.localdomain myhost1.localdomain myhost2.localdomain myhost3.localdomain

Starting with Maverick, however, NetworkManager overwrites the 127.0.0.1 line every time it initiates a new network connection, so these aliases are lost. It is fair to argue that aliasing 127.0.0.1 isn't ideal, but as far as I can find, NetworkManager doesn't offer any alternative for aliasing the bound IP address. For example, if I connect to WiFi, it adds a line like

  192.168.0.101 snape

There seems to be no way to get it to do

  192.168.0.101 snape myhost1.localdomain myhost2.localdomain myhost3.localdomain

NetworkManager should not overwrite the 127.0.0.1 line in /etc/hosts until there is an alternative method available for aliasing on the local machine, without setting up an entire local DNS server.

Also tried using 127.0.0.2, etc., but NM overwrites those as well.

(Note: also logged downstream for Ubuntu 10.10 at https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/659872)
Comment 1 Fabio Durán Verdugo 2010-10-14 23:44:00 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.

*** This bug has been marked as a duplicate of bug 514580 ***
Comment 2 Dan Williams 2010-10-19 16:20:25 UTC
Actually these days NM *does* touch /etc/hosts because we need to ensure that the current machine hostname maps to either 127.0.0.1 or the current IP address of the machine.  Reopening.
Comment 3 Dan Williams 2010-10-19 16:25:17 UTC
A fix for overwriting custom mappings on localhost lines was committed about two weeks ago:

commit ee9ce6027b3fc0cb4aa14442ef8b628b80b726eb
commit bbf3f12d7b2c79c49d87d41e6cf7b65ac7782071

But NM will not yet add the custom names to the public IP address mapping lines, thus marking this as an enhancement.
Comment 4 Dan Williams 2010-10-22 18:46:36 UTC
Note that you *should* be able to add custom entries below the 127.0.0.1/::1 lines with any IP address you want, and any aliases you want.  If NM touches those aliases, then that's a bug.  NM only cares about the 127.0.0.1/::1 entries, and any entry with "# Added by NetworkManager" at the end.

So that's a workaround.
Comment 5 Dan Williams 2010-12-17 04:48:17 UTC
Note that we're going to remove the /etc/hosts editing functionality from NetworkManager since it's causing too many problems.  After that you'll be able to modify /etc/hosts however you like, and NM won't touch it.