Bizarre hostname question

Issues related to configuring your network
Post Reply
Posts: 2
Joined: 2007/07/27 13:54:43

Bizarre hostname question

Post by tessmonsta » 2007/07/27 14:03:37

Greetings all.

I have CentOS 4.2 installed in a VMWare image. I intend to use it for software training purposes, but I've always had one problem. Since all my students are using a copy of the same image, thus the same hostname, they can't really see each other on the network.

What I would like to do is to create a shell script that would randomly reset the hostname the first time the image is booted. I've thought about incorporating the MAC address from ifconfig, but I'm not quite sure how to do that from within a shell script (a perl script, maybe).

The biggest problem I have with this idea is just where in the init scripts should I stuff this? My guess is that it should be something like /etc/rc0.d/K89RandomHostname, so it would run just prior to the network. I could have my students manually set it, it's just a hassle I'd rather be without.

Any suggestions?

Posts: 7
Joined: 2006/09/09 07:01:24

Re: Bizarre hostname question

Post by huw-l » 2007/08/02 20:12:41

The way we handle this issue is to assign each VM a static MAC address in it's VMX file and then when they boot they query DHCP to get their hostnames. The disk image for all the Virtual machines is a copy of the original Centos4.5 image that I installed manually.

User avatar
Forum Moderator
Posts: 7457
Joined: 2006/09/03 16:37:24
Location: California, US

Bizarre hostname question

Post by toracat » 2007/08/10 16:44:18

This page might be helpful for assigning a Mac address in vmware:

Post Reply

Return to “CentOS 4 - Networking Support”