All of lore.kernel.org
 help / color / mirror / Atom feed
* [LARTC] Changing default route for an entire subnet/NIC
@ 2003-12-18  5:34 brian
  2003-12-18  7:03 ` Brian Weaver
  2003-12-18 22:54 ` Martin A. Brown
  0 siblings, 2 replies; 3+ messages in thread
From: brian @ 2003-12-18  5:34 UTC (permalink / raw)
  To: lartc

Greetings,

If you look at Section 4.1 of the howto, they give  asimple example of changing the default
route for a single IP address by doing the following

# echo 200 John >> /etc/iproute2/rt_tables
# ip rule add from 10.0.0.10 table John
# ip route add default via 195.96.98.253 dev ppp2 table John
# ip route flush cache

I'm trying to do something very similar, except that I want to route an entire class C subnet
out a different NIC card in my firewall..

I did the exact same thing as above except used the line

ip rule add from 192.168.0.1/24 table John
ip route add default via 192.168.1.1 dev eth4 table John

This doesn't work, what happens is that the entire subnet loses conect with the firewall, so DNS
lookups fail and I basically can't go anywhere. Using just one IP like the example above seems
to work fine..

Any ideas?

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

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

* Re: [LARTC] Changing default route for an entire subnet/NIC
  2003-12-18  5:34 [LARTC] Changing default route for an entire subnet/NIC brian
@ 2003-12-18  7:03 ` Brian Weaver
  2003-12-18 22:54 ` Martin A. Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Weaver @ 2003-12-18  7:03 UTC (permalink / raw)
  To: lartc

Oops, made a mistake in my example,
I actually enter
ip rule add from 192.168.0.0/24 table John

As soon as I do this, that subnet loses all contact with my firewall, so it can't DHCP an address,
do DNS servers, ping, anything.. 

Any clues?


brian@fcu.com <brian@fcu.com> [2003-12-17 22:34:14 -0700]:
> Greetings,
> 
> If you look at Section 4.1 of the howto, they give  asimple example of changing the default
> route for a single IP address by doing the following
> 
> # echo 200 John >> /etc/iproute2/rt_tables
> # ip rule add from 10.0.0.10 table John
> # ip route add default via 195.96.98.253 dev ppp2 table John
> # ip route flush cache
> 
> I'm trying to do something very similar, except that I want to route an entire class C subnet
> out a different NIC card in my firewall..
> 
> I did the exact same thing as above except used the line
> 
> ip rule add from 192.168.0.1/24 table John
> ip route add default via 192.168.1.1 dev eth4 table John
> 
> This doesn't work, what happens is that the entire subnet loses conect with the firewall, so DNS
> lookups fail and I basically can't go anywhere. Using just one IP like the example above seems
> to work fine..
> 
> Any ideas?
> 
> _______________________________________________
> LARTC mailing list / LARTC@mailman.ds9a.nl
> http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

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

* Re: [LARTC] Changing default route for an entire subnet/NIC
  2003-12-18  5:34 [LARTC] Changing default route for an entire subnet/NIC brian
  2003-12-18  7:03 ` Brian Weaver
@ 2003-12-18 22:54 ` Martin A. Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Martin A. Brown @ 2003-12-18 22:54 UTC (permalink / raw)
  To: lartc


Brian,

 : Oops, made a mistake in my example,
 : I actually enter
 : ip rule add from 192.168.0.0/24 table John
 :
 : As soon as I do this, that subnet loses all contact with my firewall,
 : so it can't DHCP an address, do DNS servers, ping, anything..

Perhaps what you wish to do is copy the entire main routing table to the
table "John" [0] and then change the default route in that table.

Try:

   # copy_routing_table John
   # ip route change table John default via $OTHER_GATEWAY

This is a simple application of policy routing.  Another possibility is to
exclude 192.168.0.0/24 from the rule itself:

   # ip rule add from 192.168.0.0/24 table John
   # ip rule add from 192.168.0.0/24 to 192.168.0.0/24 table main

You may wish to consider adding the prio keyword explicitly.  See also
some documents I have written in which I attempt to explain the policy
routing system in plain terms [1].

Good luck,

-Martin

  [0] http://linux-ip.net/html/scripts/copy-routing-table.sh
  [1] http://linux-ip.net/html/ch-routing.html

-- 
Martin A. Brown --- SecurePipe, Inc. --- mabrown@securepipe.com

_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

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

end of thread, other threads:[~2003-12-18 22:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-18  5:34 [LARTC] Changing default route for an entire subnet/NIC brian
2003-12-18  7:03 ` Brian Weaver
2003-12-18 22:54 ` Martin A. Brown

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.