Linux Netfilter discussions
 help / color / mirror / Atom feed
* Route packets from an interface to another
@ 2005-09-09 19:15 Jonathan
  2005-09-09 20:22 ` Edmundo Carmona
  0 siblings, 1 reply; 18+ messages in thread
From: Jonathan @ 2005-09-09 19:15 UTC (permalink / raw)
  To: netfilter

Hello,
I have the following interface configuration on two boxes:
box1: eth0:5 192.121.234.213 netmask 255.255.255.240 broadcast
192.121.234.223
box2: lo:0 192.121.234.213 netmask 255.255.255.255
between box1 and box2 I have a OpenVPN tunnel (endpoints 10.1.0.1 and
10.1.0.2).

I want to forward all packages on box1 with destination 192.121.234.213 to
tun0 (10.1.0.1), so they pass through the tunnel and comes to box2. I also
want to forward all packages from tun0 (10.1.0.1) to eth0:5
(192.121.234.213). How do I do this with iptables?

Regards
Jonathan



^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: Route packets from an interface to another
@ 2005-09-09 19:51 Jonathan
  2005-09-09 21:36 ` /dev/rob0
  0 siblings, 1 reply; 18+ messages in thread
From: Jonathan @ 2005-09-09 19:51 UTC (permalink / raw)
  To: netfilter

I think so. On box1 I type these commands:
# ifconfig eth0:5 192.121.234.213 netmask 255.255.255.240 broadcast
192.121.234.223
# ip route add 192.121.234.213 via 10.1.0.2 (10.1.0.2 is the tunnel's
endpoint on box2)

on box1:
# ifconfig lo:0 192.121.234.213 netmask 255.255.255.255
# ip rule add from 192.121.234.213 lookup 10
# ip route add default via 10.1.0.1 table 10

and when I ssh 192.121.234.213 from box1, I come to box2.

I have also noticed that 192.121.234.213 exists in the kernel routing
table on box1, so I deleted it and when I then ssh 192.121.234.213 from
the outside I get the error "no route to host".

So the routing seems to be correct, right?
And why I set up the tunneled address on lo is because a guy told me to do
that. ;-)

> Well.. routing in this case is not single point problem.... but both
points have to route correctly to make it "happen". You sure the other
machine is routing through the VPN tunnel when replying?
>
> On 9/9/05, Jonathan <phonic@antisocial.nu> wrote:
>> I have already set up routes exactly like that one. :-)
>>
>> The purpose is that I want to have a static IP on my home box. I have a
/28 addressed on a box so I thought I could tunnel one of these
addresses
>> to my box home.
>>
>> And the problem; when I ping/ssh/whatever 192.121.234.213 from the /28-box
>> (box1), the traffic goes through 10.1.0.1 to 10.1.0.2 and reaches my home
>> box. But when I ping/ssh/whatever from outside the traffic goes to
box1. That's why I think NATing the connections will solve the problem.
But maybe I'm wrong?
>>
>> > IPTABLES? I think it's a routing problem, not a firewall one.
>> >
>> > ip route add 192.121.234.213 via 10.1.0.2
>> > I think that would do the first part of your problem.
>> >
>> > But why do you have an IP address (not 127/8) set on a loopback
>> interface?
>> >
>> > On 9/9/05, Jonathan <phonic@antisocial.nu> wrote:
>> >> Hello,
>> >> I have the following interface configuration on two boxes:
>> >> box1: eth0:5 192.121.234.213 netmask 255.255.255.240 broadcast
192.121.234.223
>> >> box2: lo:0 192.121.234.213 netmask 255.255.255.255
>> >> between box1 and box2 I have a OpenVPN tunnel (endpoints 10.1.0.1
and 10.1.0.2).
>> >>
>> >> I want to forward all packages on box1 with destination
>> 192.121.234.213
>> >> to
>> >> tun0 (10.1.0.1), so theWy pass through the tunnel and comes to box2.
>> I
>> >> also
>> >> want to forward all packages from tun0 (10.1.0.1) to eth0:5
>> >> (192.121.234.213). How do I do this with iptables?
>> >>
>> >> Regards
>> >> Jonathan
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>>
>>
>






^ permalink raw reply	[flat|nested] 18+ messages in thread
* Route packets from an interface to another
@ 2007-09-10 12:18 vinod K D
  2007-09-10 15:23 ` Grant Taylor
  0 siblings, 1 reply; 18+ messages in thread
From: vinod K D @ 2007-09-10 12:18 UTC (permalink / raw)
  To: NetfilterList

First of all, I'll explain my network setup.
 
 My gateway has two network interfaces: eth0 & eth1. 
 
 eth0 (192.168.1.1) is connected to public network and
eth1(10.0.1.1) is connected to LAN.
 
 MyServer, which is in the LAN, has ip 10.0.1.2.
 
 I created a virtual interface eth0:0 (192.168.1.2) in
the gateway.
 Using ipvsadm, I can route the packets, destined for
this IP address and a port,  to myServer.
 
 And in myServer, I enabled ip_forwarding and assigned
192.168.1.2 for the loopback interface. 
 So my server application receives and serves the
packets properly. 
 
 The problem is in the return path. (Remember the
packets have source addres 192.168.1.2). While they
reach the gateway, the packets are being dropped. 
 
 (I think, the reason is nothing but the address
192.168.1.2 is assigned to the gateway. Hence router
assumes the packets are traversing though a loop.)
 
 I can't use masquerading, because I need to get the
source & destination IPs of the packets.
 
 Can anyone suggest a way to redirect packets from an
interface to another (ie, eth1 to eth0) without making
any change in the packet header.
 
 PS: The latest versions of netfilter doen't have
inbuilt ipt_ROUTE module. Else my life would be cool.
 
 Thanks,
 Vinod


       
____________________________________________________________________________________
Sick sense of humor? Visit Yahoo! TV's 
Comedy with an Edge to see what's on, when. 
http://tv.yahoo.com/collections/222


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

end of thread, other threads:[~2007-09-10 15:23 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-09 19:15 Route packets from an interface to another Jonathan
2005-09-09 20:22 ` Edmundo Carmona
2005-09-09 19:32   ` Jonathan
     [not found]     ` <65aa6af905090913353e0d0150@mail.gmail.com>
2005-09-09 20:35       ` Edmundo Carmona
     [not found]       ` <1224.83.227.26.235.1126295454.squirrel@webmail.2lug.se>
2005-09-09 21:03         ` Edmundo Carmona
  -- strict thread matches above, loose matches on Subject: below --
2005-09-09 19:51 Jonathan
2005-09-09 21:36 ` /dev/rob0
2005-09-09 21:18   ` Jonathan
2005-09-10  4:45     ` /dev/rob0
2005-09-10  7:54       ` /dev/rob0
2005-09-12  7:56         ` Jonathan
2005-09-13  1:45           ` /dev/rob0
2005-09-12 13:36       ` Rudi Starcevic
2005-09-11 21:34         ` /dev/rob0
2005-09-12 14:47           ` Rudi Starcevic
2005-09-12 14:51           ` Rudi Starcevic
2007-09-10 12:18 vinod K D
2007-09-10 15:23 ` Grant Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox