Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.
[acme@localhost ~]$ su
Password: 
[root@localhost acme]# 

Now I connect internet and I get the following:

[root@localhost acme]# exit
exit
[root@localhost acme]# su
[root@dhcppc9 acme]#  

Edit

[root@dhcppc9 lin64]# echo $PS1
[\u@\h \W]\$

I observed that it is hapnning in user also not just when I am in superuser.

Why this dhcppc9 is coming ?

OS: RHEL 6

share|improve this question
    
in bash, the environment variable PS1 define your bash prompt, could give us the result of echo $PS1 ? to do so please edit your question instead of comment. –  Kiwy Jan 31 at 9:17
1  
Short nickpitting: PS1 is not an environment variable, but a shell variable. (It is used by the shell itself, rather than by commands called from that shell, you don't use export to set it and env will not list it.) –  michas Jan 31 at 9:23
    
@michas thank you for the info, I didn't notice the difference. –  Kiwy Jan 31 at 9:38
    
when i enter /etc/dhcp in terminal , i could not find a file by the name dhclient.conf whereas dhclient.d is present in dhcp –  msz Jan 31 at 9:49
    
@michas: when i enter /etc/dhcp in terminal , i could not find a file by the name dhclient.conf whereas dhclient.d is present in dhcp –  msz Jan 31 at 10:35

1 Answer 1

The DHCP Server in your network is configured to send a hostname via the dhcp handshake.

You can configure your client not to request a hostname. In the file /etc/dhcp/dhclient.conf you can see how your dhcp client is configured.

Edit the request statement and remove the host-name out of the list. In my case, before:

request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers,
        dhcp6.domain-search, dhcp6.fqdn,
        dhcp6.name-servers, dhcp6.sntp-servers;

and after:

request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers,
        dhcp6.domain-search, dhcp6.fqdn,
        dhcp6.name-servers, dhcp6.sntp-servers;

Now your system should not change the hostname after connecting.

share|improve this answer
    
when i enter /etc/dhcp in terminal , i could not find a file by the name dhclient.conf whereas dhclient.d is present in dhcp. I using RHEL 6.0 , 64 bit –  msz Feb 1 at 8:27
    
You can create that file with the content above, dhclient uses it if it exists. –  chaos Feb 1 at 15:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.