iptables multiple ips PRErouting? (--to-destination & -dst)

postcd

Member
Credits
89
Hello, my iptables v1.4.21 rule is:
-A PREROUTING -i eth0 -p udp -m udp --dport 1234:1234 -j DNAT --to-destination 10.8.0.2,10.55.55.2

but i get error: Bad IP address "10.8.0.2,10.55.55.2"

How do i define --to-destination parameter for two IPs please?

In the man page on my CentOS 7 i am unable to find description for the -dst and --to-destination parameters.

Or i must create two identic commands one for first and other for second IP?
 


jake19

New Member
Credits
66
Haven't you been using IPtables for a long time now? And that is a very clear error message. The error is telling you you have bad syntax for the ip address. The docs on iptables tell you that only ranges within the same subnet can be defined that way and you say you read the docs.

So since you can't specify the addresses like you want its pretty clear you need two rules, 1 for each. Why didn't you just put those rules in? Would've been quicker than asking someone else.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top