How to change hostname?

Currently my hostname is “unknown0015f26474fe”, how can I change this? I’ve tried via /etc/hosts in KDE before but it didn’t work, even after a reboot. I found it before in KDE but forgot where it was… :expressionless:

OpenSUSE should really add this feature to the installer because it’s annoying that I can’t set this at install time.

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

During the installation on the Network section you there is a checkbox
that says, basically, “Set hostname via DHCP” so it could be anything.
You can uncheck that and set your host name permanently along with
anything else name-ish (like DNS).

Good luck.

EarthMind wrote:
| Currently my hostname is “unknown0015f26474fe”, how can I change this?
| I’ve tried via /etc/hosts in KDE before but it didn’t work, even after
| a reboot. I found it before in KDE but forgot where it was… :expressionless:
|
| OpenSUSE should really add this feature to the installer because it’s
| annoying that I can’t set this at install time.
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIak/i3s42bA80+9kRAg7EAJ99S/jpcXDigRirXc4kvo1EouYPKQCfSBxH
g5z81YmH+kxEXzOef4zxxtg=
=OWfF
-----END PGP SIGNATURE-----

You can find this in the Networksettings in Yast. There is a tab “Hostname”.

Thank you both, I remember it was there I found it before :slight_smile:

And maybe the following because I probably see a slight misunderstanding here (when you don’t mind).

As usualy there are more interpretations of the word hostname.

In network terms the hostname is a name given to an IP address to be better understandable by human beings. To translate between hostnames and IP addresses we have of course DNS and /etc/hosts. But as your system may have more IP addresses (more NICs or more IP addresses on one NIC or both) this does not define the hostname. It is the habbit to have the hostname (type **hostname **in a console) the same as the hostname of one of the (the most important?) IP address of the system (that is with the domain part cut off at the end).

So by changing the name in /etc/hosts, you change the name bound to an IP address as know inside your host.

By changing the hostname (with domain) in the DNS world you change the name bound to the IP address as known to the world.

By changing the hostname with the hostname command you change a name of the host internal in your system (that is used by the kernel and other software).

By using YaST (as was advised above) this changing is made easier then by hand.

This might be an old topic, but I changed my hostname in the “Hostname” section of YaST, but my prompt still uses the old hostname. Am I missing something?

Hi
Have you logged out/logged in? If it’s a terminal session you need to
close and re-open for the profile to re-read.


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.45-0.1-default
up 7 days 6:28, 3 users, load average: 0.13, 0.23, 0.20
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.53

I didn’t log out and in, but I have rebooted, which should have done the same thing.

The other part about using YaST is that I’m not sure exactly which fields I’m supposed to change. Hostname or Host alias for 127.0.0.1, or one/both of those values for 127.0.0.2? What’s the difference, exactly?

I think I may have been able to get a different hostname at the command prompt by editing /etc/HOSTNAME, but everything I’ve read says that YaST can do the same thing, which in my experience, it doesn’t.

Hi
A strange one, did you only use YaST for the hostname change?

Is the hostname present in /etc/HOSTNAME and /etc/hosts did you also
add add a domain in the box to the right of where you entered the
hostname in YaST?


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.45-0.1-default
up 7 days 13:48, 3 users, load average: 0.35, 0.34, 0.29
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.53

Changing the values in YaST changed them in /etc/hosts, but not in /etc/HOSTNAME. I had to change /etc/HOSTNAME manually. What exactly do you mean by a domain? The only box to the right of Hostname is “Host alias”.

Hi
On the Hostname/DNS tab under Network Settings, There is a Hostname and
a Domain Name.

I think you have changed in the incorrect area in YaST, sounds like you
used ‘Hostnames’ under Network Services.

You need to use Network Devices -> Network Settings, third tab.


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.45-0.1-default
up 7 days 16:58, 3 users, load average: 0.64, 0.25, 0.14
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.53

Sorry to be dumb, Malcom, I don’t see a Network Settings applet in YaST. The closest I see is Network Services and Hostnames, neither of which give the option to change hostname. (opensuse 12.1 x64)

Hi
It’s on the left, Network Settings -> Network Devices (this is the
applet).


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 3.0.34-0.7-default
up 3 days 12:59, 4 users, load average: 0.44, 0.37, 0.37
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU

hello evryone i don’t know if this is still in but want give the solution that i read and apply by reading the man of the command “hostnamectl”
to change your hostname is better to do it through the command line.

sudo hostnamectl set-hostname <your_new_hostname>
the system will ask for root password, tape it and you are good to go. let me know any other issue that I can help

openSUSE-13.1

Old thread and it is easy to do from Yast

Well If you install with a netcable pluged in You AINT gonna see any Netsetup - so no luck there!!
I tried adding to both Hosts and Hostname, that worked, apart from the fact that all and any DNS resolution had waporised, so I had to enter them manually – BUT THAT IS NO SOLUTION ON A LAPTOP!!

So please where do we set a hostname that works, setting it in YAST enters the info in hosts, but leaves nohostname every where else!!

IMO the proper way to display your current HOST and HOSTNAME values is to echo those variables as follows because AFAIK what is returned is how locally running apps will see those variables.

echo $HOST
echo $HOSTNAME

First, answering your “domain name” question…
That should actually be the group name of computers in your network. It’s the Domain name if you’re running something like LDAP or Active Directory, it is the Workgroup name if you’re not running network security. If this “domain” is not set correctly, then your machines will not be able to easily “see” and browse network services on another computer in your network, like network file shares, proxy authentication, more.

As for the HOST and HOSTNAME variables,
I just ran some tests on a LEAP 42.1 to verify what I’ve observed in the past…

Changing the HOSTNAME in YAST > Network Settings doesn’t always have an immediate effect in an open console, and I’ve always been curious about that… but if you wait a few minutes or open a new console immediately then you will see the HOSTNAME change in the console immediately.

But, if you use the “echo” methods I describe to display your current HOST and HOSTNAME, you will continue to see the original values. As I described, this is important because it will mean that apps dependent on reading these variables will be using values you thought had been changed.

Only after a full reboot,
Then when you run the echo tests again will you see the new values.

Also, technically the $HOST and $HOSTNAME variables can be different but it looks like openSUSE configures them both to always have the same values.

Lastly, note that when using YAST to change the Hostname what each checkbox does and their consequences…
Bottom line is that I highly recommend that the second checkbox should <always> be checked, and the first checkbox <only most of the time> the box should be unchecked (You would almost always check the box if you’re implementing network security like LDAP or AD).
The** first checkbox** “Change Hostname via DHCP” means just that… You’re allowing DHCP settings to over-ride whatever you just configured. <Uncheck> this box or nullify what you just set.
The **second checkbox **“Assign Hostname to Loopback IP” can be important for any applications that use “external” access using the loopback addresses (anything that starts with 127.0.0.x, that should answer your question about 127.0.0.1 and 127.0.0.2). When applications run on your machine, they can be using something like Sockets or Named Pipes that are internal direct access methods, or they can access by “external” network sockets.

But talking pipes and Unix sockets vs network sockets starts getting into a deep dive into system and software architecture. Just follow my recommendation any you’ll be OK… Until something doesn’t work and then you can post in these Forums again.

HTH,
TSU

Yep, for the last year or two, I’ve had to manually update my /etc/resolv.conf everytime I logon to wireless, wired, or VPN. I have even done the force update, to no avail. /etc/resolv.conf ONLY has search domain (after the force update) the commented out message about manually updating the sysconfig files, and that if I touch it it won’t be changed. So I just manually update it… I think it’s a Network Manager thing that no one has fixed after two years.

When this is to be a request for help, please start a new thread. Not many will see this post at the end of an old thread.

but etc/hostname is blank file. i don’t understand!