LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Change hostname Centos (https://www.linuxquestions.org/questions/linux-networking-3/change-hostname-centos-4175507422/)

michaelk 06-11-2014 09:42 PM

I probably got the process mixed up a bit but the client still sends the name to the server using the send host-name directive.

If your using DHCP then check the dhclient running process i.e.on one of my CentOS boxes. -cf /var/run/nm-dhclient-eth1.conf which contains send host-name "hostname" How else does the server set the name if it does not get it from the client?

blackRonin 06-12-2014 10:57 AM

I'm not using eth, just wlan
so i dont have /etc/sysconfig/network-scripts/ifcfg-eth0 or ifcfg-wlan0


My /etc/resolv.conf is
Quote:

# Generated by NetworkManager
domain home
search home
nameserver 192.168.1.254
My vim /var/run/nm-dhclient-wlan0.conf :
Quote:

# Created by NetworkManager

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
option ms-classless-static-routes code 249 = array of unsigned integer 8;

also request rfc3442-classless-static-routes;
also request ms-classless-static-routes;
also request static-routes;
also request ntp-servers;

I also want to tell that.
Recently i installed KDE, and removed it.
But after that, my hostname was changed to new-host.
And the router see it also.

How to change that ?
Where was that change made ?

szboardstretcher 06-12-2014 11:34 AM

you can look under the /etc/NetworkManager directory to find the config files for NetworkManager.

blackRonin 06-12-2014 11:51 AM

Networkmanager config shows
root@new-host:~# cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifcfg-rh


and that's it.

lleb 06-13-2014 08:54 AM

dont use both network manager and the ifcfg-eth0 file. they will conflict. remove the network manager.

blackRonin 06-14-2014 03:49 PM

Dear @lieb which both ?
I'm currently using only NM .
I don't have ifcfg-eth0

I see:
Code:

root@new-host:~# vim /etc/sysconfig/network-scripts/
ifcfg-lo                ifdown-post            ifup-bnep              ifup-post              net.hotplug
ifdown                  ifdown-ppp              ifup-eth                ifup-ppp                network-functions
ifdown-bnep            ifdown-routes          ifup-ippp              ifup-routes            network-functions-ipv6
ifdown-eth              ifdown-sit              ifup-ipv6              ifup-sit               
ifdown-ippp            ifdown-tunnel          ifup-isdn              ifup-tunnel           
ifdown-ipv6            ifup                    ifup-plip              ifup-wireless         
ifdown-isdn            ifup-aliases            ifup-plusb              init.ipv6-global

Btw. why my hostname was changed ? i don't understand that.

blackRonin 06-17-2014 03:42 PM

bump. please help

tairoylance112 06-18-2014 06:24 AM

There are several ways to do that but I am using the old way. VI is my friend and still working. I am using a remote SSH session to one of my virtual machines but you can perform same steps from the console.
Login with putty.exe
Goto /etc/sysconfig/
Type vi network
Press i on the keyboard and change the HOSTNAME to your preferred servername
Press ESC on the keybord
Save the configuration by :wq!
Log off or reboot
- See more at: http://www.networknet.nl/apps/wp/arc....DF2rDPMj.dpuf

blackRonin 06-18-2014 03:09 PM

tairoylance112, i know this method.
But it's not working for me.

When i changed hostname in /etc/sysconfig/network
I see changes only on that machine.

Router and another computers in network see old hostname (new-host etc.)

GaWdLy 06-18-2014 11:24 PM

I totally lost my post...

BR: We have helped you as much as we can, I'm afraid. Make the changes CONSISTENTLY in the places we've told you to make them:

- bash prompt: hostname [hostname]
- /etc/sysconfig/networking: HOSTNAME=[hostname]
- /etc/hosts: put your hostname/FQDN in the FIRST position, not the last. Like so...

# cat /etc/hosts
127.0.0.1 [hostname] [hostname.domain] localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

When monkeying around with DNS or hostnames-things that are affected by sessions and whatnot-reboot after the changes are made.

blackRonin 06-22-2014 10:14 AM

I want to wait for solution coz my problem get more weirder.

I looked that, linux centos, after connecting to wifi using new adapter (alfa awus036nha)
Inherit windows 7 hostname.

Please look here;
Quote:

peter@new-host:~$ su -
Password:
root@new-host:~# logout
(and now i disconnecting bulit-in wifi adapter, connecting alfa) and issue su - command
peter@new-host:~$ su -
Password:
root@Peter-Computer:~#


All times are GMT -5. The time now is 04:07 AM.