Skip to contentSkip to conversation

block dhcp service based on mac

DISCUSSION System Admin 4 participants 5 messages May 30, 2006 – May 31, 2006

lore
Share & tools
lore
#0 lore raw

hello all

I have an dhcp server and i want to block a particular mac address (that pc is virus infected) from using my dhcp service so that it will not get any valid ip address.

for that i have used

/sbin/iptables -I INPUT -i eth2 -p all -m mac --mac-source 00:02:E3:34:EA:77 -j DROP

or

/sbin/iptables -I INPUT -i eth2 -p udp --dport 67:68 -m mac --mac-source 00:05:5D:4A:8A:3B -j DROP

while the iptables rule match count do increase but the pc is still getting ip address from my dhcp server which is seen from dhcpd log file.

does the packet goes to dhcp service before going to iptables stack? I am using redhat 9 with dhcp-3.0pl1-23 dhcp server.

Thank you

------------------------------------------------- DISCLAIMER ---------------------------------------------------------
This email is intended for the exclusive use by the person(s) mentioned as recipient(s) and may contain information that is confidential and/or privileged.This email does not constitute any commitment from Nepal Bank Limited or its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Nepal Bank Limited or its subsidiaries. If you receive this email by mistake, please notify the sender or notify by emailing at [email protected] and delete this email immediately from your system and destroy all copies of it. You may not, directly or indirectly, use, disclose, distribute, print or copy this email or any part of it if you are not the intended recipient.

#1 lore raw

1. With iptables -I you would usually need to specify a rule number where to insert your new rule. Instead use iptables -A to add the rule to the end of the chain.

2. I see 2 different MAC addresses for 1 machine? You 100% sure that's ok and that the machine in question uses these two MAC's and they are not from other machines?

3. Post the output of iptables -L (-nv).

-Sietse

________________________________

From: [email protected] on behalf of System Admin
Sent: Tue 30-May-06 7:36
To: [email protected]
Subject: block dhcp service based on mac

hello all

I have an dhcp server and i want to block a particular mac address (that pc is virus infected) from using my dhcp service so that it will not get any valid ip address.

for that i have used

/sbin/iptables -I INPUT -i eth2 -p all -m mac --mac-source 00:02:E3:34:EA:77 -j DROP

or

/sbin/iptables -I INPUT -i eth2 -p udp --dport 67:68 -m mac --mac-source 00:05:5D:4A:8A:3B -j DROP

while the iptables rule match count do increase but the pc is still getting ip address from my dhcp server which is seen from dhcpd log file.

does the packet goes to dhcp service before going to iptables stack? I am using redhat 9 with dhcp-3.0pl1-23 dhcp server.

Thank you

------------------------------------------------- DISCLAIMER ---------------------------------------------------------
This email is intended for the exclusive use by the person(s) mentioned as recipient(s) and may contain information that is confidential and/or privileged.This email does not constitute any commitment from Nepal Bank Limited or its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Nepal Bank Limited or its subsidiaries. If you receive this email by mistake, please notify the sender or notify by emailing at [email protected] and delete this email immediately from your system and destroy all copies of it. You may not, directly or indirectly, use, disclose, distribute, print or copy this email or any part of it if you are not the intended recipient.

#4 lore raw
In reply to System Admin

<citaat van="System Admin">

Quoted 6 lines

hello all

I have an dhcp server and i want to block a particular mac address (that pc is virus infected) from using my dhcp service so that it will not get any valid ip address.

The DHCP server operates on a lower level than iptables. You'll never achieve this with iptables rules alone.

The solution is very easy. Hardwire the mac address to some IP in the dhcp server. Use 127.0.0.1 or something similarly unusable.

M4

#2 lore raw
In reply to Sietse van Zanen
Quoted 25 lines · Sietse van Zanen

1. With iptables -I you would usually need to specify a rule number where to insert your new rule. Instead use iptables -A to add the rule to the end of the chain.

2. I see 2 different MAC addresses for 1 machine? You 100% sure that's ok and that the machine in question uses these two MAC's and they are not from other machines?

3. Post the output of iptables -L (-nv).

-Sietse

________________________________

From: [email protected] on behalf of System Admin
Sent: Tue 30-May-06 7:36
To: [email protected]
Subject: block dhcp service based on mac

hello all

I have an dhcp server and i want to block a particular mac address (that pc is virus infected) from using my dhcp service so that it will not get any valid ip address.

for that i have used

Quoted 7 lines

/sbin/iptables -I INPUT -i eth2 -p all -m mac --mac-source 00:02:E3:34:EA:77 -j DROP

or

/sbin/iptables -I INPUT -i eth2 -p udp --dport 67:68 -m mac --mac-source 00:05:5D:4A:8A:3B -j DROP

I think this has more to do with the way that dhcp-server listens on the network. You would be better off configuring the dhcp server to not listen to that mac, or give it a silly address like 127.254.254.254 !

Quoted 22 lines

while the iptables rule match count do increase but the pc is still getting ip address from my dhcp server which is seen from dhcpd log file.

does the packet goes to dhcp service before going to iptables stack? I am using redhat 9 with dhcp-3.0pl1-23 dhcp server.

Thank you

------------------------------------------------- DISCLAIMER ---------------------------------------------------------
This email is intended for the exclusive use by the person(s) mentioned as recipient(s) and may contain information that is confidential and/or privileged.This email does not constitute any commitment from Nepal Bank Limited or its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Nepal Bank Limited or its subsidiaries. If you receive this email by mistake, please notify the sender or notify by emailing at [email protected] and delete this email immediately from your system and destroy all copies of it. You may not, directly or indirectly, use, disclose, distribute, print or copy this email or any part of it if you are not the intended recipient.

#3 lore raw
In reply to Sietse van Zanen
Quoted 5 lines

1. With iptables -I you would usually need to specify a rule number where to insert your new rule. Instead use iptables -A to add the rule to the end of the chain.

i have done that properly

Quoted 4 lines

2. I see 2 different MAC addresses for 1 machine? You 100% sure that's ok and that the machine in question uses these two MAC's and they are not from other machines?

yes both should be the same mac address .

Quoted 24 lines

3. Post the output of iptables -L (-nv).

-Sietse

I have an dhcp server and i want to block a particular mac address (that
pc is virus infected) from using my dhcp service so that it will not get
any valid ip address.

for that i have used

/sbin/iptables -I INPUT -i eth2 -p all -m mac --mac-source 00:02:E3:34:EA:77 -j DROP

or

/sbin/iptables -I INPUT -i eth2 -p udp --dport 67:68 -m mac --mac-source
00:05:5D:4A:8A:3B -j DROP

Quoted 10 lines

while the iptables rule match count do increase but the pc is still getting ip address from my dhcp server which is seen from dhcpd log file.

does the packet goes to dhcp service before going to iptables stack? I am using redhat 9 with dhcp-3.0pl1-23 dhcp server.

Thank you

------------------------------------------------- DISCLAIMER ---------------------------------------------------------
This email is intended for the exclusive use by the person(s) mentioned as recipient(s) and may contain information that is confidential and/or privileged.This email does not constitute any commitment from Nepal Bank Limited or its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Nepal Bank Limited or its subsidiaries. If you receive this email by mistake, please notify the sender or notify by emailing at [email protected] and delete this email immediately from your system and destroy all copies of it. You may not, directly or indirectly, use, disclose, distribute, print or copy this email or any part of it if you are not the intended recipient.