DHCRELAY Linux

Monday, April 12, 2010 |

I am sure that many people will not get into the situation were I was in today.  The problem was simple but the fix was not under my control or reach. Had to find a work around to meet the project deadline.

Scenario:

I had to do OS installation of bunch of  brand new servers on a new VLAN.  All servers were connected under a A10 load balancer which was not supporting ip-helper (ie; I was  unable to contact the DHCP servers from the network to do a PXE boot for OS installation). On contacting A10 Load balancer team, they confirmed that their current version is not supporting ip-helper.  As the servers were on remote location, I cannot do a CD based installation and even if I get a hands and eyes support, its going to take long.  My goal was to install RHEL 5.4 from remote corporate satellite server.

Solution:

1. I had DRAC (Dell Remote Access Consoles) on all these servers. I have installed a base OS image by mounting an operating iso image through DRAC (virtual disk).  Then assigned an IP address, subnetmask, gateway on the the newly installed dummy server.
2.  Installed dhcp server rpm "dhcp-3.0.5-21.el5.x86_64.rpm" on the box. It provides dhcrelay service which can be configured as a proxy to route dhcp traffic from local network to remote DHCP server.

Then start the dhcrelay by below command: (yes you are good to go)
/usr/sbin/dhcrelay -i eth0 ip-remote-dhcp-server

 (man dhcrelay will show you full options of this command)

3. The above setting can be made permanent by adding the interface and DHCP server IP on /etc/sysconfig/dhcrelay

INTERFACES="eth0"
DHCPSERVERS="ip-of-remote-dhcp-server"

4. Start the service using

/etc/init.d/dhcrelay start


5. Make sure that the relay service is running on the host by a ps command
ps ax | grep dhcrelay

6. Rebooted the servers need to imaged from DRAC.  Press F12 to get into the PXE boot mode. Server got IP address by proxying through the DHCP relay server.

How it works:

- When the server to be installed boot up it sends a DHCP request as broadcast on the network
11:48:55.809189 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from xx:xx:xx:xx:xx:xx (oui Unknown), length: 300
- DHCP relay server running on the same network accept this broadcast
- DHCP relay server requests DHCP server on remote network for an IP address
11:48:55.809286 relay-server-IP.bootps > DHCP-IP.bootps: BOOTP/DHCP, Request from xx:xx:xx:xx:xx:xx (oui Unknown), length: 300 

- DHCP relay server did a small trick while requesting the IP by putting mac address as the MAC address of the server to be installed.
11:48:55.809286 relay-servr-IP .bootps > dhcp-server-ip.bootps: BOOTP/DHCP, Request from xx:xx:xx:xx:xx:xx (oui Unknown), length: 300

xx:xx:xx:xx:xx:xx  - MAC of server to be installed

- Rest will be like a normal DHCP request and new server will get IP lease from DHCP server.

0 comments:

Post a Comment