Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a linux based router. I'm trying to create an iptable rule to redirect traffic for a specific client using its mac address. Here is the rule I have now (which isn't working):

 iptables -t nat -A prerouting_lan -m mac --mac-source $mac -i br-lan -p tcp --dport 80 -j DNAT --to $ipaddr

What am I doing wrong? Any suggestions would be appreciated.

EV

share|improve this question

1 Answer 1

Try changing the "--to" in the DNAT field to "--to-destination". From "man iptables":

   DNAT
   This  target  is  only  valid in the nat table, in the PREROUTING and OUTPUT chains, and user-defined chains which are only called
   from those chains.  It specifies that the destination address of the packet should be modified (and all  future  packets  in  this
   connection will also be mangled), and rules should cease being examined.  It takes one type of option:

   --to-destination [ipaddr][-ipaddr][:port[-port]]
share|improve this answer
    
Hmmm...Unfortunately, that doesn't work. I'm still working on it. Any other ideas? –  user548971 Nov 1 '12 at 4:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.