Google Gruplar, artık yeni Usenet gönderilerini veya aboneliklerini desteklememektedir. Geçmişteki içerikler görüntülenebilir kalmaya devam edecek.

Advanced Linux Route/Loopback Problem

76 görüntüleme
İlk okunmamış mesaja atla

David C Wang

okunmadı,
18 Ara 2002 15:41:3318.12.2002
alıcı
Hi,

I've been researching this all day, with no luck. Hopefully someone
can help me out.

It seems that linux is ignoring the routing table for local network
devices, and forcing the route through the loopback device. Is there
any way to get around this?

Here's a description of the problem. On the same computer, I have
interfaces eth1 (192.168.0.11) and eth2 (192.168.0.12). I want to
ping from eth1 to eth2, and make the packet physically hit the wire,
instead of going through the loopback netdevice.

I enable ip_forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward
I clear the kernel routing cache
echo "1" > /proc/sys/net/ipv4/route/flush

Then, I modify my routing tables to say that packets going to
192.168.0.11 (eth1) should exit through the eth2 netdevice, and vice
versa:

dave:/home/dave# route add -host 192.168.0.12 dev eth1
dave:/home/dave# route add -host 192.168.0.11 dev eth2
dave:/home/dave# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.11 0.0.0.0 255.255.255.255 UH 0 0 0 eth2
192.168.0.12 0.0.0.0 255.255.255.255 UH 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
10.1.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 10.1.1.254 0.0.0.0 UG 0 0 0 eth0

Then I ping 192.168.0.11, which should get routed through the second
netdevice eth2, but the packet still goes through the loopback
netdevice, instead of directly out the physical device.

dave:/home/dave# ping -c 1 192.168.0.11
PING 192.168.0.11 (192.168.0.11): 56 data bytes
64 bytes from 192.168.0.11: icmp_seq=0 ttl=64 time=0.0 ms
--- 192.168.0.11 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.0/0.0/0.0 ms

To verify, I check the Kernel Routing Cache, which indeed shows that
pings to 192.68.0.11 will go through the loopback device.

dave:/home/dave# route -nC|grep -v 10
Kernel IP routing cache
Source Destination Gateway Flags Metric Ref Use Iface
192.168.0.12 192.168.0.12 192.168.0.12 l 0 0 0 lo
192.168.0.12 192.168.0.12 192.168.0.12 l 0 0 0 lo
192.168.0.11 192.168.0.11 192.168.0.11 l 0 0 1 lo
192.168.0.11 192.168.0.11 192.168.0.11 l 0 0 1 lo

I try again by modifying the routing tables to include a gateway for
each device. But I get the same result, and the same output from the
kernel routing cache.

da:/home/dave# route add -host 192.168.0.12 gw 192.168.0.11 dev eth1
da:/home/dave# route add -host 192.168.0.11 gw 192.168.0.12 dev eth2
dave:/home/dave# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.11 192.168.0.12 255.255.255.255 UGH 0 0 0 eth2
192.168.0.12 192.168.0.11 255.255.255.255 UGH 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
10.1.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 10.1.1.254 0.0.0.0 UG 0 0 0 eth0

It seems that linux is ignoring the routing table for local network
devices, and forcing the route through the loopback device. Is there
any way to get around this?

thanks,
-dave
dcwangmit01 at yahoo dot c*m

Christian Gorecki

okunmadı,
18 Ara 2002 15:49:3018.12.2002
alıcı
On Wed, 18 Dec 2002 21:41:33 +0100, David C Wang wrote:

<snip description>

> Destination Gateway Genmask Flags Metric Ref Use Iface
> 192.168.0.11 192.168.0.12 255.255.255.255 UGH 0 0 0 eth2
> 192.168.0.12 192.168.0.11 255.255.255.255 UGH 0 0 0 eth1
> 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
> 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
> 10.1.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
> 0.0.0.0 10.1.1.254 0.0.0.0 UG 0 0 0 eth0
>
> It seems that linux is ignoring the routing table for local network
> devices, and forcing the route through the loopback device. Is there
> any way to get around this?

i think so, just delete the two rules with destination 192.168.0.0 before
adding your two new rulez.
seems to make sence, doesn't it?
ciao
christian

Timothy Murphy

okunmadı,
18 Ara 2002 18:29:1818.12.2002
alıcı
dcwan...@yahoo.com (David C Wang) writes:

>Here's a description of the problem. On the same computer, I have
>interfaces eth1 (192.168.0.11) and eth2 (192.168.0.12).

Why don't you have eth1 on 192.168.0.*
and eth2 on 192.168.1.*
as most people would?


--
Timothy Murphy
e-mail: t...@maths.tcd.ie
tel: 086-233 6090
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland

David C Wang

okunmadı,
19 Ara 2002 03:21:3819.12.2002
alıcı
Cristian,

I've tried deleting those rules, and it still doesn't work. It
shouldn't matter anyway, because the rules up top should match first.

-dave
dcwangmit01 at yahoo dot c*m


Christian Gorecki <christia...@post.rwth-aachen.de> wrote in message news:<atqmvk$g0$1...@newsread1.arcor-online.net>...

David C Wang

okunmadı,
19 Ara 2002 03:25:3319.12.2002
alıcı
t...@maths.tcd.ie (Timothy Murphy) wrote in message news:<atr0ce$270m$1...@boole.maths.tcd.ie>...

> dcwan...@yahoo.com (David C Wang) writes:
>
> >Here's a description of the problem. On the same computer, I have
> >interfaces eth1 (192.168.0.11) and eth2 (192.168.0.12).
>
> Why don't you have eth1 on 192.168.0.*
> and eth2 on 192.168.1.*
> as most people would?

Well, I'd like to have them both on the same subnet.

But... Even if i did have them on separate subnets, if i tried to
ping eth1 interface via eth2, linux still will not look at the routing
table. it will instead directly ping eth1 through the loopback
device. I could setup a separate gateway/router not on the local
machine, but I'm trying to avoid that.

0 yeni ileti