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-07-2012, 07:21 AM   #1
mbgd
LQ Newbie
 
Registered: Sep 2012
Posts: 2

Rep: Reputation: Disabled
Iptables, multiple IPs and routing


Hello,

I need help setting up routing using iptables :

I have a set of 5 external IP addresses, eg. 99.99.99.1 - 99.99.99.5
I have set up eth0 :

eth0 -> 99.99.99.1
eth0:1 -> 99.99.99.2
eth0:2 -> 99.99.99.3
eth0:3 -> 99.99.99.4
eth0:4 -> 99.99.99.5

I wish to set up routing so if someone connects to 99.99.99.2, all the packets are routed through this IP instead of the main one 99.99.99.1.

Is this possible ?
 
Old 09-08-2012, 01:36 AM   #2
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 875

Rep: Reputation: 282Reputation: 282Reputation: 282
All the IP's are on the same physical interface therefore what your asking is not possible.

The IP's are not so much routed through the first IP as much as they all share the same physical device thus there is no distinction between them.

Now the question you didn't ask but you probably want answered is this :-
How do I see how much traffic each IP gets?

This can be done with iptables simply create a new chain that does nothing and then on the INPUT chain you can create a rule that matches any packet for IP(1) and jump it to that new chain, do this for each IP(x) address and you now have a crude counter.

The effect of the empty chain is nothing as it will default to ACCEPT but it does allow you to add further rules later if you need to protect things, while maintaining the same basic packet counts.
 
Old 09-15-2012, 05:52 AM   #3
mbgd
LQ Newbie
 
Registered: Sep 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by wildwizard View Post
All the IP's are on the same physical interface therefore what your asking is not possible.

The IP's are not so much routed through the first IP as much as they all share the same physical device thus there is no distinction between them.

Now the question you didn't ask but you probably want answered is this :-
How do I see how much traffic each IP gets?

This can be done with iptables simply create a new chain that does nothing and then on the INPUT chain you can create a rule that matches any packet for IP(1) and jump it to that new chain, do this for each IP(x) address and you now have a crude counter.

The effect of the empty chain is nothing as it will default to ACCEPT but it does allow you to add further rules later if you need to protect things, while maintaining the same basic packet counts.

What would be the easiest way to create virtual physical interfaces ? VMWare Workstation for linux ?
 
  


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
Multiple ips/gateways one NIC - Routing gsaminath Linux - Newbie 4 05-27-2009 02:28 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
routing multiple ips - help me! linuxxed Linux - Networking 1 02-13-2004 07:31 AM
IPtables and multiple IPs irclord Linux - Networking 3 09-03-2003 09:18 PM

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

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