All of lore.kernel.org
 help / color / mirror / Atom feed
* Force use of outgoing IP address
@ 2007-06-01 16:42 Neil Russell
  2007-06-01 17:22 ` Grant Taylor
  2007-06-01 17:24 ` John A. Sullivan III
  0 siblings, 2 replies; 3+ messages in thread
From: Neil Russell @ 2007-06-01 16:42 UTC (permalink / raw)
  To: netfilter


Hi,
 
new to all this so please be gentle with me....
 
I have a linux router with 3 network cards in, each card has multiple IP
address's assigned. I want to route all aoutbound traffic TO a
destination port of $DESTPRT out of eth0 on its IPAddress of 10.0.0.2
 
 
Example is 
 
Eth0 has IP address's of 
10.0.0.1
10.0.0.2
10.0.0.3
and connects to 10.0.0.99 (Internet router)
 
eth1 has ip address's of
192.168.0.1
192.168.0.2
192.168.0.3
 
 
and eth3 has ip address's of
192.168.1.0
192.168.1.2
192.168.1.3
 
 
So ALL traffic on the router with a destination address MUST go out on
eth0 and show its IP address as 10.0.0.2 even though the default route
is out via 10.0.0.1
 
Hope thats clear and that someone can advise.
 
 
Neil.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Force use of outgoing IP address
  2007-06-01 16:42 Force use of outgoing IP address Neil Russell
@ 2007-06-01 17:22 ` Grant Taylor
  2007-06-01 17:24 ` John A. Sullivan III
  1 sibling, 0 replies; 3+ messages in thread
From: Grant Taylor @ 2007-06-01 17:22 UTC (permalink / raw)
  To: Mail List - Netfilter

On 06/01/07 11:42, Neil Russell wrote:
> I have a linux router with 3 network cards in, each card has multiple
> IP address's assigned. I want to route all aoutbound traffic TO a
> destination port of $DESTPRT out of eth0 on its IPAddress of
> 10.0.0.2.

If you want ONLY the traffic that is destined to $DESTPRT to use the 
alternative IP, you will probably need to set up multiple routing tables 
similar in all respects except for the source IP used.  Then you can use 
  "ip rule" to decide which traffic uses the alternative routing table 
and source IP.  I.e. everything by default uses the main IP address 
while only traffic destined to $DESTPRT uses the other IP.  Is this what 
you are after?

> So ALL traffic on the router with a destination address MUST go out
> on eth0 and show its IP address as 10.0.0.2 even though the default
> route is out via 10.0.0.1

Hugh?  Are you saying you want all traffic leaving the system to have an 
IP address of 10.0.0.2 not 10.0.0.1?  If this is the case, switch the 
first and second IP address in your configuration.  I believe by default 
the system will use the primary IP address of an interface as it's 
default that it bind traffic to.  I.e. eth0 verses eth0:1 / eth0:2. 
Though I'm not sure, it may choose the lowest IP address not the first one.

> Hope thats clear and that someone can advise.

No, not really.  I'm having trouble identifying which types of traffic 
you are wanting to change both up top and down below.



Grant. . . .


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Force use of outgoing IP address
  2007-06-01 16:42 Force use of outgoing IP address Neil Russell
  2007-06-01 17:22 ` Grant Taylor
@ 2007-06-01 17:24 ` John A. Sullivan III
  1 sibling, 0 replies; 3+ messages in thread
From: John A. Sullivan III @ 2007-06-01 17:24 UTC (permalink / raw)
  To: Neil Russell; +Cc: netfilter

On Fri, 2007-06-01 at 17:42 +0100, Neil Russell wrote:
> Hi,
>  
> new to all this so please be gentle with me....
>  
> I have a linux router with 3 network cards in, each card has multiple IP
> address's assigned. I want to route all aoutbound traffic TO a
> destination port of $DESTPRT out of eth0 on its IPAddress of 10.0.0.2
>  
> 
> Example is 
>  
> Eth0 has IP address's of 
> 10.0.0.1
> 10.0.0.2
> 10.0.0.3
> and connects to 10.0.0.99 (Internet router)
>  
> eth1 has ip address's of
> 192.168.0.1
> 192.168.0.2
> 192.168.0.3
>  
> 
> and eth3 has ip address's of
> 192.168.1.0
> 192.168.1.2
> 192.168.1.3
>  
> 
> So ALL traffic on the router with a destination address MUST go out on
> eth0 and show its IP address as 10.0.0.2 even though the default route
> is out via 10.0.0.1
>  
> Hope thats clear and that someone can advise.
>  
> 
> Neil.
> 
I believe you're going to want to use iproute2 to do this.  There is a
somewhat dated slideshow on doing something very close to this (if I
recall correctly) in the training section of http://iscs.sourceforge.net
-- 
John A. Sullivan III
Open Source Development Corporation
+1 207-985-7880
jsullivan@opensourcedevel.com

Financially sustainable open source development
http://www.opensourcedevel.com



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-01 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-01 16:42 Force use of outgoing IP address Neil Russell
2007-06-01 17:22 ` Grant Taylor
2007-06-01 17:24 ` John A. Sullivan III

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.