ISC-DHCP Programming Notes
Here are some programming notes that I have collected working with ISC-DHCP at my job that may come in handy.
If you put this code in the dhcpd.conf file (Located at /etc/dhcpd.conf in RedHat/CentOS or /etc/dhcp3/dhcpd.conf in Ubuntu)
if known {
log (info, concat ("HOSTNAME: ", host-decl-name, " on ",binary-to-ascii (10, 8, ".", leased-address)," at ", binary-to-ascii (16, 8, ":", substring (hardware, 1, 6))));
}
Will result in a message simular to the following in your DHCP Log file:
HOSTNAME: TestPC001 on 208.x.x.75 at d0:50:56:ac:74:71
DHCPDISCOVER from d0:50:56:ac:74:71 via eth0
DHCPOFFER on 208.x.x.75 to d0:50:56:ac:74:71 via eth0
DHCPREQUEST for 208.x.x.75 (172.18.1.2) from d0:50:56:ac:74:71 via eth0
DHCPACK on 208.x.x.75 to d0:50:56:ac:74:71 via eth0
The following code will check to see if the incoming packet has the DHCP Broadcast Flag set. If it does, it will log to the log file that someone has broadcast flag set.
if binary-to-ascii (16,8,"",packet(10,3)) = "8000" {
log (info, concat ("The user ", binary-to-ascii(16,8, ":", substring(hardware,1,6)), " has the DHCP Broadcast Flag set."));
}
Example Log file entry:
DHCPDISCOVER from d0:50:56:ac:74:71 via eth0
The user d0:50:56:ac:74:71 has the DHCP Broadcast Flag set.DHCPOFFER on 208.x.x.75 to d0:50:56:ac:74:71 via eth0
The following code in the configuration file will add anyone who has the DHCP Broadcast flag set to a member of “Broadcasters” then you may allow or deny them in a subnet declaration:
class "broadcasters" {
match if binary-to-ascii (16,8,"",packet(10,3)) = "8000";
}
In the subnet declaration you then can do allow members of broadcasters; to allow only those specific users.
Term Explaination:
host-decl-name – Is the host declaration name in the dhcpd.conf file (host TestPC { … })
binary-to-ascii(a,b,c,d) – binary-to-ascii(Base 2 to 16, width in bits of each number, seperates each bit with the character, the numeric expression to be tested)
leased-address – The IP address leased to the client (in binary)
substring(a,b,c) – substring(hardware, 1, 6) – This gets the MAC address of the client. substring(data expression, offset bytes, length in bytes)
hardware – Returns type of network indicated in packet (Ethernet), then the MAC address.
packet(a,b) – packet(offset byte, additional bytes) — This starts at the Bootstrap Protocol.
Packet Information:
0,1 – Message Type (01 – Boot Request, 02 – Boot Reply)
1,1 – Hardware Type (01 – Ethernet)
2,1 – Hardware Address Length (usually 06)
3,1 – Hops (usually 00)
4,7 – Transaction ID of the handshake.
8,3 – Seconds Elapsed
10,3 – Bootflag (0000 = off, 8000 = on)
12,7 – Client IP Address
16,7 – Your (client) IP Address
20,7 – Next Server IP Address
24,7 – Relay Agent IP Address
28,11 – Client MAC Address
34,19 – Client Hardware Address Padding
44,63 – Server host name
76,127 – Boot File
140,7 – Magic Cookie (DHCP)
144,1 – DHCP Message – Option
146,1 – DHCP Message – Length
148,1 – DHCP Message – Value
150,1 – Client ID – Length
152,13 – Client ID – Value (All of the client ID values past 152)
152,1 – Client ID – Hardware Type
154,11 – Client ID – Client MAC Address
160,1 – Requested IP – Option
162,1 – Requested IP – Length
164,7 – Requested IP – Value
168,21 – Host Name
180,19 – Vendor Class ID
190,1 – Param List – Option
192,1 – Param List – Length
194,23 – Param List – Value (All the param list values past 194)
194,1 – Param List – Subnet Mask
196,1 – Param List – Domain Name
198,1 – Param List – Router
200,1 – Param List – DNS
202,1 – Param List – NetBIOS Name Server
204,1 – Param List – NetBIOS Node Type
206,1 – Param List – NetBIOS Scope
208,1 – Param List – Perform Router Discover
210,1 – Param List – Static Route
212,1 – Param List – Classless Static Route
214,1 – Param List – Private Static Route (Microsoft)
216,1 – Param List – Vendor Specific
September 2nd, 2011 at 6:22 pm
Have you done anything related to IPv6? specifically log the IPv6 address with the DUID as well as the MAC of a cable modem?
July 12th, 2012 at 12:08 pm
Hi,
This was very useful to me,
thank you very much…..:)
May 1st, 2025 at 8:12 am
продать аккаунт маркетплейс для реселлеров
May 1st, 2025 at 8:29 am
перепродажа аккаунтов профиль с подписчиками
May 1st, 2025 at 8:41 am
покупка аккаунтов купить аккаунт с прокачкой
May 1st, 2025 at 9:00 am
купить аккаунт купить аккаунт с прокачкой
May 1st, 2025 at 7:41 pm
безопасная сделка аккаунтов биржа аккаунтов
May 1st, 2025 at 7:59 pm
аккаунты с балансом купить аккаунт
May 1st, 2025 at 8:04 pm
магазин аккаунтов социальных сетей https://pokupka-akkauntov-online.ru/
May 2nd, 2025 at 2:08 pm
Account Sale Gaming account marketplace
May 2nd, 2025 at 2:09 pm
Guaranteed Accounts Account Acquisition
May 2nd, 2025 at 2:25 pm
Buy Pre-made Account Find Accounts for Sale
May 2nd, 2025 at 2:36 pm
Account Buying Platform Account Acquisition
May 3rd, 2025 at 7:54 am
Account Acquisition Account Acquisition
May 3rd, 2025 at 7:56 am
Account Buying Platform Accounts market
May 3rd, 2025 at 8:05 am
Find Accounts for Sale Account Store
May 3rd, 2025 at 8:24 am
Account exchange Sell Account
May 3rd, 2025 at 6:46 pm
Account exchange Website for Buying Accounts
May 3rd, 2025 at 6:47 pm
Account Exchange Service Purchase Ready-Made Accounts
May 3rd, 2025 at 8:47 pm
Profitable Account Sales Buy Pre-made Account
May 4th, 2025 at 11:43 am
secure account sales account selling service
May 4th, 2025 at 11:47 am
verified accounts for sale buy pre-made account
May 4th, 2025 at 11:56 am
account marketplace purchase ready-made accounts
May 4th, 2025 at 12:34 pm
account marketplace account buying platform
May 5th, 2025 at 7:07 am
social media account marketplace social media account marketplace
May 5th, 2025 at 7:11 am
buy account marketplace for ready-made accounts
May 5th, 2025 at 7:22 am
account selling platform account exchange
May 5th, 2025 at 7:48 am
account exchange account trading service
May 5th, 2025 at 6:05 pm
account buying service sell accounts
May 5th, 2025 at 6:06 pm
buy and sell accounts account exchange
May 5th, 2025 at 8:05 pm
account exchange sell accounts
May 6th, 2025 at 3:05 am
accounts for sale account purchase
May 6th, 2025 at 9:11 am
buy account https://accounts-buy.org
May 6th, 2025 at 9:11 am
buy and sell accounts account exchange
May 6th, 2025 at 9:23 am
gaming account marketplace account trading service
May 6th, 2025 at 7:31 pm
account trading service verified accounts for sale
May 6th, 2025 at 7:33 pm
accounts market account buying service
May 7th, 2025 at 5:44 am
accounts for sale database of accounts for sale
May 7th, 2025 at 5:45 am
sell account buy and sell accounts
May 7th, 2025 at 5:55 am
account purchase account trading platform
May 7th, 2025 at 6:56 am
account trading platform ready-made accounts for sale
May 7th, 2025 at 7:48 pm
secure account purchasing platform accounts for sale
May 7th, 2025 at 7:49 pm
secure account sales account trading
May 7th, 2025 at 8:04 pm
social media account marketplace https://discount-accounts.org
May 8th, 2025 at 6:46 am
secure account sales website for buying accounts
May 8th, 2025 at 7:21 am
online account store purchase ready-made accounts
May 8th, 2025 at 10:41 am
account exchange service social media account marketplace
May 8th, 2025 at 10:58 am
sell pre-made account buy accounts
May 9th, 2025 at 9:22 am
buy and sell accounts https://accounts-offer.org/
May 9th, 2025 at 9:27 am
account market https://accounts-marketplace.xyz
May 9th, 2025 at 9:37 am
website for selling accounts https://buy-best-accounts.org
May 9th, 2025 at 10:12 am
account store https://social-accounts-marketplaces.live
May 9th, 2025 at 8:38 pm
account trading service https://accounts-marketplace.live
May 9th, 2025 at 8:41 pm
buy and sell accounts https://social-accounts-marketplace.xyz
May 9th, 2025 at 8:54 pm
account store https://buy-accounts.space
May 10th, 2025 at 8:16 am
account buying service https://buy-accounts-shop.pro/
May 10th, 2025 at 8:21 am
account acquisition https://accounts-marketplace.art
May 10th, 2025 at 9:05 am
account market https://social-accounts-marketplace.live/
May 10th, 2025 at 12:18 pm
account market buy accounts
May 10th, 2025 at 12:27 pm
buy and sell accounts https://accounts-marketplace.online
May 11th, 2025 at 7:50 am
buy accounts https://accounts-marketplace-best.pro
May 11th, 2025 at 6:15 pm
магазин аккаунтов https://akkaunty-na-prodazhu.pro
May 11th, 2025 at 6:30 pm
купить аккаунт kupit-akkaunt.xyz
May 11th, 2025 at 6:38 pm
продажа аккаунтов магазины аккаунтов
May 12th, 2025 at 9:23 am
продать аккаунт akkaunt-magazin.online
May 12th, 2025 at 9:27 am
купить аккаунт akkaunty-market.live
May 12th, 2025 at 9:45 am
продать аккаунт https://kupit-akkaunty-market.xyz
May 13th, 2025 at 7:10 am
магазин аккаунтов https://akkaunty-optom.live/
May 13th, 2025 at 7:22 am
площадка для продажи аккаунтов https://online-akkaunty-magazin.xyz
May 13th, 2025 at 7:30 am
маркетплейс аккаунтов соцсетей https://akkaunty-dlya-prodazhi.pro/
May 13th, 2025 at 6:37 pm
купить аккаунт kupit-akkaunt.online
May 15th, 2025 at 12:43 pm
facebook account buy https://buy-adsaccounts.work
May 15th, 2025 at 12:53 pm
facebook ad account buy fb accounts for sale
May 15th, 2025 at 12:55 pm
facebook ads account buy https://buy-ad-account.top
May 15th, 2025 at 2:07 pm
facebook ad account buy https://buy-ads-account.click
May 16th, 2025 at 7:17 am
cheap facebook advertising account https://ad-account-buy.top
May 16th, 2025 at 7:21 am
buy facebook account for ads https://buy-ads-account.work
May 16th, 2025 at 7:32 am
facebook accounts to buy https://ad-account-for-sale.top/
May 16th, 2025 at 12:27 pm
buy fb ad account https://buy-ad-account.click