LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-16-2005, 06:54 AM   #1
l23x4
LQ Newbie
 
Registered: Jul 2005
Posts: 4

Rep: Reputation: 0
Change computer name


Hi!

I need some help changing the computer name on a linux pc.

I have putty and desktop acecss, so either one is ok, but the best would be how to do it by putty.

Anyone that can help?
 
Old 07-16-2005, 07:42 AM   #2
abovett
Member
 
Registered: Feb 2004
Location: England
Distribution: Mandriva, Ubuntu, SME server + others
Posts: 41

Rep: Reputation: 16
Which distro are you using?

The hostname can be changed via the "hostname" command but this is not a permanent change, as it actually gets set each time the system boots. Different distros get the name from different places - for example, I believe that Ubuntu (and Debian?) uses /etc/hostname, whilst Mandriva uses an entry in /etc/sysconfig/network (picked those as examples because I happen to have them running at the moment). There may also be other files that need updating - for example, your /etc/hosts file.

Frankly, the easiest way (if possible) is to use the config tool appropriate to the distro you're using, as it should update all relevant entries, but if you want/need to do it manually, tell us your distro and I or someone will probably be able to give you more specific details.

HTH

Andy B
 
Old 07-16-2005, 07:58 AM   #3
l23x4
LQ Newbie
 
Registered: Jul 2005
Posts: 4

Original Poster
Rep: Reputation: 0
I have the mandrake 10.0 if that is what you ment.


When I was using suse it le me choose the hostname for the network.
That way I could find the ip adress using "ping" from my windows computer.


The original question here is how do i get the ip to the linux pc if i dont know it and dont have router acsess?

Last edited by l23x4; 07-16-2005 at 08:09 AM.
 
Old 07-16-2005, 08:59 AM   #4
abovett
Member
 
Registered: Feb 2004
Location: England
Distribution: Mandriva, Ubuntu, SME server + others
Posts: 41

Rep: Reputation: 16
Quote:
Originally posted by l23x4
I have the mandrake 10.0 if that is what you ment.
OK - that helps.

Quote:
The original question here is how do i get the ip to the linux pc if i dont know it and dont have router acsess?
Not quite sure what you mean by "don't have router access". Do you have physical access to the PC (i.e. the keyboard and monitor of the PC itself)?

By "IP to the Linux PC" do you mean finding the IP address of the Linux PC? If you have physical access you can do that via the Mandrake control panel, or from a console. You can SU to root and then type "ifconfig" to get the configuration of all the interfaces.

Not sure if that helps - I'm struggling to understand what you are really trying to do here, and I'm not sure what your level of Linux knowledge is (e.g. are you familiar with using a console?). Can you describe your setup and what you are trying to achieve in a bit more detail? I'm pretty familiar with Mandrake and with linux/windows networking so I think I will be able to help you - once I understand what you are trying to do!

Cheers

Andy B
 
Old 07-16-2005, 03:05 PM   #5
l23x4
LQ Newbie
 
Registered: Jul 2005
Posts: 4

Original Poster
Rep: Reputation: 0
I have an linux pc.

When I take the linux pc with me to friends (CS server) I dont connect it with keyboard or monitor. (Just Lan cable and power)
All the other things is realy unnessesary.

Then of course I dont bring my own router so the IP adress becomes unknown to me, and I dont want to use a static IP.
Then I figured, I need some way to get the IP adress or set the hostname so I can use "ping" to get the IP.


Any ideas? :P
 
Old 07-16-2005, 03:53 PM   #6
abovett
Member
 
Registered: Feb 2004
Location: England
Distribution: Mandriva, Ubuntu, SME server + others
Posts: 41

Rep: Reputation: 16
I think I understand what you are asking now.

If you don't want to use a static IP address, where are you going to get the address from? The only way that will work AFAIK is if there is a DHCP server somewhere on your friend's network to give the Linux box an address. Assuming this is the case, I can think of a couple of possible ways of determining the address that has been assigned, though they are not ideal. Maybe someone else can come up with something better, but here are a couple of ideas that might work.

One would be to run a packet sniffer (such as ethereal) on the Windows PC wilst the Linux box boots - you would see it's traffic as the address is assigned (unless there is a switch in the way).

Another possibility might be that if samba is running and suitably configured on the Linux box, the Windows PC might be able to resolve the host name so you can ping it (as I think you said you did with a SuSE PC?). Pinging by name will only work if there's something to resolve the name to an address - and Windows has several schemes to do that, including NetBIOS/SMB.

You'll note I'm guessing a little here - I've never needed to do exactly what you are describing. It's an intriguing problem - I'll have a play with some Linux and Windows boxes if/when I get a chance and see if I can come up with a more definitive answer.

Cheers

Andy B
 
Old 07-16-2005, 05:49 PM   #7
Kahless
Member
 
Registered: Jul 2003
Location: Pennsylvainia
Distribution: Slackware / Debian / *Ubuntu / Opensuse / Solaris uname: Brian Cooney
Posts: 503

Rep: Reputation: 30
the simplest way to do this is as follows


find out what IP range your friend uses. Configure your network at home to use the same range.

Configure your server with a static IP address outside the address range that the router will hand out, or far enough from where it starts that it wont assign the same address to another mahcine. configure it manually for your network, which is the same setup as your friends (refer to step 1)

i usually have my dhcp server start handing out addresses at .50, and have static ips below that. Collaberate with your friends so that if they also use static addys for some boxes, their boxes are also in that below-dhcp range, but that none of you will have the same static addy (shoudnt be a problem, since you have room for 50 static machines)

If you need more specific diretions, ask and Ill take a closer look at exact step by step when I get home. if this is the case, let me now what the routers are so I can find out what the default ranges are for you.
 
Old 07-17-2005, 05:57 AM   #8
l23x4
LQ Newbie
 
Registered: Jul 2005
Posts: 4

Original Poster
Rep: Reputation: 0
OK, I thought about that.

But what about the times I use it on a big LAN?

The admins there uses backbones, you can`t tell witch ranges they use.

I realy need to change the hostname or some other way to get the IP.
But thanks anyway.


Is there some way to ping the computer using the mac-adress?
(Mac-adress never changes)
 
Old 07-17-2005, 11:47 AM   #9
abovett
Member
 
Registered: Feb 2004
Location: England
Distribution: Mandriva, Ubuntu, SME server + others
Posts: 41

Rep: Reputation: 16
Quote:
Originally posted by l23x4
But what about the times I use it on a big LAN?

The admins there uses backbones, you can`t tell witch ranges they use.

I realy need to change the hostname or some other way to get the IP.
The hostname will only help you if there's something on the network which will resolve it to an address. Just setting (or changing) the hostname does not automatically make the name "visible" to other computers on the network. There's more than one way to resolve a name on a Windows network (WINS, DNS etc) and I must confess I'm not too hot on how they all work - something I need to learn more about myself.

Quote:
Is there some way to ping the computer using the mac-adress?
(Mac-adress never changes)
Well it wouldn't be "ping" but there may be a way of discovering the IP address assigned to a MAC address - not sure. However, MAC addresses aren't routed so it will only work if you're on the same segment of the LAN.

If I have some time I'll look into it in a bit more detail - it's an interesting question - but it may have to wait a day or two.

Cheers

Andy B
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
how to change the name of the computer greghua Linux - Software 2 05-24-2005 09:35 PM
Change computer name? amer_58 Linux - Newbie 2 04-02-2005 09:10 AM
change computer imagineaxion Mandriva 6 11-17-2004 08:33 AM
How do I change the computer name ?? jadermf Linux - Software 4 03-18-2004 06:35 PM
How to change computer name? tied2 *BSD 3 09-14-2003 05:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration