Automating ISC DHCP

how can you control your DHCP server remotely
Added by Ohad Levy over 2 years ago

using omapi (omshell):

Add a server

server 192.168.2.99 (my remote DHCP server)
connect
new host
set name = "nx" 
set hardware-address = 54:52:00:13:21:a4
set hardware-type = 1
set ip-address = 192.168.2.105
set statements = "next-server = c0:a8:02:7d; filename = \"pxelinux.0\";option host-name \"nx.lan\";" 
create

next-server has to be in hex, a simple method that converts IP's to hex:

def self.ip2hex ip
  ip.split(".").map{|i| "%02x" % i }.join(":")
end

Remove a server

server 192.168.2.99
connect
new host
set ip-address =  192.168.2.106
open
remove

More complex setup with gpxelinux.0

server 192.168.2.99
connect
new host
set name = "u904" 
set hardware-address = 54:52:00:4b:a5:38
set hardware-type = 1
set ip-address = 192.168.2.106
set statements = "next-server = c0:a8:02:7d; filename = \"gpxelinux.0\"; option host-name \"u904.lan\"; vendor-option-space = \"pxelinux\"; option pxelinux.magic = f1:00:74:7e; option pxelinux.pathprefix = \"http://foreman/\"; option pxelinux.configfile = \"unattended/pxe\";" 

create


Comments

Added by mack Lee 7 days ago

I was looking for some topics that are enough popular and finally founded your blog, it has superb topics with great popularity.
Php Programming India | SEO India Profit By Search | One Way Links

Added by Lolzztitan Lolzztitan 4 days ago

This topic has always fascinated me. Thank you for writing an article that has great content and is well written. Well I am inspired by your writing style.
How Can I Pass a Drug Test

Added by Plentyseven Plentyseven 4 days ago

There are a lot of blogs and articles out there on this topic, but you have captured another side of the subject. This is good content thank you for sharing it.
Buy Herbal Incense