I'm using iptables on my router to redirect all web traffic to my page.
But i don't know how to except my mac address list.
I did command like this
iptables -t nat -A PREROUTING -m mac ! --mac-source xx-xx-xx-xx-xx-xx -p tcp --dport 80 -j DNAT --to 127.0.0.1:8080 (Host A) iptables -t nat -A PREROUTING -m mac ! --mac-source xx-xx-xx-xx-xx-xx -p tcp --dport 80 -j DNAT --to 127.0.0.1:8080 (Host B)
But it just execute command for host A. It means Host A can access web normally but Host B still got redirect.
How can i got access normally for both mac address?
Best Answer
Your are getting this problem as your are using !. Say, one request comes and if mac address of coming host in that is other than mac address of host A, it will be redirected. And hence it is also being redirected for host B. And your second rule will never be executed.
So the solution for, how to except my mac address list?