![]() ![]() |
Sep 14 2005, 04:09 AM
Post
#1
|
|
|
Its GNU/Linuxhelp.net ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Support Specialist Posts: 1,417 Joined: 3-January 04 From: Serbia and Montenegro (SCG) Member No.: 2,069 |
UPDATE
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---| 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 /etc/quagga/zebra.conf CODE hostname router1.middleearth.vir 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 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 /etc/quagga/zebra.conf CODE hostname router2.middleearth.vir 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 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 /etc/quagga/zebra.conf CODE hostname router3.middleearth.vir 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 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 /etc/quagga/zebra.conf CODE hostname router4.middleearth.vir 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 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 : _ 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 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 This post has been edited by Robert83: Oct 3 2005, 04:56 AM -------------------- Robert Becskei
robert83@linuxhelp.net -------------------- May the source be with us! -------------------- AMD X2-3800 @ 2400Mhz 2048MB DDR 400Mhz DFI Lanparty UT4 NF4 ULTRA-D GeForce 7800GT 250GB+250GB Pioneer DVD-RW 17inch Samsung Syncmaster 757NF WinXP Pro (SP2)/ CentOS 4.3 -------------------- |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 4th December 2008 - 01:48 PM |