Skip to contentSkip to conversation

mac/ip match

DISCUSSION M. Ziya Ozudogru 2 participants 6 messages Sep 18, 2003 – Sep 19, 2003

lore
Share & tools
lore
#0 lore raw

Hi

Any hints about the following problem will be appreciated. Thanks a lot...

I want to assure that only given ip/mac matches will access to the internet (i mean if someone takes the ip that does not belong to his/her mac address no access will be given) . I will give the ip to the mac address by the dhcp..

In my knowledge, i want to set these ip/mac groups using the command:

arp -s ip mac

and i want to redirect unused ip to an unused mac with the same way...

Here comes the problem.. How can i define in iptables to use these arp rules and give access only the one addresses that match the rules and should block all the others ( well i want to block the others [unused ip addresses by using iptables mac macth module ] ) . ? Any hints ?

Thanks for your valuable help...

#1 lore raw
Quoted 4 lines · M. Ziya Ozudogru

Here comes the problem.. How can i define in iptables to use these arp rules and give access only the one addresses that match the rules and should block all the others ( well i want to block the others [unused ip addresses by using iptables mac macth module ] ) . ? Any hints ?

See mac match :

cbr@elendil:~$ iptables -m mac --help
[...]
MAC v1.2.8 options:
 --mac-source [!] XX:XX:XX:XX:XX:XX
                                Match source MAC address

Now, you just have to implement rules matching source mac address and source IP address.

Signature · 2 lines
http://www.netexit.com/~sid/
PGP KeyID: 157E98EE FingerPrint: FA62226DA9E72FA8AECAA240008B480E157E98EE
#2 lore raw

Thanks for your help but how can i assure that given mac is using the ip i assign to it? And if it is using its assigned ip it should pass if it is not it should be blocked

Quoted 16 lines · Cedric Blancher
Quoted 4 lines · M. Ziya Ozudogru

Here comes the problem.. How can i define in iptables to use these arp rules and give access only the one addresses that match the rules and should block all the others ( well i want to block the others [unused ip addresses by using iptables mac macth module ] ) . ? Any hints ?

See mac match :

cbr@elendil:~$ iptables -m mac --help
[...]
MAC v1.2.8 options:
 --mac-source [!] XX:XX:XX:XX:XX:XX
                                Match source MAC address

Now, you just have to implement rules matching source mac address and source IP address.

#3 lore raw
Quoted 3 lines · M. Ziya Ozudogru

Thanks for your help but how can i assure that given mac is using the ip i assign to it? And if it is using its assigned ip it should pass if it is not it should be blocked

If all your rules are this kind :

	iptables -A FORWARD -m mac --mac-source $MAC -s $IP -j ACCEPT

Then an unknown MAC address won't be able to get through and a known one will accepted _only_ if used with correct source IP. Isn't it what you wanted or am I missing something ?

Signature · 2 lines
http://www.netexit.com/~sid/
PGP KeyID: 157E98EE FingerPrint: FA62226DA9E72FA8AECAA240008B480E157E98EE
#4 lore raw

Thanks a lot for your valuable help. I think this will solve my problem

Quoted 12 lines · Cedric Blancher
Quoted 3 lines · M. Ziya Ozudogru

Thanks for your help but how can i assure that given mac is using the ip i assign to it? And if it is using its assigned ip it should pass if it is not it should be blocked

If all your rules are this kind :

	iptables -A FORWARD -m mac --mac-source $MAC -s $IP -j ACCEPT

Then an unknown MAC address won't be able to get through and a known one will accepted _only_ if used with correct source IP. Isn't it what you wanted or am I missing something ?

#5 lore raw
Quoted 1 line · M. Ziya Ozudogru

Thanks a lot for your valuable help. I think this will solve my problem

You're welcome.

If you want to go further, you can have a look to ebtables (layer 2 filtering) and arptables (for 2.6) on http://ebtables.sourceforge.net/
that provide you valuable functionnalities.

Signature · 2 lines
http://www.netexit.com/~sid/
PGP KeyID: 157E98EE FingerPrint: FA62226DA9E72FA8AECAA240008B480E157E98EE