Results 1 to 8 of 8
Hi folks,
Ubuntu 10.10 64 bit
I need to set /etc/hostname and /etc/hosts so that on running;
$ hostname
Code:
ub1004
$ hostname -a
Code:
ub1004
I set them as;
...
- 12-04-2010 #1Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,546
Settings of /etc/hosts and /etc/hostname
Hi folks,
Ubuntu 10.10 64 bit
I need to set /etc/hostname and /etc/hosts so that on running;
$ hostname$ hostname -aCode:ub1004
Code:ub1004
I set them as;
cat /etc/hostnamecat /etc/hostsCode:ub1004
After reboot:Code:127.0.0.1 localhost.localdomain 123.123.123.123 ub1004.domain.com ub1004 # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
cat /etc/hostname$ cat /etc/hostsCode:ub1004
Code:127.0.0.1 ub1004 localhost.localdomain localhost ::1 ub1004 localhost6.localdomain6 localhost6 #127.0.1.1 ub1004 123.123.123.123 ub1004.domain.com ub1004 # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
On running
$ hostname$ hostname -aCode:ub1004
Please advice.Code:localhost.localdomain localhost localhost6.localdomain6 localhost6 ub1004 ub1004.domain.com
TIA
B.R.
satimis
- 12-05-2010 #2
I'm guessing your question is why is the hosts file changing after reboot.
I'll bet on some administrative routine that runs during the boot ip request or network authentication.
Are you in charge of those processes? If they exist, that is.
Of course, if you are not your machine's administrator, it may be a local routine. But as you are editing hosts...
Is any of that possible?
Regards
LuisLast edited by ptkobe; 12-05-2010 at 02:29 AM.
- 12-05-2010 #3Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,546
Hi Luis,
I'm the admin. This is a virtual machine running Oracle VBox as virtualizer. I just discovered this strange happening /etc/hosts changed after reboot.
host - Ubuntu 1010 64 bit
VMs - Ubuntu 1004/1010 Debian 6.0, all 64 bits, Windows 32/64 bits etc.
Only Ubuntu has this problem.
On Debian:-
> hostname
> hostname -a
display the same output, same hostname "deb600dk01"
> cat /etc/hosts/etc/hosts won't change after reboot.Code:127.0.0.1 localhost 123.123.123.123. deb600dk01.domain.com deb600dk01 # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters
I edited /etc/hosts of Ubuntu similar to that of Debian. But it doesn't work. Problem still remains.
B.R.
satimis
- 12-05-2010 #4
It could be DHCP rewriting it
If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)
My new blog. It's probably not as good as I think it is.
- 12-05-2010 #5Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,546
Hi,
All Ubuntu and Debian VMs and host are running fixed IP NOT DHCP
$ cat /etc/network/interfacesB.R.Code:auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet manual auto br0 iface br0 inet static address xxx.xxx.xxx.xxx network xxx.xxx.xxx.xxx netmask 255.255.255.0 broadcast xxx.xxx.xxx.xxx gateway xxx.xxx.xxx.xxx bridge_ports eth0 bridge_fd 9 bridge_hello 2 bridge_maxage 12 bridge_stp off
satimis
- 12-05-2010 #6
Hi, satimis. Ok.
First, what are the changes? They redirect your local machine name ip4 lookup searches to the loopback, and adds a line doing the same for the IP6 searches (missing the already existent line below).
That's not bad. Can you live with it?
Second, if not, or if you really want to try to get to the bottom of it, I'll check the boot scripts (/etc/rc2.d/S*) and the /etc/init/* boot scripts, and also the /etc/rc.local file to try to find some code that may be responsible for it.
I never used VBox, I use kvm/libvirt, but I'm pretty sure that boot changes of /etc/hosts is not a "normal" thing. Maybe someone else may know more.
Please don't mind me telling the following, we both probably been around on computers for a while.
Check the dates on the above mentioned scripts with ls -lt. You may have made some change on them you have forgotten
Regards
Luis
PS: From $ man hostname
-a, --alias
Display the alias name of the host (if used). This option is deprecated and should not be used anymore.
??
- 12-05-2010 #7
Also, if you are using
# The primary network interface
auto eth0
iface eth0 inet manual
you may also check the /etc/network/if-*.d scipts
$ man interfaces
The manual Method
This method may be used to define interfaces for which no configuration is done by default. Such interfaces can be configured
manually by means of up and down commands or /etc/network/if-*.d scripts.
I have a similar conf (with libvirt) and I don't have to use that. The
bridge_ports eth0
line is enough for me.
You may try to comment those lines as an easy way to discard /etc/network/if-*.d scripts from being messing with your /etc/hosts file.
- 12-06-2010 #8Linux Guru
- Join Date
- Sep 2004
- Posts
- 1,546
Hi Luis,
Up to now I haven't discovered this change causing problem in operation. I just wonder why all Ubuntu OS here both host and VMs have this problem. Debian VMs don't suffer this problem.
Following is host data (Ubuntu 10.10 desktop 64bit):-
$ cat /etc/hosts$ cat /etc/hostsCode:127.0.0.1 ub1004 localhost.localdomain localhost ::1 ub1004 localhost6.localdomain6 localhost6 #127.0.1.1 ub1004 192.xxx.xxx.xxx ub1004.domain.com ub1004 # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
$ cat /etc/network/interfacesCode:127.0.0.1 ub1004 localhost.localdomain localhost ::1 ub1004 localhost6.localdomain6 localhost6 #127.0.1.1 ub1004 192.xxx.xxx.xxx ub1004.domain.com ub1004 # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
$ cat /etc/udev/rules.d/70-persistent-net.rulesCode:# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet manual auto br0 iface br0 inet static address 192.xxx.xxx.xxx network 192.xxx.xxx.xxx netmask 255.255.255.0 broadcast 192.xxx.xxx.xxx gateway 192.xxx.xxx.xxx bridge_ports eth0 bridge_fd 9 bridge_hello 2 bridge_maxage 12 bridge_stp off
Code:# This file maintains persistent names for network interfaces. # See udev(7) for syntax. # # Entries are automatically added by the 75-persistent-net-generator.rules # file; however you are also free to add your own entries. # PCI device 0x1969:0x1026 (ATL1E) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:26:18:44:b6:1a", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
B.R.
satimis


Reply With Quote
