Substitute Zebra for a dedicated Cisco router (1)

Source: Internet
Author: User

Dynamic and robust routing is extremely important for Internet networks. Therefore, any network engineer who is first involved in this field must not only understand the concept of routing, but also be able to control it in a real environment. However, the products provided by high-end network equipment suppliers such as Cisco in the routing field are all over the world. This means that most people can only learn routes in school or laboratory environments, it also has to be plagued by practical time and conditions.

We encountered this difficulty when organizing a course on TCP/IP routing. In a small test environment, we want to demonstrate different load balancing situations when using the routing information protocol RIP) and Open Shortest Path Priority Protocol OSPF. However, we have a limited number of Cisco routers on hand. However, some PC machines can be used, so we began to try to use Linux to simulate the Cisco router to solve this problem.

At the beginning, we tried to use the traditional routing and gateway daemon to build our testing network, but we soon discovered that it was difficult to configure them and their capabilities were limited, our job is not worth the candle. So we decided to use a more advanced method to complete our testing network. Fortunately, we found Zebra.

What is Zebra?
Zebra is a TPC/IP routing software that supports BGP-4, BGP-4 +, OSPFv2, OSPFv3, r1_1, r1_2, and RIPng. Its release complies with the GNU General Public License protocol and can run on Linux and other Unix variant operating systems. Zebra is the routing software in the latest release version of the system. The latest version of Zebra and documentation can be downloaded from the GNU Zebra website http://www.zebra.org/

The original Zebra package was completed by Kunihiro Ishiguro and Yoshinari Yoshikawa in 1996. Currently, this software package is mainly maintained by IP Infusion-CTO is Mr. Ishiguro-with the help of multiple network engineers and open source volunteers.

Zebra is designed to manage protocols in modules. You can enable or disable the Protocol as needed.

One of the most practical aspects of Zebra is that its configuration format is extremely similar to that of Cisco IOS. Although its configuration is somewhat different from that of IOS, it is quite easy for network engineers who are familiar with IOS to work in this environment.

Install Zebra
Our Zebra testing platform is an old but still very useful ThinkPad X20, which runs Red Hat Linux 9. ThinkPad has a built-in Ethernet interface, and we add a PCMCIA ethernet card to it to enable the router function. Before installing Zebra, we confirm that both NICs have been recognized by Linux and work properly.

The RPM installation package for the Zebra-0.93b has been attached to Red Hat 9. This version is the same as the version provided on the Zebra website, so we decided to use it directly instead of downloading it from the Internet and compiling it by ourselves. Zebra RPM will install binary files, scripts and configuration files, as well as necessary manuals, examples, and documentation files.

Basic Zebra Configuration
The zebra daemon is a real routing manager that controls other modules and interacts with each other. We need to configure the Zebra daemon first. The corresponding configuration file is/etc/zebra. conf.

The Zebra RPM package contains a complete configuration file sample. However, in the simplest case, we only need to create a/etc/zebra. conf file containing the following lines:

Listing 1. A simplest Zebra configuration file
hostname speedmetalpassword zebraenable password zebra

Hostname specifies the vro name when you enter the interactive configuration mode. It can be any identifier and does not have to be the same as the host name of the machine.

Password specifies the password required to log on to the interactive Zebra terminal.

Enable password specifies the password required to access Zebra with a higher level of identity when you want to change the configuration.

After the/etc/zebra. conf file is created, run the following command to start the zebra daemon:

# service zebra start

Now, telnet to port 2601 of our machine to access the interactive session of Zebra.

List 2. Example of a Zebra session
[root@speedmetal zebra]# telnet 127.0.0.1 2601Trying 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 VerificationPassword: zebraspeedmetal> enablePassword: zebraspeedmetal# ?  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 terminalspeedmetal#

It is easy to operate on interactive terminals. To get a prompt for available commands, you can press? Then the command option appears on the screen. If you are building your own Zebra router and have experience configuring a Cisco router, you will feel very familiar with this configuration process.

Up to now, only Zebra has been configured and run, but there are no other protocols. Next, we will start the configuration content. We will introduce you to this process.

Configuration and use of MRLG
Multi-Router Looking Glass, MRLG for short, is developed by John fraier of EnterZone. It is a Web-based tool that can be used to display interfaces and routes identified by Zebra. MRLG is actually only a Web interface of Zebra shell and can only use a limited command set. However, during our testing, we found that using MRLG is a fast and effective way to display routes. Therefore, before starting to configure the Zebra protocol, we will first introduce you to how to install MRLG.

MRLG must support the Net: Telnet Perl package to communicate with Zebra shell.

As MRLG runs as a CGI application, we also need to install a Web server. If you are trying these things on your own, you can directly use the httpd RPM that comes with Red Hat 9.

Copy the mrlg. cgi file in the/usr/share/doc/zebra-0.93b/tools directory to the/var/www/cgi-gin directory. Then, we modify the 36th line of the mrlg. cgi file

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

To:

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

We also modified part of the content from rows 168th to rows 174th, as shown below:

if ($Form{'router'} eq 'router1') { $server = '127.0.0.1'; $login_pass = 'zebra'; $bgpd = "2605"; $zebra = "2601"; $full_tables=1;

To access MRLG, direct the browser to http: // 127.0.0.1/cgi-bin/mrlg. cgi.

Figure 1. Multi-Router Looking Glass

Basic lab Configuration
Our lab configuration includes two Cisco 3620 routers and a ThinkPad X20 (with a built-in Ethernet interface and a Home-and-Away PCMCIA Ethernet NIC ). The two routers are connected through a serial line, and each router is connected to the ThinkPad over Ethernet. See our connection diagram:

Figure 2. Lab connection Diagram

Use the Zebra configuration interface
We will first introduce the use of Zebra to manage routes from the RIP Protocol. As mentioned above, we have installed Zebra on ThinkPad. Because we need another network interface on ThinkPad, We have installed a virtual network device, as shown below:

# modprobe dummy          
# ifconfig dummy0

Telnet to the Zebra port to start configuration. We talk to Zebra in the following order:

Listing 3. configuring IP interfaces
User Access VerificationPassword: zebraspeedmetal> enablePassword: zebraspeedmetal# configure terminalspeedmetal(config)# interface eth0speedmetal(config-if)# ip address 192.168.2.1/30speedmetal(config-if)# quitspeedmetal(config)# interface eth1speedmetal(config-if)# ip address 192.168.1.1/30speedmetal(config-if)# quitspeedmetal(config)# interface dummy0speedmetal(config-if)# ip address 10.0.2.1/24speedmetal(config-if)# writeConfiguration saved to /etc/zebra/zebra.confspeedmetal(config-if)# endspeedmetal# show run Current configuration:!hostname speedmetalpassword zebraenable 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

Note that we do not use the conventional method to set the IP addresses of ThinkPad; instead, we use Zebra to set them. These settings are saved in the/etc/zebra. conf configuration file. Therefore, these settings take effect each time the Zebra service is started.

The modified parts of the Zebra. conf file are as follows:

Listing 4. The/etc/Zebra/zebra. conf file modified by zebra
!! Zebra configuration saved from vty!   2003/08/20 00:07:51!hostname speedmetalpassword zebraenable 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!

We can also use MRLG to check the interface status by selecting the default value, "router1", selecting the single-choice button "show interface", and then clicking "Execute ".

Use Zebra to install and configure RIP routes
We have installed and configured the network interface on ThinkPad/router. Then we can configure the interface to work with RIP updates. As we have already mentioned, Zebra uses a separate daemon to implement the routing protocol, therefore, we must first create a simple configuration file ripd for the RIP daemon in the/etc/zebra directory. conf.

Listing 5. A basic/etc/zebra/ripd. conf file

hostname speedmetal-rippassword zebraenable password zebra

Then we start the ripd daemon.

# service ripd start

After that, we can telnet to port 2602 of our Zebra router to configure the RIP daemon.

Listing 6. configuring RIP

User Access VerificationPassword: zebraspeedmetal-rip> enablePassword: zebraspeedmetal-rip# configure terminalspeedmetal-rip(config)# router ripspeedmetal-rip(config-router)# network 10.0.0.0/8speedmetal-rip(config-router)# network 192.168.0.0/16speedmetal-rip(config-router)# endspeedmetal-rip# show runCurrent configuration:!hostname speedmetal-rippassword zebraenable password zebra!interface lo!interface eth0!interface dummy0!router rip network 0.0.0.0/0 network 192.168.0.0/16!line vty!endspeedmetal-rip# writeConfiguration saved to /etc/zebra/ripd.confspeedmetal-rip#


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.