VMware Cloud Community
mihanlin
Contributor
Contributor

Installing - use DHCP and specify a hostname

Hi all,

We are deploying a number of ESX servers in a test environment and we want to use DHCP to assign an IP to the service console. My problem with this is, that there's no way of assigning a hostname to ESX itself (it defaults to localhost.localdomain) when using DHCP.

I have tried assigning a hostname in dhcpd on our DHCP server (using option host-name) but ESX doesn't seem to accept the host-name option and change. Also, because the vswif0 mac address is dynamically generated, we can't assign static DHCP entries to them if we need to blow it away and re-install.

I was hoping there was a way to specify the hostname statically during the installation and use DHCP - this way I could use the hostname as a client ID.

My next thought would be I need to go to some sort of scripted install which could take care of this?

Thanks

Michael

0 Kudos
10 Replies
Texiwill
Leadership
Leadership

Hello,

Welcome to the forums.

DHCP is frowned upon for ESX. Granted you can do this, but you would need to setup /etc/hosts on every ESX server to have the proper name, etc. Also, if the DHCP lease expires you then end up with no way to manage the host.

Scripted install is definitely the way to go.


Best regards,

Edward L. Haletky

VMware Communities User Moderator

====

Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.

Blue Gears and SearchVMware Pro Blogs: http://www.astroarch.com/wiki/index.php/Blog_Roll

Top Virtualization Security Links: http://www.astroarch.com/wiki/index.php/Top_Virtualization_Security_Links

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
0 Kudos
admin
Immortal
Immortal

Agreed don't go down the DHCP route, I have heard of no other person using it in 6 years of doing VMware, and would advise against it.

0 Kudos
RParker
Immortal
Immortal

DHCP is frowned upon for ESX. Granted you can do this, but you would need to setup /etc/hosts on every ESX server to have the proper name, etc. Also, if the DHCP lease expires you then end up with no way to manage the host.

Normally I agree with these types of things, but in this case IF DHCP lease expires if the IP is live you won't lose the lease. If you want to change the IP of the host, it's as simple as changing the reservation to the new IP in DHCP, and release/renew the IP or reboot the ESX host. Simple. For one thing the DHCP server is most likely production use for MOST if not all servers anyway, and if you have a DHCP server down, that's probably the least of the problems.

Also if DNS needs to change, it's all done in one place, instead of X number of times for EACH ESX server, the information is dynamic in DHCP, on muss no fuss. I loathe static IP. There is nothing wrong with DHCP, it makes life so much easier. Static IP much like console access, DOS, and partitioning in Windows is archaic and barbaric, and it's old habits. This is the new millenium, why not move to more efficient use of resource and time. That's my philosophy. People that have never had to do this type of stuff before are NOT going to want to do it, and I don't blame them.

I oppose static IP (and I have this same argument with my co-workers, but with a big exception -- I manage it, so as long as it works YOU can't complain).

Now unless you can give me a VERY compelling reason to actually use Static, then maybe (other than no access to a DHCP server) but I have been over this time and time again, and those age old arguments are just that, OLD!

0 Kudos
RParker
Immortal
Immortal

Agreed don't go down the DHCP route, I have heard of no other person using it in 6 years of doing VMware

We do it. So there is AT LEAST 1. Also you are old school, just because people don't volunteer this info doesn't mean it's not going on.

I bet you any amount of money if we take a poll of ALL ESX admins, those that are 30 and under, USE DHCP unless they are in a shop where they don't manage DHCP themselves, but I submit there are MANY that use DHCP, it just makes things MUCH easier to manage.

And when was the last time you ever heard of a DHCP server issue? Yeah that's a system that just works...

0 Kudos
admin
Immortal
Immortal

lol your number one, no but seriously I am not a site based person or admin, but a hated consultant and I have never come across an ESX DHCP site. DHCP is fine and I know it well hence the name MCT, I guess you just set up MAC to IP reservations etc..

0 Kudos
RParker
Immortal
Immortal

Don't let them scare you, DHCP is fine. DHCP is newer than static, there were days that there WAS no alternative to static, and people don't like to change.

Here's how to setup a DHCP server.

reserve MAC address, release/renew IP address. Or just reboot server.

-done-

Static.

login to host, manually configure etc/hosts file.

add entries for IP, gateway, DNS

login to DNS server, add a STATIC entry for DNS, add the MAC and IP for the server

Do this for EVERY host on your network.

Ah but what if your IP config changes...

DHCP:

make the changes to the zone on DHCP server. automatically propagates to your servers -- nothing else to do!

Static.

ALL those changes you did for ALL those ESX / Servers on your network, you now have to REPEAT ALL over again.. sound like fun? NOT!

Now you tell me, which is easier? Static, please.. only if you enjoy losing hours out of your day and oh yeah.. you have physically be in front of the machine to make these changes.. WOW. DHCP isn't easier and safer? OK Smiley Happy

0 Kudos
admin
Immortal
Immortal

ditto --its easy and up to you --both answers as a VCP and MCT are correct. whatever is easier, do you multpile DCHP servers delivering to mutiple vLANs? or are you a flat network?

0 Kudos
Texiwill
Leadership
Leadership

Hello,

Here is one case where DHCP will not work within the virtual environment.... If you virtualize the DHCP server and the host it is on is down and at the same time the least expires on your other hosts.... I actually ran into this. It was a very strange timing issue where everything happened at once. I would say its an edge case but it could be a serious issue. So how do you mitigate this? Have multiple or clustered DHCP servers.

I use DHCP only in my demo environments.


Best regards,

Edward L. Haletky

VMware Communities User Moderator

====

Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.

Blue Gears and SearchVMware Pro Blogs: http://www.astroarch.com/wiki/index.php/Blog_Roll

Top Virtualization Security Links: http://www.astroarch.com/wiki/index.php/Top_Virtualization_Security_Links

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill
0 Kudos
mihanlin
Contributor
Contributor

Hi all,

Thanks for the replies regarding DHCP.

I was hoping it wasn't going to get into a discussion over whether DHCP was better/worse over static. That was never my intention.

I had a good need to use DHCP as it's a small-ish environment and controlled tightly within a segregated LAN.

However, I just can't seem to find a way of keeping my vswif0 mac address persistent (it changes when I do a re-install).

Looks like I might have to go down the route of a scripted install though. Any ideas on how to get a ks.cfg scripted install to prompt me for a hostname and set this during install, then pass this onto the DHCP server as the hostname option?

Thanks,

Mike.

0 Kudos
Texiwill
Leadership
Leadership

Hello,

However, I just can't seem to find a way of keeping my vswif0 mac address persistent (it changes when I do a re-install).

Yes this happens.

Looks like I might have to go down the route of a scripted install though. Any ideas on how to get a ks.cfg scripted install to prompt me for a hostname and set this during install, then pass this onto the DHCP server as the hostname option?

Check out for how to pass kickstart parameters on the boot line.


Best regards,

Edward L. Haletky

VMware Communities User Moderator

====

Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.

Blue Gears and SearchVMware Pro Blogs: http://www.astroarch.com/wiki/index.php/Blog_Roll

Top Virtualization Security Links: http://www.astroarch.com/wiki/index.php/Top_Virtualization_Security_Links

--
Edward L. Haletky
vExpert XIV: 2009-2023,
VMTN Community Moderator
vSphere Upgrade Saga: https://www.astroarch.com/blogs
GitHub Repo: https://github.com/Texiwill