docs/54610: [patch] adds route(8) examples to routing chapter
Josef El-Rayes
j.el-rayes at daemon.li
Fri Jul 18 17:11:26 UTC 2003
Marc Fonvieille <blackend at 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!"
-------------- next part --------------
--- 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>
More information about the freebsd-doc
mailing list