LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Change computer name (https://www.linuxquestions.org/questions/linux-networking-3/change-computer-name-343702/)

l23x4 07-16-2005 05:54 AM

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?

abovett 07-16-2005 06:42 AM

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

l23x4 07-16-2005 06:58 AM

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?

abovett 07-16-2005 07:59 AM

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

l23x4 07-16-2005 02:05 PM

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

abovett 07-16-2005 02:53 PM

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

Kahless 07-16-2005 04:49 PM

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.

l23x4 07-17-2005 04:57 AM

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)

abovett 07-17-2005 10:47 AM

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


All times are GMT -5. The time now is 11:13 PM.