LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-16-2015, 10:31 AM   #1
opencag
LQ Newbie
 
Registered: Nov 2014
Posts: 27

Rep: Reputation: Disabled
iptables + postfix = random 5 IPS


I need to randomize 5 ips for iptables..

code:
Code:
iptables -t nat -I POSTROUTING -m state --state NEW -p tcp --dport 25 -o eth0 -m statistic --mode nth --every 5 --packet 1 -j SNAT --to-source 179x.x.238
iptables -t nat -I POSTROUTING -m state --state NEW -p tcp --dport 25 -o eth0 -m statistic --mode nth --every 5 --packet 2 -j SNAT --to-source 179x.x.239
iptables -t nat -I POSTROUTING -m state --state NEW -p tcp --dport 25 -o eth0 -m statistic --mode nth --every 5 --packet 3 -j SNAT --to-source 179x.x.240
iptables -t nat -I POSTROUTING -m state --state NEW -p tcp --dport 25 -o eth0 -m statistic --mode nth --every 5 --packet 4 -j SNAT --to-source 179x.x.241
iptables -t nat -I POSTROUTING -m state --state NEW -p tcp --dport 25 -o eth0 -m statistic --mode nth --every 5 --packet 5 -j SNAT --to-source 179x.x.242
The problem is that only randomizes the first 5 requests.

After sending the first 5 requests, he repeats the primary IP interface.
 
Old 07-16-2015, 02:39 PM   #2
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
This may be a dumb question but why do you need to randomize the source ip address?
 
Old 07-16-2015, 06:48 PM   #3
opencag
LQ Newbie
 
Registered: Nov 2014
Posts: 27

Original Poster
Rep: Reputation: Disabled
GMAIL , YAHOO reject IPS with many hits.

We send a lot of emails . We have 100 e- mail accounts.

I need to randomize the output via iptables.
 
Old 07-17-2015, 11:42 AM   #4
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
So you don't send email direct you go though Gmail and Yahoo to do this? Why not setup your own SMTP server and to this all yourself?
 
Old 07-18-2015, 03:37 PM   #5
opencag
LQ Newbie
 
Registered: Nov 2014
Posts: 27

Original Poster
Rep: Reputation: Disabled
Is rule is for my SMTP server.
 
Old 07-19-2015, 01:07 AM   #6
lazydog
Senior Member
 
Registered: Dec 2003
Location: The Key Stone State
Distribution: CentOS Sabayon and now Gentoo
Posts: 1,249
Blog Entries: 3

Rep: Reputation: 194Reputation: 194
Try this;

Code:
iptables -t nat -A POSTROUTING -p tcp -o eth0 --dport 25 -m state --state NEW -j SNAT --to-source 179.x.x.238-179.x.x.242
 
Old 07-19-2015, 01:16 AM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
Quote:
Originally Posted by opencag View Post
GMAIL , YAHOO reject IPS with many hits.

We send a lot of emails . We have 100 e- mail accounts.

I need to randomize the output via iptables.
This sounds like you are trying to circumvent gmail and yahoo spam blocking rules.

To be clear, are you sending to your own users accounts on gmail and yahoo, or to others which do not recognize the from address?
Are the 100 email accounts you mention the from address accounts or just 100 random gmail and yahoo recipients?
 
Old 07-19-2015, 02:04 PM   #8
opencag
LQ Newbie
 
Registered: Nov 2014
Posts: 27

Original Poster
Rep: Reputation: Disabled
I have 100 accounts in my business.

These 100 accounts send to gmail , hotmail and yahoo.

required randomize the IP Shipping by iptables.
 
Old 07-19-2015, 03:10 PM   #9
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
To ask again...

Quote:
To be clear, are you sending to your own users accounts on gmail and yahoo, or to others which do not recognize the from address?
Can you tell us the approximate rate at which emails are being sent as well.

If your 100 users are communicating with various gmail, yahoo and hotmail users there should really be no rate problem and maybe your problem is not rate related.

On the other hand, if your 100 accounts are not real users and are sending large volumes of unsolicited email to yahoo, gmail and hotmail, that constitutes a different problem.

Which is it?
 
Old 07-19-2015, 04:04 PM   #10
opencag
LQ Newbie
 
Registered: Nov 2014
Posts: 27

Original Poster
Rep: Reputation: Disabled
Medium send 500 emails per hour for gmail/hotmail.
 
  


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
iptables blocking all ips except US & US Amazon. Can't log dropped IPs. mcginlej Linux - Networking 3 10-08-2013 12:18 PM
postfix with multiple virtual hosts and IPs babak83 Linux - Server 3 08-26-2009 01:39 PM
Virtual IPs and Postfix SMTP msound Linux - Server 7 10-30-2008 02:22 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
Ping Random IPs using a tcsh script.. zeppelin Programming 7 08-07-2003 11:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:33 AM.

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