old-www/HOWTO/Adv-Routing-HOWTO/lartc.rpdb.html

214 lines
3.6 KiB
HTML

<HTML
><HEAD
><TITLE
>Rules - routing policy database</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Linux Advanced Routing &#38; Traffic Control HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="ARP"
HREF="lartc.iproute2.arp.html"><LINK
REL="NEXT"
TITLE="Simple source policy routing"
HREF="lartc.rpdb.simple.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Linux Advanced Routing &#38; Traffic Control HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="lartc.iproute2.arp.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="lartc.rpdb.simple.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="LARTC.RPDB"
></A
>Chapter 4. Rules - routing policy database</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
>4.1. <A
HREF="lartc.rpdb.simple.html"
>Simple source policy routing</A
></DT
><DT
>4.2. <A
HREF="lartc.rpdb.multiple-links.html"
>Routing for multiple uplinks/providers</A
></DT
><DD
><DL
><DT
>4.2.1. <A
HREF="lartc.rpdb.multiple-links.html#AEN258"
>Split access</A
></DT
><DT
>4.2.2. <A
HREF="lartc.rpdb.multiple-links.html#AEN284"
>Load balancing</A
></DT
></DL
></DD
></DL
></DIV
><P
>If you have a large router, you may well cater for the needs of different
people, who should be served differently. The routing policy database allows
you to do this by having multiple sets of routing tables. </P
><P
>If you want to use this feature, make sure that your kernel is compiled with
the "IP: advanced router" and "IP: policy routing" features.</P
><P
>When the kernel needs to make a routing decision, it finds out which table
needs to be consulted. By default, there are three tables. The old 'route'
tool modifies the main and local tables, as does the ip tool (by default).</P
><P
>The default rules:</P
><TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>[ahu@home ahu]$ ip rule list
0: from all lookup local
32766: from all lookup main
32767: from all lookup default</PRE
></FONT
></TD
></TR
></TABLE
><P
>This lists the priority of all rules. We see that all rules apply to all
packets ('from all'). We've seen the 'main' table before, it is output by
<TT
CLASS="USERINPUT"
><B
>ip route ls</B
></TT
>, but the 'local' and 'default' table are new.</P
><P
>If we want to do fancy things, we generate rules which point to different
tables which allow us to override system wide routing rules.</P
><P
>For the exact semantics on what the kernel does when there are more matching
rules, see Alexey's ip-cref documentation. </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="lartc.iproute2.arp.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="lartc.rpdb.simple.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>ARP</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Simple source policy routing</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>