Re: Changing default route for an entire subnet/NIC

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx

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

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux