Copyright © Ari Kuswanto
Design by Dzignine
Sabtu, 06 November 2010

Instalasi ZEBRA pada UNIX


Daftar Materi :

I. Zebra (Linux Router Software)

II. SNMP / NET-SNMP (Simple Network Management Protocol)

III. MRTG (Multi Router Traffic Graph)


I. Zebra (Linux Router Software) :



Zebra is TCP/IP routing software that supports BGP-4, BGP-4+, OSPFv2, OSPFv3, RIPv1, RIPv2, and RIPng. It is distributed under the GNU General Public License and runs on Linux as well as other UNIX variants. Zebra is included in most modern distributions as routing software. The latest version, along with documentation, is available at the GNU Zebra Web.


The original Zebra package was written by Kunihiro Ishiguro and Yoshinari Yoshikawa back in 1996. Today, the package is maintained primarily by IP Infusion -- of which Mr. Ishiguro is the CTO -- with the assistance of networking engineers and open source volunteers.

Zebra is unique in its design because it takes a modular approach to the protocols that it manages. Protocols can be enabled or disabled as network requirements dictate.


By far the most useful feature we found with Zebra was its close similarity to the Cisco IOS configuration formats. While there are some differences from IOS, the feel is close enough that network engineers already familiar with IOS will feel very comfortable in the environment.


While Zebra has not yet hit version 1.0 -- the version at the time of this writing is 0.93b -- the quality of the product is adequate for small networks that need a core router.


I.a File konfigurasi :

Konfigurasi file terdapat di file zebra.conf, untuk konfigurasi routing protocol terdapat di file rip.conf dan ospf.conf. (Terletak di /usr/local/zebra/etc).



hostname speedmetal

password zebra

enable password zebra


I.b Cara konfigurasi zebra : dengan melakukan telnet ke port 2601 :



[root@speedmetal zebra]# telnet 127.0.0.1 2601

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.


Hello, this is zebra (version 0.93b).

Copyright 1996-2002 Kunihiro Ishiguro.


User Access Verification


Password: zebra

speedmetal> enable

Password: zebra

speedmetal# ?

  configure  Configuration from vty interface

  copy       Copy configuration

  debug      Debugging functions (see also 'undebug')

  disable    Turn off privileged mode command

  end        End current mode and change to enable mode.

  exit       Exit current mode and down to previous mode

  help       Description of the interactive help system

  list       Print command list

  no         Negate a command or set its defaults

  quit       Exit current mode and down to previous mode

  show       Show running system information

  terminal   Set terminal line parameters

  who        Display who is on vty

  write      Write running configuration to memory, network, or terminal

speedmetal#


I.c Installasi Zebra.

- Unpack source : gunzip dan tar –xvf

- Konfigurasi dengan :


#./configure –prefix=/usr/local/zebra –enable-snmp

# make

# make install

# make clean

  • Pindah ke direktori /usr/local/zebra/etc
  • Kopi zebra.conf.example menjadi zebra.conf, edit jika diperlukan.
  • Pindah ke direktori /usr/local/zebra/sbin
  • Jalankan Zebra dengan :


#./zebra&

  • Lakukan telnet ke local :



I.d Konfigurasi dengan MRLG (Multi Router Looking Glass) :



The Multi-Router Looking Glass, or MRLG, written by John Frazier of EnterZone, is a Web-based utility that can be used to display the interfaces and routes recognized by Zebra. MRLG is really nothing more than a Web interface to the Zebra shell with a limited set of commands, but in the course of our testing, we found it to be a quick and useful way to display routes. So, before getting to the configuration of the Zebra protocols, we'll show you how we installed it.

  • Unpack source : Gunzip dan tar –xvf
  • Jalankan perintah :

# perl MakeFile.PL

# make

# make test

# make install

  • Pindah ke direktori source Zebra : /tmp/zebra-0.94/tools/
  • Kopikan file mrlg.cgi ke /var/www/cgi-bin.
  • Modifikan file mrlg.cgi:

    a. Baris ke 36 :


$url="http://www.sample.com/mrlg.cgi";

to:

$url="http://127.0.0.1/cgi-bin/mrlg.cgi";


b. Baris ke 168 dan 174 :



if ($Form{'router'} eq 'router1')

        {

$server = '127.0.0.1';

$login_pass = 'zebra';

$bgpd = "2605";

$zebra = "2601";

$full_tables=1;



I.e Lab. Simulation (RIP)




Konfigurasi Router C :

  • set dummy interface :

# modprobe dummy
# ifconfig dummy0


  • Konfigurasi IP :


User Access Verification


Password: zebra

speedmetal> enable

Password: zebra

speedmetal# configure terminal

speedmetal(config)# interface eth0

speedmetal(config-if)# ip address 192.168.2.1/30

speedmetal(config-if)# quit

speedmetal(config)# interface eth1

speedmetal(config-if)# ip address 192.168.1.1/30

speedmetal(config-if)# quit

speedmetal(config)# interface dummy0

speedmetal(config-if)# ip address 10.0.2.1/24

speedmetal(config-if)# write

Configuration saved to /etc/zebra/zebra.conf

speedmetal(config-if)# end

speedmetal# show run


Current configuration:

!

hostname speedmetal

password zebra

enable password zebra

!

interface lo

!

interface eth0

 ip address 192.168.2.1/30

!

interface dummy0

 ip address 10.0.2.1/24

!

interface eth1

 ip address 192.168.1.1/30

!

!

line vty

!

end


  • Set RIP protocol :

a. Set rip konfigurasi /usr/local/zebra/etc, kopikan rip.conf.example menjadi rip.conf.

b. Jalankan rip service di /usr/local/zebra/sbin/ : #>./ripd&

c. Konfigurasi RIP :

User Access Verification


Password: zebra

speedmetal-rip> enable

Password: zebra

speedmetal-rip# configure terminal

speedmetal-rip(config)# router rip

speedmetal-rip(config-router)# network 10.0.0.0/8

speedmetal-rip(config-router)# network 192.168.0.0/16

speedmetal-rip(config-router)# end

speedmetal-rip# show run


Current configuration:

!

hostname speedmetal-rip

password zebra

enable password zebra

!

interface lo

!

interface eth0

!

interface dummy0

!

router rip

 network 0.0.0.0/0

 network 192.168.0.0/16

!

line vty

!

end

speedmetal-rip# write

Configuration saved to /etc/zebra/ripd.conf

speedmetal-rip#


Konfigurasi Router A :

  • set dummy interface :

# modprobe dummy
# ifconfig dummy0


  • Konfigurasi IP :


User Access Verification


Password: zebra

speedmetal> enable

Password: zebra

speedmetal# configure terminal

speedmetal(config)# interface eth0

speedmetal(config-if)# ip address 192.168.2.2/30

speedmetal(config-if)# quit

speedmetal(config)# interface eth1

speedmetal(config-if)# ip address 192.168.0.1/30

speedmetal(config-if)# quit

speedmetal(config)# interface dummy0

speedmetal(config-if)# ip address 10.0.0.1/24

speedmetal(config-if)# write

Configuration saved to /etc/zebra/zebra.conf

speedmetal(config-if)# end

speedmetal# show run


Current configuration:

!

hostname speedmetal

password zebra

enable password zebra

!

interface lo

!

interface eth0

 ip address 192.168.2.2/30

!

interface dummy0

 ip address 10.0.0.1/24

!

interface eth1

 ip address 192.168.0.1/30

!

!

line vty

!

end


  • Set RIP protocol :

a. Set rip konfigurasi /usr/local/zebra/etc, kopikan rip.conf.example menjadi rip.conf.

b. Jalankan rip service di /usr/local/zebra/sbin/ : #>./ripd&

c. Konfigurasi RIP :

User Access Verification


Password: zebra

speedmetal-rip> enable

Password: zebra

speedmetal-rip# configure terminal

speedmetal-rip(config)# router rip

speedmetal-rip(config-router)# network 10.0.0.0/8

speedmetal-rip(config-router)# network 192.168.0.0/16

speedmetal-rip(config-router)# end

speedmetal-rip# show run


Current configuration:

!

hostname speedmetal-rip

password zebra

enable password zebra

!

interface lo

!

interface eth0

!

interface dummy0

!

router rip

 network 0.0.0.0/0

 network 192.168.0.0/16

!

line vty

!

end

speedmetal-rip# write

Configuration saved to /etc/zebra/ripd.conf

speedmetal-rip#


Konfigurasi Router B :

  • set dummy interface :

# modprobe dummy
# ifconfig dummy0


  • Konfigurasi IP :


User Access Verification


Password: zebra

speedmetal> enable

Password: zebra

speedmetal# configure terminal

speedmetal(config)# interface eth0

speedmetal(config-if)# ip address 192.168.0.2/30

speedmetal(config-if)# quit

speedmetal(config)# interface eth1

speedmetal(config-if)# ip address 192.168.1.2/30

speedmetal(config-if)# quit

speedmetal(config)# interface dummy0

speedmetal(config-if)# ip address 10.0.1.1/24

speedmetal(config-if)# write

Configuration saved to /etc/zebra/zebra.conf

speedmetal(config-if)# end

speedmetal# show run


Current configuration:

!

hostname speedmetal

password zebra

enable password zebra

!

interface lo

!

interface eth0

 ip address 192.168.0.2/30

!

interface dummy0

 ip address 10.0.1.1/24

!

interface eth1

 ip address 192.168.1.2/30

!

!

line vty

!

end


  • Set RIP protocol :

a. Set rip konfigurasi /usr/local/zebra/etc, kopikan rip.conf.example menjadi rip.conf.

b. Jalankan rip service di /usr/local/zebra/sbin/ : #>./ripd&

c. Konfigurasi RIP :

User Access Verification


Password: zebra

speedmetal-rip> enable

Password: zebra

speedmetal-rip# configure terminal

speedmetal-rip(config)# router rip

speedmetal-rip(config-router)# network 10.0.0.0/8

speedmetal-rip(config-router)# network 192.168.0.0/16

speedmetal-rip(config-router)# end

speedmetal-rip# show run


Current configuration:

!

hostname speedmetal-rip

password zebra

enable password zebra

!

interface lo

!

interface eth0

!

interface dummy0

!

router rip

 network 0.0.0.0/0

 network 192.168.0.0/16

!

line vty

!

end

speedmetal-rip# write

Configuration saved to /etc/zebra/ripd.conf

speedmetal-rip#


- Cek routing table Router C :


Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,

       B - BGP, > - selected route, * - FIB route


R>* 10.0.0.0/24 [120/2] via 192.168.2.2, eth0, 00:11:05

R>* 10.0.1.0/24 [120/2] via 192.168.1.2, eth1, 00:02:08

C>* 10.0.2.0/24 is directly connected, dummy0

K * 127.0.0.0/8 is directly connected, lo

C>* 127.0.0.0/8 is directly connected, lo

R>* 192.168.0.0/30 [120/2] via 192.168.2.2, eth0, 00:11:05

C>* 192.168.1.0/30 is directly connected, eth1

C>* 192.168.2.0/30 is directly connected, eth0


- Cek ping ke 10.0.0.1 dan 10.0.1.1

- Test router failover : matikan interface / kabel eth0 dari router A : (Tunggu > 2 menit)

Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,

       B - BGP, > - selected route, * - FIB route


R>* 10.0.0.0/24 [120/3] via 192.168.1.2, eth0, 00:00:26

R>* 10.0.1.0/24 [120/2] via 192.168.1.2, eth1, 00:06:02

C>* 10.0.2.0/24 is directly connected, dummy0

K * 127.0.0.0/8 is directly connected, lo

C>* 127.0.0.0/8 is directly connected, lo

R>* 192.168.0.0/30 [120/2] via 192.168.1.2, eth1, 00:00:26

C>* 192.168.1.0/30 is directly connected, eth1

C>* 192.168.2.0/30 is directly connected, eth0


  • Cek routing table router A sebelum failover :


RouterA#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

       * - candidate default, U - per-user static route, o - ODR

       P - periodic downloaded static route


Gateway of last resort is not set


     10.0.0.0/24 is subnetted, 3 subnets

R       10.0.2.0 [120/1] via 192.168.2.1, 00:00:11, FastEthernet0/0

C       10.0.0.0 is directly connected, Loopback0

R       10.0.1.0 [120/1] via 192.168.0.2, 00:00:18, FastEthernet0/1

     192.168.0.0/30 is subnetted, 1 subnets

C       192.168.0.0 is directly connected, FastEthernet0/1

     192.168.1.0/30 is subnetted, 1 subnets

R       192.168.1.0 [120/1] via 192.168.0.2, 00:00:18, FastEthernet0/1

                    [120/1] via 192.168.2.1, 00:00:11, FastEthernet0/0

     192.168.2.0/30 is subnetted, 1 subnets

C       192.168.2.0 is directly connected, FastEthernet0/0



  • Cek routing table router A setelah failover :


RouterA#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

       * - candidate default, U - per-user static route, o - ODR

       P - periodic downloaded static route


Gateway of last resort is not set


     10.0.0.0/24 is subnetted, 3 subnets

R       10.0.2.0 [120/2] via 192.168.0.2, 00:00:09, FastEthernet0/1

C       10.0.0.0 is directly connected, Loopback0

R       10.0.1.0 [120/1] via 192.168.0.2, 00:00:09, FastEthernet0/1

     192.168.0.0/30 is subnetted, 1 subnets

C       192.168.0.0 is directly connected, Serial0/0

     192.168.1.0/30 is subnetted, 1 subnets

R       192.168.1.0 [120/1] via 192.168.0.2, 00:00:09, FastEthernet0/1

     192.168.2.0/30 is subnetted, 1 subnets

R       192.168.2.0 [120/2] via 192.168.0.2, 00:00:10, FastEthernet0/1



I.f Lab. Simulation (OSPF)

- Matikan service RIP : kill

- Kopi konfigurasi ospf.conf.example ke ospf.conf.

- Konfigurasi dengan telnet ke port 2604

- Konfigurasi Router A/B/C :


root@speedmetal zebra]# telnet 127.0.0.1 2604

User Access Verification


Password: zebra

speedmetal-ospf> enable

Password: zebra

speedmetal-ospf# configure terminal

speedmetal-ospf(config)# router ospf

speedmetal-ospf(config-router)# network 0.0.0.0/0 area 0

speedmetal-ospf(config-router)# end

speedmetal-ospf# write

Configuration saved to /etc/zebra/ospfd.conf

speedmetal-ospf# show run


Current configuration:

!

hostname speedmetal-ospf

password zebra

enable password zebra

!

!

router ospf

 network 0.0.0.0/0 area 0

!

line vty

!

end

speedmetal-ospf#

  • Cek Routing Table :

Codes: K - kernel route, C - connected, S - static, R - RIP, O - OSPF,

       B - BGP, > - selected route, * - FIB route


O>* 10.0.0.0/32 [110/11] via 192.168.2.2, eth0, 00:00:01

O>* 10.0.1.1/32 [110/11] via 192.168.1.2, eth1, 00:02:53

O   10.0.2.0/24 [110/10] is directly connected, dummy0, 00:03:31

C>* 10.0.2.0/24 is directly connected, dummy0

K * 127.0.0.0/8 is directly connected, lo

C>* 127.0.0.0/8 is directly connected, lo

O>* 192.168.0.0/30 [110/58] via 192.168.2.2, eth0, 00:00:01

                            via 192.168.1.2, eth1, 00:00:01

O   192.168.1.0/30 [110/10] is directly connected, eth1, 00:03:21

C>* 192.168.1.0/30 is directly connected, eth1

O   192.168.2.0/30 [110/10] is directly connected, eth0, 00:03:31

C>* 192.168.2.0/30 is directly connected, eth0

  • Lakukan failover testing.



II. SNMP / NET-SNMP (Simple Network Management Protocol)

SNMP operates at the application level using TCP/IP transport-level protocols so it can ignore the underlying network hardware. This means the management software uses IP, and so can control devices on any connected network:not just those attached to its physical network. This also has disadvantages: if the IP routing is not working correctly between two devices, it's impossible to reach the target to monitor or reconfigure it.

There are two main elements in the SNMP architecture: the agent and the manager. It's a client-server architecture, where the agent is the server and the manager is the client.

The agent is a program running in each of the monitored or managed nodes of the network. It provides an interface to all the items of their configuration. These items are stored in a data structure called a management information base (MIB), which we explain later. It's the server side, as long as it maintains the information being managed and waits for commands from the client.

The manager is the software that runs in the monitoring station of the network, and its role is contacting the different agents running in the network to poll for values of its internal data. It's the client side of the communication.

There is a special command in the SNMP command set called trap that permits an agent to send unsolicited data to the manager, to inform it of events, such as errors, shutdowns, etc.

In essence, SNMP is a very simple protocol as long as all the operations it performs deal with the fetch-and-store paradigm, and this allows for a small commands set. A manager can perform only two different operations on an agent: request or set the value of a variable in the MIB of the agent. These two operations are known as get-request and set-request. There's a command to respond to a get-request called get-response, which is used only by the agent.

The extensibility of the protocol is directly related to the capability of the MIB to store new items. If a manufacturer wants to add some new commands to a device such as a router, he must add the appropriate variables to its database (MIB).

Almost all manufacturers implement versions of SNMP agents in their devices: routers, hubs, operating systems, and so on. Linux is not an exception to this, and publicly available SNMP agents for Linux can be found on the Internet.


Software SNMP di linux :

  • cmu-snmp
  • net-snmp untuk Zebra


II.a.1 Installasi cmu-snmp

# gunzip cmu-snmp-linux-3.2-bin.tar.gz

# tar xvf cmu-snmp-linux-3.2-bin.tar

# /tmp/cmu-snmp-linux-3.2/etc/installconf -mini

# /usr/sbin/snmpd -f ; echo 'starting snmpd'


a.2 SNMP Tools :

  • /usr/bin/snmpget A tool designed to ask for a concrete value in the MIB of an agent in the network (a router, a hub, etc.)
  • /usr/bin/snmpgetnext It allows you to get the next object in an MIB tree without knowing its name.
  • /usr/bin/snmpset A tool to set values in remote agents
  • /usr/bin/snmpwalk Tool that requests a complete object or series of objects without having to specify the exact instance. It's useful for requesting table objects.
  • /usr/bin/snmpnetstat
  • /usr/bin/snmptrapd Daemon that listens for traps sent by agents
  • /usr/bin/snmptest Interactive tool designed to demonstrate the capacities of the API.


a.3 Testing :

# /usr/bin/snmpget -v 1 localhost public interfaces.ifNumber.0

# /usr/bin/snmpwalk -v 1 localhost public system

Hasil :

dragon:~$ /usr/bin/snmpwalk


usage: snmpwalk [-p ] host community [object-id]


dragon:~$ /usr/bin/snmpwalk  localhost public system


system.sysDescr.0 = "Linux version 2.0.24 (root@dragon)

                     (gcc version 2.7.2) #6 Mon Nov 25 15:08:40 MET 1996"

system.sysObjectID.0 = OID: enterprises.tubs.ibr.linuxMIB

system.sysUpTime.0 = Timeticks: (39748002) 4 days, 14:24:40

system.sysContact.0 = "David Guerrero"

system.sysName.0 = "dragon "

system.sysLocation.0 = "Madrid (SPAIN)"

system.sysServices.0 = 72

system.sysORLastChange.0 = Timeticks: (39748006) 4 days, 14:24:40

system.sysORTable.sysOREntry.sysORID.1 = OID: enterprises.tubs.ibr.linuxMIB.linuxAgents.1

system.sysORTable.sysOREntry.sysORDescr.1 = "LINUX agent"

system.sysORTable.sysOREntry.sysORUpTime.1 = Timeticks: (39748007) 4 days, 14:24:40


dragon:~$


II.b.1 Installasi net-snmp

  • Unpack soure : tar
  • Kompile :

# configure --with-mib-modules=smux

# make

# make install

  • Konfigurasi file /usr/local/share/snmp/snmpd.conf

# smuxpeer 1.3.6.1.6.3.1 test




III. MRTG (Multi Router Traffic Graph)

MRTG is an advanced tool written by Tobias Oetiker and Dave Rand to graphically represent the data SNMP agents brings to SNMP managers. It generates nice HTML pages with GIF graphics about inbound and outbound traffic in network interfaces in almost real time. This abstracts the idea of dealing directly with objects of an MIB with a command line tool like CMU-SNMP. This is the simplest and most powerful tool to monitor my routers I have found on the Internet.

MRTG uses an SNMP implementation coded entirely in Perl, so there is no need to install other packages. The main program is written in C to speed up the logging process and the generation of GIF images. The graphics are generated with the help of the GD library from Thomas Boutell, author of the WWW FAQ.

One of the highlights of MRTG is its expandability and powerful configuration. It's very easy to monitor any SNMP variables instead of traffic, like error packets, system load, modem availability and others. It's even possible to import data from an external program to feed the data, so you can use it to monitor login sessions and other information not available through SNMP.


III.a Installasi

  • Konfigurasi Zlib :

gunzip -c zlib-*.tar.gz | tar xf -

rm zlib-*.tar.gz

mv zlib-* zlib

cd zlib

./configure

make

cd ..

  • Konfigurasi libpng :

gunzip -c libpng-*.tar.gz |tar xf -

rm libpng-*.tar.gz

mv libpng-* libpng

cd libpng

make -f scripts/makefile.std CC=gcc ZLIBLIB=../zlib ZLIBINC=../zlib

rm *.so.* *.so

cd ..


- Konfigurasi gd : (2.0.11) :

gunzip -c gd-2.0.11.tar.gz |tar xf -

mv gd-2.0.11 gd

cd gd

env CPPFLAGS="-I../zlib -I../libpng" LDFLAGS="-L../zlib -L../libpng" ./configure --disable-shared \

--without-freetype --without-jpeg

make

cp .libs/* .


- Konfigurasi MRTG :


cd /usr/local/src

gunzip -c mrtg-2.14.3.tar.gz | tar xvf -

cd mrtg-2.14.3


  • Kompile MRTG :

./configure --prefix=/usr/local/mrtg-2

Atau

./configure --prefix=/usr/local/mrtg-2 \

--with-gd=/usr/local/src/gd \

--with-z=/usr/local/src/zlib \

--with-png=/usr/local/src/libpng


# make

# make install


  • Setting mrtg.cfg :

# cfgmaker public@192.168.233.1 > mrtg.cfg

# ./mrtg mrtg.cfg

# indexmaker mrtg.cfg > /usr/local/web/mrtg/index.html


  • Setting Schedule :

# crontab –e

*/5 * * * * <mrtg-bin>/mrtg <path to mrtg-cfg>/mrtg.cfg \

--logging /var/log/mrtg.log




===== Selesai =====