Masquerade based on MAC address

Posted on 2010-01-07
Medium Priority
Last Modified: 2013-12-15
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.
Question by:rajasekarramasamy

Accepted Solution

tim1128 earned 100 total points
ID: 26198269
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.

Author Comment

ID: 26198680

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.
LVL 41

Assisted Solution

noci earned 100 total points
ID: 26198744
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.


Featured Post

What Security Threats Are We Predicting for 2018?

Cryptocurrency, IoT botnets, MFA, and more! Hackers are already planning their next big attacks for 2018. Learn what you might face, and how to defend against it with our 2018 security predictions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month17 days, 5 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question