Example of routing configuration under Minix
=============================================

The following is a mini-how-to about help configuring a small routing network.
I used serial and parallel conections, I have no ethernet cards, but the
idea is similar. Thanks to Philip Homburg for answering information about 
configuring input and output routes.

My 3 machines are named: spock, deimos and phobos. I use the prompt with
the name to indicate which command is executed in which machine.

1. configure each machine, the networks and the interfaces. These are
the scripts at system startup:

spock>  ifconfig -h 10.1.1.1 -n 255.255.255.0
spock>  ifconfig -I /dev/ip3 -h 20.1.1.1 -n 255.255.255.0 

deimos> ifconfig -h 10.1.1.2 -n 255.255.255.0

phobos> ifconfig -h 20.1.1.2 -n 255.255.255.0

You can check the configuration with the ifconfig command

spock> ifconfig
10.1.1.1
255.255.255.0
spock> ifconfig -I /dev/ip3
20.1.1.1
255.255.255.0

deimos> ifconfig
10.1.1.2
255.255.255.0

phobos> ifconfig
20.1.1.2
255.255.255.0


2. I connect using a paralel cable between spock and deimos, using plip as 
protocol. plip currently uses the default network (/dev/ip and /dev/psip). 
I configured both machines to use /dev/ip2 with netdefault(8).

3. phobos is connected via serial line to spock, who connect both machines.
In this test I used slip, but ppp can be used also.

4. As phobos and deimos have no more interfaces, I configured the default
routes pointing to the spock interface IPs

deimos> add_route -g 10.1.1.1 -d 0.0.0.0 -n 0.0.0.0 -v

phobos> add_route -g 20.1.1.1 -d 0.0.0.0 -n 0.0.0.0 -v

Here are only output routes, to indicate where it need to send packets 
when you try to access a remote network.

The routes appear as:

deimos> pr_routes -ao

ent #            dest         netmask         gateway dist pref flags
                   if
    0         0.0.0.0         0.0.0.0        10.1.1.1    1    0 static
             10.1.1.2

phobos> pr_routes -ao

ent #            dest         netmask         gateway dist pref flags
                   if
    0         0.0.0.0         0.0.0.0        20.1.1.1    1    0 static
             20.1.1.2


5. At spock I configure routes like:

spock> add_route -i -g 0.0.0.0 -d 10.1.1.0 -m 1 -n 255.255.255.0 -I /dev/ip2
spock> add_route -i -g 0.0.0.0 -d 20.1.1.0 -m 1 -n 255.255.255.0 -I /dev/ip3
spock> add_route -g 10.1.1.1
spock> add_route -g 20.1.1.1 -I /dev/ip3

the first route indicates that a packet directed to network 10.1.1.0 
should be send via device /dev/ip2, the second indicates that any input
packet that arrives for network 20.1.1.0 should go via /dev/ip3. These
are input routes. The third and fourth routes add the default routes to
each interface, asociates default IPs with interfaces. Remember that I 
have the default ip device associated to /dev/ip2.

The input routes appear as:

spock> pr_routes -ai

ent #            dest         netmask         gateway dist pref flags
                   if
    0        10.1.1.0   255.255.255.0         0.0.0.0    1    0 static
             10.1.1.1
    1        20.1.1.0   255.255.255.0         0.0.0.0    1    0 static
             20.1.1.1

The output routes appear as:

spock> pr_routes -ao
ent #            dest         netmask         gateway dist pref flags
                   if
    0         0.0.0.0         0.0.0.0        10.1.1.1    1    0 static
             10.1.1.1
    1         0.0.0.0         0.0.0.0        20.1.1.1    1    0 static
             20.1.1.1


6. Configure /etc/hosts in the 3 machines like:

# /etc/hosts file
10.1.1.1	spock
10.1.1.1	deimos
20.1.1.1	spock1   # this is defined to have named the interface
20.1.1.2	phobos

7. you can connect from any machine to any other with telnet, ping, etc.





