LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-04-2013, 07:30 PM   #1
i5050net
LQ Newbie
 
Registered: Aug 2013
Posts: 1

Rep: Reputation: Disabled
iptables / ipset, redirect a set to another host/ip?


Hi everyone,

I'm looking for some help with iptables and ipset.

I'd like to use iptables & ipset to redirect all "non-good" IPs to another server.

I have a set of "Good" IPs that will have access to the server (1.1.1.1), on port 80.

Any IP not in the "Good" set should be redirected to 2.2.2.2 on port 80.

Thanks in advance.

Last edited by i5050net; 09-04-2013 at 11:30 PM.
 
Old 09-16-2013, 01:06 PM   #2
dkm999
Member
 
Registered: Nov 2006
Location: Seattle, WA
Distribution: Fedora
Posts: 407

Rep: Reputation: 35
Without going into excruciating detail (and doing all the work myself), there are three things you will need to do:
1. Define the "good" and "bad" sets of IP source addresses (using ipset)
2. Create an iptables rule (in the FILTER table) that forwards the "good" packets to their server (presumably your DNS has supplied the correct address for this server already).
3. Create an iptables rule (in the NAT table) that changes the destination address for "bad" packets.

So long as both servers have public IP addresses, this should take care of separating the traffic and directing it to the appropriate server.
 
  


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
block ping from host to host using iptables (I am the wireless access point) tris_halo Linux - Security 1 07-14-2013 11:43 AM
how to set any ports on iptables for one specific host only? remy06 Linux - Networking 1 02-16-2011 03:13 AM
Lipipq(iptables) . How do I redirect captured packet to another address with iptables inet905 Programming 0 05-25-2010 01:20 AM
[SOLVED] iptables redirect : local to remote public host paziulek Linux - Networking 2 05-17-2010 02:34 PM
Redirect to host through proxy Padawan.AVT Linux - Server 0 11-06-2007 05:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:32 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