We have a router with two external and one internal interfaces and it doesn''t work as we''d like to. We need it to route all the trafic through one of the external interfaces and to access a few networks through the other. Currently it seems that all the packets with source address from the inernal network are routed correctly. The problem is with the packets that originate from the router. For some reason they are routed through the default interface. Does anybody know why does that happen? # ip rule ls 0: from all lookup local 200: from 192.168.1.0/24 to a.b.c.0/24 lookup 202 201: from e.f.g.0/24 lookup 201 201: from 192.168.1.0/24 to 62.44.96.0/19 lookup 201 201: from 127.0.0.0/8 to 62.44.96.0 lookup 201 202: from a.b.c.0/24 lookup 202 32766: from all lookup main 32767: from all lookup default # ip route ls e.f.g.0/24 dev eth3 scope link metric 1 a.b.c.0/24 dev eth2 scope link 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.1 127.0.0.0/8 dev lo scope link default via a.b.c.1 dev eth2 ip route ls table 201 default via e.f.g.1 dev eth3 proto static src e.f.g.52 realm 201 prohibit default proto static metric 1 ip route ls table 202 default via a.b.c.1 dev eth2 proto static src a.b.c.4 realm 202 prohibit default proto static metric 1 Your help is appreciated. -- Камен
Kamen TOMOV wrote:> We have a router with two external and one internal interfaces and it > doesn''t work as we''d like to. We need it to route all the trafic > through one of the external interfaces and to access a few networks > through the other. > > Currently it seems that all the packets with source address from the > inernal network are routed correctly. The problem is with the packets > that originate from the router. For some reason they are routed > through the default interface. Does anybody know why does that happen? > > # ip rule ls > 0: from all lookup local > 200: from 192.168.1.0/24 to a.b.c.0/24 lookup 202 > 201: from e.f.g.0/24 lookup 201 > 201: from 192.168.1.0/24 to 62.44.96.0/19 lookup 201 > 201: from 127.0.0.0/8 to 62.44.96.0 lookup 201 > 202: from a.b.c.0/24 lookup 202 > 32766: from all lookup main > 32767: from all lookup default > > # ip route ls > e.f.g.0/24 dev eth3 scope link metric 1 > a.b.c.0/24 dev eth2 scope link > 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.1 > 127.0.0.0/8 dev lo scope link > default via a.b.c.1 dev eth2 > > ip route ls table 201 > default via e.f.g.1 dev eth3 proto static src e.f.g.52 realm 201 > prohibit default proto static metric 1 > > ip route ls table 202 > default via a.b.c.1 dev eth2 proto static src a.b.c.4 realm 202 > prohibit default proto static metric 1 > > Your help is appreciated. > >Because locally originated packets use IP addres of the external interface looking only main table To resolve this you need to apply rules for external interfaces of the router
Kamen TOMOV wrote:> We have a router with two external and one internal interfaces and it > doesn''t work as we''d like to. We need it to route all the trafic > through one of the external interfaces and to access a few networks > through the other. > > Currently it seems that all the packets with source address from the > inernal network are routed correctly. The problem is with the packets > that originate from the router. For some reason they are routed > through the default interface. Does anybody know why does that happen? > > # ip rule ls > 0: from all lookup local > 200: from 192.168.1.0/24 to a.b.c.0/24 lookup 202 > 201: from e.f.g.0/24 lookup 201 > 201: from 192.168.1.0/24 to 62.44.96.0/19 lookup 201 > 201: from 127.0.0.0/8 to 62.44.96.0 lookup 201 > 202: from a.b.c.0/24 lookup 202 > 32766: from all lookup main > 32767: from all lookup default > > # ip route ls > e.f.g.0/24 dev eth3 scope link metric 1 > a.b.c.0/24 dev eth2 scope link > 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.1 > 127.0.0.0/8 dev lo scope link > default via a.b.c.1 dev eth2 > > ip route ls table 201 > default via e.f.g.1 dev eth3 proto static src e.f.g.52 realm 201 > prohibit default proto static metric 1 > > ip route ls table 202 > default via a.b.c.1 dev eth2 proto static src a.b.c.4 realm 202 > prohibit default proto static metric 1 > > Your help is appreciated. > >A little correction for my previos post local packets look in Local table not main ip r ls table 0