LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-04-2005, 11:11 PM   #1
assyrian1
LQ Newbie
 
Registered: Jun 2005
Location: sydney
Distribution: Fedora Core 7
Posts: 17

Rep: Reputation: 0
localhost name localdomain name


hi
I have just installed mandrake 10.1 and it set my host and domian name to
cpe-144.136...(some ip adress).nsw.bigpond.net.au

I find this annoying I want to change it to
mynamePC.HOME
heres what I did.

- "hostname mynamePC.HOME"
when I do hostname -f I get
hostname: unknown host

anyway I procedded to edit /etc/hosts to
127.0.0.1 mynamePC.HOME mynamePC

then edited /etc/sysconfig/network which now says
HOSTNAME=nynamePC.HOME
NETWORKING=yes

and
ehco mynamePC.HOME > /proc/sys/kernel/hostname
killall dhclient
"service network restart" or "/etc/rc.c/init.d/network restart (i tried both)

I then restarted the pc i.e shutdown -r now and it still did not change

"netconfig" is not on my system also my bigpond cable modem is connected to my eth0
(bigpond is an cable internet provider)
thanks
 
Old 07-05-2005, 12:20 AM   #2
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
That name is given to you by your ISP and you usually can't change it easily.

If you want to be able to access it by another name just edit /etc/hosts and add the name you want in the same line as 127.0.0.1, separated by a space or a tab from the other entries.
 
Old 07-05-2005, 12:48 AM   #3
overlord73
Member
 
Registered: Apr 2004
Location: ..where no life dwells..
Posts: 541

Rep: Reputation: 30
hi,
I don´t understand the problem.
what´s the relation between your hostname and your "online-hostname" set by your ISP????
 
Old 07-05-2005, 12:53 AM   #4
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
I was wondering that too...but I just assumed that he wants to be able to reference his computer by a more normal-looking name on his LAN or locally or whatever.

That /etc/hosts won't change your actual hostname but it will make an alias to it which may be what you need.

If you really want to change your host name you'll need to get a FQDN and get a DNS service.
 
Old 07-05-2005, 12:55 AM   #5
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
/etc/hosts first line is normally for the loopback interface.

127.0.0.1 localhost lo (and so on)
192.168.x.y mypc.mynet.net mypc (you have to make up your own IP)

It goes: IP<spaces>hostname<spaces>alias1<spaces>alias2<spaces> ...
If you change the 127.0.0.1 line, some things won't work ... like printing?

Your isp would have had an entry in there too I guess - it is needed for you to receive packets from them.

After setting your own network name etc as above, the hostname= may work for you so it says "welcome to myhost.mynet.net" (or whatever) in the logon screen.

However - your isp may have got you to install a script which changes your hostname at reboot.
 
Old 07-05-2005, 01:00 AM   #6
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
Not just at reboot but at DSL connect.
 
Old 07-05-2005, 01:07 AM   #7
assyrian1
LQ Newbie
 
Registered: Jun 2005
Location: sydney
Distribution: Fedora Core 7
Posts: 17

Original Poster
Rep: Reputation: 0
hi
the problem is that I dont know why my local hostname is set to an IP adress which was assigned by the ISP
I dont want an ip address as the name of my localhost, I want my name to be the name of the localhost.

I want to change my local hostname from the IP adress which was assigned i.e cpe_144-136.. to myname.HOME

to make it cleared
when I log in to my machine this is what it looks like
root@cpe-144-136-111-xxx.nsw.bigpond.net.au#
but I want it to be
root@mynamePC.HOME#

how do I do that.
 
Old 07-05-2005, 01:19 AM   #8
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
All that aside, you just want to change the prompt:

In ~/.profile add
Code:
export PS1='\u@mypc.home \$'
Which will give you
root@mypc.home #
as a prompt.
 
Old 07-05-2005, 04:05 AM   #9
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 33
your adsl modem seems to be connected directly to your computer (such as a usb modem)
your isp will generally hand out a dns name though you might be able to not accept this when it is offered... 'm not sure, but i believe you could have a look in your dhcp client man page
 
Old 07-05-2005, 04:17 AM   #10
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
"cpe-144-136-111-xxx" will be the name of the modem (as well as it's IP). If the modem is connected directly to the computer (via USB as suggested or otherwise) then this must be the name of the computer too. Otheriwse, how is the computer to see anything in the modem?

(Though I'm wondering if this name can be an alias name instead? But it would appear that setting up a DNS server would do the trick.)

Generally, if you plug the modem in through a ethernet nic, then you can keep your hostname whatever you want and just set DHCP.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
localhost.localdomain steve007 Linux - Newbie 3 07-27-2005 03:48 AM
localhost.localdomain RJEmery Linux - Newbie 21 05-30-2005 03:59 PM
localhost.localdomain cryzpene Linux - Software 1 06-05-2004 11:57 AM
localhost.localdomain d1ny3 Mandriva 2 04-17-2004 08:27 PM
localhost.localdomain??? neozero62 Linux - Newbie 2 10-31-2003 10:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration