Re: how to remove rules

Linux Advanced Routing and Traffic Control

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

 



Hello all!

 : I've had the same problem.  I sorta wish there was an "ip rule flush" 
 : command that would leave only the default rules.

I have a function called "flush" which flushes all tables and all rules 
other than the main routing table.  Here's the "rule" flush portion.  It 
won't win any points for elegance, but it should get the job done:

    ip rule show | grep -Ev '^(0|32766|32767):' \
      | while read PRIO RULE; do
      ip rule del prio ${PRIO%%:*} $( echo $RULE | sed 's|all|0/0|' )
    done

-Martin

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