Configuring the Gateway

Although this project is intended to develop a peer to peer connection by means of the serial port, it can also be extended to a network of more than two computers.A simple way of doing this is to configure the routing table of each node.We configure the network in such a way that the system adjacent to the any system will be its gateway to go into the other the network.

Figure 1. A Simple Network of Four Systems

Each system has it's own routing teble , it can be seen by running the command routeSuppose our network configuration is as shown in the figure above.Here each system is loaded with two drivers named serial1 and serial2 by the steps explained in the previous section.The IP-address are assigned to the system as shown in the figure.

In the current topology shown above in the figure different network exists between two systems as listed below

192.168.1.0 between system1 and system2

192.168.2.0 between system2 and system3

192.168.3.0 between system3 and system4

192.168.4.0 between system4 and system1

Here all systems has to forward packet to the system adjacent to it, if the corresponding packet doesnot belong to that particular system.Inorder to accomplish that we have to run the command echo 1 >/etc/sys/ip/ip_forward.Now inorder to establish a full fledged network between four networks we have to configure each system individually.

Implementation

Configuring System1

Here system1 is directly connected to system2 and system4 ,ie it has a direct connection to networks 192.168.2.0 and 192.168.4.0. Inorder to reach system3 we have to configure either system2 or system4 as gateway.Here system2 is taken as gateway.It is done by running the command route add net 192.168.2.0 mask 255.255.255.0 -dev serial1

Configuring System2

Here system2 is directly connected to system1 and system3 ,ie it has a direct connection to networks 192.168.1.0 and 192.168.3.0.Inorder to reach system4 we have to configure either system1 or system3 as gateway. Here system3 is taken as gateway.It is done by running the command route add net 192.168.4.0 mask 255.255.255.0 -dev serial2.

Configuring System3

Here system3 is directly connected to system2 and system4 ,ie it has a direct connection to networks 192.168.2.0 and 192.168.4.0.Inorder to reach system1 we have to configure either system2 or system4 as gateway.Here system4 is taken as gateway.It is done by running the command route add net 192.168.1.0 mask 255.255.255.0 -dev serial1.

Configuring System4

Here system4 is directly connected to system1 and system3 ,ie it has a direct connection to networks 192.168.1.0 and 192.168.3.0.Inorder to reach system2 we have to configure either system1 or system3 as gateway.Here system1 is taken as gateway.It is done by running the command route add net 192.168.2.0 mask 255.255.255.0 -dev serial2.