LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-05-2020, 04:00 AM   #1
postcd
Member
 
Registered: Oct 2013
Posts: 527

Rep: Reputation: Disabled
iptables multiple ips PRErouting? (--to-destination & -dst)


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?
 
Old 07-05-2020, 06:11 AM   #2
tinfoil3d
Member
 
Registered: Apr 2020
Location: Japan/RJCC
Distribution: debian, lfs, whatever else i need in qemu
Posts: 268

Rep: Reputation: 75
Nope, you'd probably need something else here, how would the system decide which one to pick? Maybe it's something you should handle on a software level load-balancer or client side + DNS?
 
Old 07-05-2020, 10:13 AM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by postcd View Post
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?
Sorry, but you've been asking about iptables and such things for over SIX YEARS now, including the dport/destination flags:
https://www.linuxquestions.org/quest...es-4175499534/
https://www.linuxquestions.org/quest...ed-4175505960/
https://www.linuxquestions.org/quest...es-4175506598/
https://www.linuxquestions.org/quest...es-4175560562/
https://www.linuxquestions.org/quest...ic-4175673370/

As you've been asked before, is there some point at which you're going to be able to take what you've been told before and apply it?? You seem to continue to post questions that are just SLIGHTLY different than the ones you posted before. Rather than asking for another handout and someone to tell you what to do, why can't you learn from what you've been told and draw upon your experience and do something for yourself? You could have easily tried separate rules and found out what worked, in less time than it took you to post this question here, and on the other forums where you've posted.

Did you read or think about the *VERY PLAIN* message you got? You claim to have read the man page and documentation; hard to believe since it covers how to specify multiple address and how to do it, and what caveats apply. You need separate rules, and you *AGAIN* omit relevant details about your network, what you're trying to do, etc.

Last edited by TB0ne; 07-05-2020 at 10:21 AM.
 
Old 07-06-2020, 02:32 AM   #4
postcd
Member
 
Registered: Oct 2013
Posts: 527

Original Poster
Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by tinfoil3d View Post
handle on a software level
Thanks to Your comment i have got the idea. Actualy i do not necessarily need both commands to be active at same time (though i would prefer it for simplicity). I can setup a bash script for monitoring log output to detect when i need one rule and when another - it will be decided upon this script monitoring the logs which records my interactions with the server.
Maybe this explanation helps someone wanting to achieve similar thing.
 
Old 07-06-2020, 07:03 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by postcd View Post
Thanks to Your comment i have got the idea.
You should, because its been suggested to you about a dozen times over the past six years.
Quote:
Actualy i do not necessarily need both commands to be active at same time (though i would prefer it for simplicity). I can setup a bash script for monitoring log output to detect when i need one rule and when another - it will be decided upon this script monitoring the logs which records my interactions with the server. Maybe this explanation helps someone wanting to achieve similar thing.
To break this thread down:
  • You ask for something that has a clear error message that tells you what's wrong
  • You claim to have read the documentation; if you did, you'd have seen WHAT was wrong and how to fix it
  • You've asked about iptables/firewalls/load-balancers for YEARS at this point
  • Then you say you don't need it and are going to do it through a bash script
The error was clear when you first posted, and you've been asking about iptables, load balancers, and scripts for YEARS. Since you're going to do it with a script, how about posting it so it can 'help someone wanting to achieve similar thing'???

And you asked something almost identical in April: https://www.linuxquestions.org/quest...ic-4175673370/

So what was the point of this thread?

Last edited by TB0ne; 07-06-2020 at 07:40 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Destination IPs with iptables bschulte Linux - Networking 1 09-09-2011 05:08 AM
I'm lost in IPTABLES PREROUTING, forwarding to another destination port range lithos Linux - Networking 4 08-19-2011 05:01 AM
-A PREROUTING -i eth2 -p tcp --dport 80 -j DNAT --to-destination 10.1.1.200:80 GSMD Linux - Networking 5 05-04-2007 09:26 AM
how to define a specific range of IPs and/or multiple IPs in an iptables rule?... TheHellsMaster Linux - Security 9 09-20-2004 10:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration