Date: Fri, 18 Jul 2003 19:12:32 +0200 From: Josef El-Rayes <j.el-rayes@daemon.li> To: Marc Fonvieille <blackend@FreeBSD.org> Cc: freebsd-docs@FreeBSD.org Subject: Re: docs/54610: [patch] adds route(8) examples to routing chapter Message-ID: <20030718171232.GA7907@daemon.li> In-Reply-To: <20030718101101.GA551@nosferatu.blackend.org> References: <200307180951.h6I9pDOx003423@daemon.li> <20030718101101.GA551@nosferatu.blackend.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--J2SCkAp4GZ/dPZZf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Marc Fonvieille <blackend@FreeBSD.org> wrote: > I was thinking about that since a while; there's something missing in > your submission: how to "definitively" define a gateway (default > route): the rc.conf line... i added some text about defaultrouter and static_routes in /etc/rc.conf greets, josef -- www: http://www.daemon.li nic-hdl: JER1080312-NICAT FreeBSD PortMaintainer "Make World - Not War!" --J2SCkAp4GZ/dPZZf Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="chapter.sgml.diff" --- chapter.sgml.orig Thu Jul 17 23:48:58 2003 +++ chapter.sgml Fri Jul 18 19:10:28 2003 @@ -362,6 +362,66 @@ </informaltable> </sect2> +<sect2> + <title>Manually define routing tables</title> + <indexterm><primary>manually define routing tables</primary></indexterm> + <para> + In some cases it is very useful to be able to dynamically define or manipulate the routing table on the command line. + This is achieved via the &man.route.8; command. For example, if you want to set the default route to a specific ip adress, + this is done by using the add parameter of the <command>route</command> command: + </para> + + <screen> + &prompt.root;<userinput>route add default 192.168.0.1</userinput> + add net default: gateway 192.168.0.1 + </screen> + + <para> + Additional manipulation of the routing table is done via the + <command>change</command> and <command>delete</command> parameters. Use + <command>flush</command> to clear the whole routing table. + To receive specific information about how packages to a certain destination get + routed, there is the <command>get</command> parameter. + </para> + + <para> + Setting the routing table through <command>route</command> only + lasts until next reboot. To have the defaultrouter set on every + system startup automatically, define a defaultrouter in <filename>/etc/rc.conf</filename> + </para> + + <programlisting>defaultrouter="192.168.0.1"</programlisting> + + <para>This might also be achieved by using <application>sysinstall</application>.</para> + + <para> + For setting other routes than defaultrouter at startup, there is + following option in <filename>/etc/rc.conf</filename> + </para> + <programlisting>static_routes=""</programlisting> + + <para> + If you want to route traffic for subnet <hostid role="ipaddr">192.168.1.1/24</hostid> to + <hostid role="ipaddr">192.168.0.1</hostid> and all traffic for subnet + <hostid role="ipaddr">192.168.2.1/24</hostid> to <hostid role="ipaddr">192.168.0.2</hostid>, + this has to be defined in <filename>/etc/rc.conf</filename> that way + </para> + + <programlisting>static_routes="myroute myroute2"</programlisting> + <programlisting>route_myroute="192.168.1.1/24 192.168.0.1"</programlisting> + <programlisting>route_myroute2="192.168.2.1/24 192.168.0.2"</programlisting> + + <para> + On system startup <filename>/etc/rc.network</filename>parses the defined + routes and sets them by using <command>route add</command>. + </para> + + <para>To switch off all static routes by default, define</para> + <programlisting>static_routes="NO"</programlisting> + +</sect2> + + <sect2> <title>Dual Homed Hosts</title> <indexterm><primary>dual homed hosts</primary></indexterm> --J2SCkAp4GZ/dPZZf--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030718171232.GA7907>