Masquerade based on MAC address

I want to share the internet connection to one particular client pc. currently I am using iptables Masquerade based on IP address. I want to change client IP adress to client MAC address.
rajasekarramasamyAsked:
Who is Participating?
 
tim1128Commented:
You can use "-m mac --mac-source XX:XX:XX:XX:XX:XX" part of your rules set , Like only permit 80 request from that machine of MAC Addreess.
0
 
rajasekarramasamyAuthor Commented:
Hi,

iptables -t nat -A POSTROUTING -m mac --mac-source xx:xx:xx:xx:xx:xx -j MASQUERADE

The above rule is not working. it showing some error like this

Iptables: Invalid argument

Please check my rule.
0
 
nociSoftware EngineerCommented:
You are too late in the chain, the test needs to be done when entering... see article...
(INPUT, FORWARD, PREROUTING) are the chains to add the rule too.
So you have to block all forwards except these that are allowed.
Anything that eventualy reaches the output path needs to be natted.

http://www.cyberciti.biz/tips/iptables-mac-address-filtering.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.