sorry I forgot to mention, but on all routers you have to add the following line into
your /etc/rc.d/rc.local file.
echo "1" > /proc/sys/net/ipv4/ip_forward
Hello everyone,
Ever got tired of adding those routes by hand, ever wonder if there is a easier way to do this all ?
Well the solution is a nice piece of software called Quagga (http://www.quagga.net/). In this guide
I will show the most simple dynamic routing you can do with this software.
Let's imagine that our network has for example 4 routers. Each of these routers have 3 subnets.
CODE
LAN1----|
LAN2----| ROUTER 1 |----|
LAN3----| |
|
LAN4----| |
LAN5----| ROUTER 2 |----|
LAN6----| |
|
LAN7----| |
LAN8----| ROUTER 3 |----|
LAN9----| |
|
LAN10---| |
LAN11---| ROUTER 4 |----|
LAN12---|
LAN2----| ROUTER 1 |----|
LAN3----| |
|
LAN4----| |
LAN5----| ROUTER 2 |----|
LAN6----| |
|
LAN7----| |
LAN8----| ROUTER 3 |----|
LAN9----| |
|
LAN10---| |
LAN11---| ROUTER 4 |----|
LAN12---|
All of these Routers either have CentOS 3.x or CentOS 4.x installed of them.
ROUTER 1 :
eth0 : 192.168.0.250
eth1 : 192.168.1.250
eth2 : 192.168.2.250
eth3 : 192.168.20.10
ROUTER 2 :
eth0 : 192.168.3.250
eth1 : 192.168.4.250
eth2 : 192.168.5.250
eth3 : 192.168.20.11
ROUTER 3 :
eth0 : 192.168.6.250
eth1 : 192.168.7.250
eth2 : 192.168.8.250
eth3 : 192.168.20.12
ROUTER 4 :
eth0 : 192.168.9.250
eth1 : 192.168.10.250
eth2 : 192.168.11.250
eth3 : 192.168.20.13
On Router 1 you do the following.
CODE
yum install quagga
then you edit the configuration files
/etc/quagga/ripd.conf
/etc/quagga/zebra.conf
like this
/etc/quagga/ripd.conf
CODE
hostname router1.middleearth.vir
password zebra
router rip
network 192.168.0.0/24
network 192.168.1.0/24
network 192.168.2.0/24
network 192.168.20.0/24
log file /var/log/quagga/ripd.log
password zebra
router rip
network 192.168.0.0/24
network 192.168.1.0/24
network 192.168.2.0/24
network 192.168.20.0/24
log file /var/log/quagga/ripd.log
/etc/quagga/zebra.conf
CODE
hostname router1.middleearth.vir
password zebra
enable password zebra
log file /var/log/quagga/zebra.log
password zebra
enable password zebra
log file /var/log/quagga/zebra.log
then you make sure zebra and ripd starts during startup
CODE
chkconfig zebra on
chkconfig ripd on
/etc/init.d/zebra start
/etc/init.d/ripd start
chkconfig ripd on
/etc/init.d/zebra start
/etc/init.d/ripd start
On Router 2 you do the following.
CODE
yum install quagga
then you edit the configuration files
/etc/quagga/ripd.conf
/etc/quagga/zebra.conf
like this
/etc/quagga/ripd.conf
CODE
hostname router2.middleearth.vir
password zebra
router rip
network 192.168.3.0/24
network 192.168.4.0/24
network 192.168.5.0/24
network 192.168.20.0/24
log file /var/log/quagga/ripd.log
password zebra
router rip
network 192.168.3.0/24
network 192.168.4.0/24
network 192.168.5.0/24
network 192.168.20.0/24
log file /var/log/quagga/ripd.log
/etc/quagga/zebra.conf
CODE
hostname router2.middleearth.vir
password zebra
enable password zebra
log file /var/log/quagga/zebra.log
password zebra
enable password zebra
log file /var/log/quagga/zebra.log
then you make sure zebra and ripd starts during startup
CODE
chkconfig zebra on
chkconfig ripd on
/etc/init.d/zebra start
/etc/init.d/ripd start
chkconfig ripd on
/etc/init.d/zebra start
/etc/init.d/ripd start
On Router 3 you do the following.
CODE
yum install quagga
then you edit the configuration files
/etc/quagga/ripd.conf
/etc/quagga/zebra.conf
like this
/etc/quagga/ripd.conf
CODE
hostname router3.middleearth.vir
password zebra
router rip
network 192.168.6.0/24
network 192.168.7.0/24
network 192.168.8.0/24
network 192.168.20.0/24
log file /var/log/quagga/ripd.log
password zebra
router rip
network 192.168.6.0/24
network 192.168.7.0/24
network 192.168.8.0/24
network 192.168.20.0/24
log file /var/log/quagga/ripd.log
/etc/quagga/zebra.conf
CODE
hostname router3.middleearth.vir
password zebra
enable password zebra
log file /var/log/quagga/zebra.log
password zebra
enable password zebra
log file /var/log/quagga/zebra.log
then you make sure zebra and ripd starts during startup
CODE
chkconfig zebra on
chkconfig ripd on
/etc/init.d/zebra start
/etc/init.d/ripd start
chkconfig ripd on
/etc/init.d/zebra start
/etc/init.d/ripd start
On Router 4 you do the following.
CODE
yum install quagga
then you edit the configuration files
/etc/quagga/ripd.conf
/etc/quagga/zebra.conf
like this
/etc/quagga/ripd.conf
CODE
hostname router4.middleearth.vir
password zebra
router rip
network 192.168.9.0/24
network 192.168.10.0/24
network 192.168.11.0/24
network 192.168.20.0/24
log file /var/log/quagga/ripd.log
password zebra
router rip
network 192.168.9.0/24
network 192.168.10.0/24
network 192.168.11.0/24
network 192.168.20.0/24
log file /var/log/quagga/ripd.log
/etc/quagga/zebra.conf
CODE
hostname router4.middleearth.vir
password zebra
enable password zebra
log file /var/log/quagga/zebra.log
password zebra
enable password zebra
log file /var/log/quagga/zebra.log
then you make sure zebra and ripd starts during startup
CODE
chkconfig zebra on
chkconfig ripd on
/etc/init.d/zebra start
/etc/init.d/ripd start
chkconfig ripd on
/etc/init.d/zebra start
/etc/init.d/ripd start
now you can configure a client for example in LAN1 like this
ip : 192.168.1.10
netmask : 255.255.255.0
default gw : 192.168.1.250
dns : ip_you_use_for_that
and from this one client in LAN1 , you will be able to ping all the other clients in LAN2,LAN3,LAN4,LAN5,LAN6,LAN7,LAN8,LAN9,LAN10,LAN11,LAN12.
If you want to see what actualy happens on a router when zebra and ripd are working do the following :
CODE
telnet localhost 2601
this will return the following
CODE
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1)
Escape character is '^]' .
Hello, this is quagga (version 0.96.2).
Copyright 1996-2002 Kunihiro Ishiguro.
User Access Verification
Password : _
Connected to localhost.localdomain (127.0.0.1)
Escape character is '^]' .
Hello, this is quagga (version 0.96.2).
Copyright 1996-2002 Kunihiro Ishiguro.
User Access Verification
Password : _
for the password you type zebra and press enter
then you type
CODE
show ip route
and something like this (this is only a EXAMPLE here from another server, so you wont get this exactly, but it is still important for you to see , the most interesting thing is those routes with a R>* in front of them, it means that quagga is doing it's job)
CODE
gandalf.middleearth.vir> show ip route
Codes : K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
B - BGP, > - selected route, * - FIB route
K>* 0.0.0.0/0 via 217.26.xxx.xxx, eth1
C>* 127.0.0.0/8 is directly connected, lo
K>* 169.254.0.0/16 is directly connected, eth1
R>* 192.168.0.0/24 [120/2] via 192.168.10.10, eth0, 2d19h53m
R>* 192.168.1.0/24 [120/2] via 192.168.10.10, eth0, 2d19h53m
R>* 192.168.2.0/24 [120/2] via 192.168.10.10, eth0, 2d19h53m
C>* 192.168.10.0/24 is directly connected, eth0
R>* 192.168.11.0/24 [120/2] via 192.168.10.10, eth0, 2d19h53m
R>* 192.168.56.0/24 [120/2] via 192.168.10.10, eth0, 2d19h53m
C>* 217.26.xxx.xxx/26 is directly connected, eth1
Codes : K - kernel route, C - connected, S - static, R - RIP, O - OSPF,
B - BGP, > - selected route, * - FIB route
K>* 0.0.0.0/0 via 217.26.xxx.xxx, eth1
C>* 127.0.0.0/8 is directly connected, lo
K>* 169.254.0.0/16 is directly connected, eth1
R>* 192.168.0.0/24 [120/2] via 192.168.10.10, eth0, 2d19h53m
R>* 192.168.1.0/24 [120/2] via 192.168.10.10, eth0, 2d19h53m
R>* 192.168.2.0/24 [120/2] via 192.168.10.10, eth0, 2d19h53m
C>* 192.168.10.0/24 is directly connected, eth0
R>* 192.168.11.0/24 [120/2] via 192.168.10.10, eth0, 2d19h53m
R>* 192.168.56.0/24 [120/2] via 192.168.10.10, eth0, 2d19h53m
C>* 217.26.xxx.xxx/26 is directly connected, eth1
This is it. You can use quagga in more complex networks, or less complex one, even with 2 routers it makes life easier...
Sincerely
Robert B