******************************************************************************
  Minix have routing incorporated into the inet code. This are some tips to
     know if you like to have ethernet and PPP routing in your Minix box.

            Thanks to Philip Homburg about commenting the issues.

******************************************************************************


In your letter dated Wed, 15 Sep 1999 11:02:20 -0300 you wrote:
>Hello:
>I receive an answer from Kees about the possible routing code into
>minix. He suggested to contact you if you can send me some example to
>test and use with ppp/slip/plip. I do not know if the possibility is in
>both 16 and 32 bits code.

Kees told me that he used the same inet sources for both the 16 and the 32
bit version of Minix.

You can manually add routes that are to be used to route packets from one
interface to another, with "add_route -i" ("i" for input, the other `normal'
routes are called output routes)

For example, assume a machine with ip address 192.31.231.250 and netmask
255.255.255.0 on /dev/ip0

The command,
add_route -i -g 0.0.0.0 -d 192.31.231.0 -m 1 -n 255.255.255.0 -I /dev/ip0
adds a route to the directly attached ethernet. A packet for 192.31.231.1
that arrives at interface ip2 will be routed to ip0 and ARP will
be used to find the ethernet address associated with 192.31.231.1.

It is also possible to specify a remote router. For example,
add_route -i -g 192.31.231.174 -d 192.35.191.0 -m 2 -n 255.255.255.0 -I /dev/ip0
adds a route to network 192.35.191.0 through router 192.31.231.174.

A third option is to add a default route. For example,
add_route -i -g 192.31.231.1 -d 0.0.0.0 -m 5 -n 0.0.0.0 -I /dev/ip0

The "pr_routes -i" command shows the input routing table:
ent #            dest         netmask         gateway dist pref flags
    2    192.35.191.0   255.255.255.0  192.31.231.174    2    0 static
    3    192.31.231.0   255.255.255.0         0.0.0.0    1    0 static
    4         0.0.0.0         0.0.0.0    192.31.231.1    5    0 static

We also need a routing entry for the PPP interface. For example,
add_route -i -g 0.0.0.0 -d 10.0.0.0 -m 1 -n 255.0.0.0 -I/dev/ip2

The "pr_routes -ai" shows the routing table entries for all interfaces:
ent #            dest         netmask         gateway dist pref flags
                   if
    2    192.35.191.0   255.255.255.0  192.31.231.174    2    0 static
       192.31.231.250
    3    192.31.231.0   255.255.255.0         0.0.0.0    1    0 static
       192.31.231.250
    4         0.0.0.0         0.0.0.0    192.31.231.1    5    0 static
       192.31.231.250
    5        10.0.0.0       255.0.0.0         0.0.0.0    1    0 static
             10.0.0.1


Note that the "add_route -i" command only affects the routing of packets
at arrive over a network (PPP or ethernet). Packets that are sent by processes
are routed using the normal, output routing table.

Unfortunately, Kees forgot to include the del_route program, so you won't
be able to delete any routes. Don't forget to tell other machines/routers
about the Minix machine. Normally, the routing daemon (rip) broadcasts this
information.




				Philip Homburg
