Quick hostname question.

Hey all, I changed my hostname in the etc/HOSTNAME file, that went well and I have my desired change working (127.0.0.2 was changed), but I am curious, my old hostname is still bound to 127.0.0.1, is it ok if I log in as root and change that old hostname to that of my desired new one? Also I seem to have two entries for 127.0.0.1, would it be ok if I removed one of them? What’s the reason for having two?

This is what it looks like now:

#
# hosts         This file describes a number of hostname-to-address
#               mappings for the TCP/IP subsystem.  It is mostly
#               used at boot time, when no name servers are running.
#               On small systems, this file can be used instead of a
#               "named" name server.
# Syntax:
#    
# IP-Address  Full-Qualified-Hostname  Short-Hostname
#
127.0.0.1       linux-qpqn	localhost.localdomain	localhost

127.0.0.1       localhost

# special IPv6 addresses
::1             localhost ipv6-localhost ipv6-loopback

fe00::0         ipv6-localnet

ff00::0         ipv6-mcastprefix
ff02::1         ipv6-allnodes
ff02::2         ipv6-allrouters
ff02::3         ipv6-allhosts
127.0.0.2       snajsuse.site snajsuse

So, to sum up my question, do I need the two entries for 127.0.0.1, and can I change the line:
127.0.0.1 linux-qpqn localhost.localdomain localhost

to

127.0.0.1 snajsuse localhost.localdomain localhost

^^ or do I even need that line, would the plain
127.0.0.1 localhost
be all I need?

Thanks!

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Change your hostname via Yast: Network Devices: Network Card: [edit a
card]: Hostname/DNS stuff.

Good lukc.

Snaj wrote:
> Hey all, I changed my hostname in the etc/HOSTNAME file, that went well
> and I have my desired change working (127.0.0.2 was changed), but I am
> curious, my old hostname is still bound to 127.0.0.1, is it ok if I log
> in as root and change that old hostname to that of my desired new one?
> Also I seem to have two entries for 127.0.0.1, would it be ok if I
> removed one of them? What’s the reason for having two?
>
> This is what it looks like now:
>
>
> Code:
> --------------------
> #
> # hosts This file describes a number of hostname-to-address
> # mappings for the TCP/IP subsystem. It is mostly
> # used at boot time, when no name servers are running.
> # On small systems, this file can be used instead of a
> # “named” name server.
> # Syntax:
> #
> # IP-Address Full-Qualified-Hostname Short-Hostname
> #
> 127.0.0.1 linux-qpqn localhost.localdomain localhost
>
> 127.0.0.1 localhost
>
> # special IPv6 addresses
> ::1 localhost ipv6-localhost ipv6-loopback
>
> fe00::0 ipv6-localnet
>
> ff00::0 ipv6-mcastprefix
> ff02::1 ipv6-allnodes
> ff02::2 ipv6-allrouters
> ff02::3 ipv6-allhosts
> 127.0.0.2 snajsuse.site snajsuse
> --------------------
>
>
> So, to sum up my question, do I need the two entries for 127.0.0.1, and
> can I change the line:
> 127.0.0.1 linux-qpqn localhost.localdomain localhost
>
> to
>
> 127.0.0.1 snajsuse localhost.localdomain localhost
>
> Thanks!
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJJm3uvAAoJEFl00+q2r0YpWZgP/RHxUnoPuktvvclvDrP5iJ+r
LydmXqtIzp+S4cpGPnIEu0dRsq8WViPYpcCLo5mTJo9oEGSUI2iogCjcXiWQMReA
yJpac9mMbHmRdfdws0mGZmk7f8geWPRYJZKHh0R0SbYDWsoi6khLOHxCsjh3ABKn
CBj9NNMWQIDPFHkKVsGW2SIrNe/EIsafsVOPNDxo7MYd+HLIIuFOkgw/bzoQpW0v
u0mYQyY/EHW++cnI1ZZEvWKxyK1agEh2/SE7tPzYTwOVTEV/6NaSH0zp3Toq0XLU
PXomM7FUeogV+8zr97gNvp5UikH+236XADxj+GCfmHlK8Ibn0xk7xFWAg3woIx/j
t19be8YmR3zw9Zwcyn0P67YK48ZbdEie8y5AWrhrbm/u81HtJSh+gFSeqDFLpUrj
UtbbA5SCeE038j9Oy5pvbMuEPk/mKS+vT8Q43EjHPaXGwNaxupZ66SiRcFZsIx2n
rHy6fpSQibzU/MVTcKdp2HN1WHFwiMym1/gP+F5Y7n5SYwx+Rg/L3U5uGv7fUN/Y
8M4ntca3mJ4S2smT8+bWJeM9dRB8IScdSsVXj0h2VsxtsSpLqCcfCYnd+selPiba
9D+dQ3GvLXfouCpcb9Bsd64QQ/6+veJAZypSqCpqQXtzvku3GoWrpggT9CJs8v/p
jM4Wn9e/uDTPxNTrTY9n
=zgKz
-----END PGP SIGNATURE-----

Well, thanks for the response but it doesn’t answer any of my questions- those being do I need the two 127.0.0.1 entries, and if I do, can I edit the name to that of my desired one?

127.0.0.1 snajsuse localhost.localdomain localhost

Just that one line will be fine. Any other aliases you want to create should be added to that line. Preferably the first name on the line should be the FQDN and most official one, i.e. localhost.localdomain, in the absence of anything better.

Thanks for the reply, it’s just what I needed :slight_smile:

Just curious though, will calling two aliases to two different loopbacks (127.0.0.1 and .2) be bad?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

No, that’s normal. 127...* maps to your own box per the rules of
TCP/IP so you can allocate anything you want and even assign it to a NIC
if you want, though it’ll route to you anyway. NTP’s configuration has
something like 127.127.1.0 for a ‘local clock’ to synchronize to when
the network goes down… just points to your own system.

Good luck.

Snaj wrote:
> Thanks for the reply, it’s just what I needed :slight_smile:
>
> Just curious though, will calling two aliases to two different
> loopbacks (127.0.0.1 and .2) be bad?
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJJm5ofAAoJEFl00+q2r0YpFpgP/RrLLQ75VovP5LuF8+JjnvZF
WoLvLOhxqfuPPLVZ5HuK+8eT04qunY8y84/sqyuBvWbxMIaxw8Tj5s9i3CWh0hUA
AOq8UkHesqfsT+GmVwN/k+maL48Kcb8Got0ToGYBOgaKVbKLE20SYmhwGqcRbON3
SWTxI952k5W/BkK66GZUPzYZ7kiCMm1KoE/YZDop2G/YZhjFhcgaJTsirqCcZ6xS
fK/9ijuc+mj+nWTNtIjvfoICbB79g08G9g93gLlARqfZ5WvN3lRlJy4tplT0pPBl
NTys1F4DZ7Mb8ZX3h2UvbnrjmmI+fq7L3PHbI53JA0enpoi0+19RKQsVm4Iyh27+
dD0rdp9kX55dcb4qk4TJre+T8seBUzN7BFtdS1jrV2s4zF8jxlp1vfBFQBD/Gb+A
cPAsfNp7BzSYW+ckbJt+N6KGZupP5l3pQZ7H6ersGH7L8YmmuloCw88+pDZtahkD
bqty9xrxDwinOBqRo7DwVG5cq05GeyN/ceGEnHV5lukzlNwPgBVgJfXOBo0vOW0e
7uK4X64WDRvmHl1tDBKtntvyhPks06oi159aiwx4NRMdz5ji3W5LrOmaJruErscf
2JDjQ7/XGb+HIjXsL9Qfm7IWC/Ux37IkQRUOnl/8s1225GbakhBZ2SM7+7kdM+/X
p7/HWNScHzxzE3hxqI/Q
=VB4u
-----END PGP SIGNATURE-----

The whole of the huge subnet 127.0.0.0/8 is bound to the lo (loopback) interface. So any of the 2^24-2 addresses in that subnet is a “localhost” address.

Just want to thank you guys again, answered all of my questions :smiley: