MRLG 的配置和使用
Multi-Router Looking Glass,简称 MRLG,由 EnterZone 的 John Frazier 开发,是一个基于 Web 的工具,可以用来显示 Zebra 识别出来的接口和路由。MRLG 其实仅仅是 Zebra shell 的一个 Web 界面,只能使用有限的命令集,但是在我们的测试过程中,我们发现使用它是显示路由的一个快速而有效的途径。所以,在开始配置 Zebra 协议之前,我们先向您介绍如何安装 MRLG。
MRLG 需要 Net::Telnet Perl 软件包的支持才能与 Zebra shell 通信。
由于 MRLG 是作为一个 CGI 应用程序来运行,因此我们还需要安装一个 Web 服务器。如果您是自己在尝试这些事情,您可以直接使用 Red Hat 9 自带的 httpd RPM。
我们将 /usr/share/doc/zebra-0.93b/tools 目录中的 mrlg.cgi 文件拷贝到 /var/www/cgi-gin 目录下。然后,我们修改 mrlg.cgi 文件的第36行,将
$url="http://www.sample.com/mrlg.cgi";
修改为:
$url="http://127.0.0.1/cgi-bin/mrlg.cgi";
我们还修改了第168行到第174行的部分内容,如下所示:
if ($Form{'router'} eq 'router1') { $server = '127.0.0.1'; $login_pass = 'zebra'; $bgpd = "2605"; $zebra = "2601"; $full_tables=1;
为了访问 MRLG,将浏览器定向到 http://127.0.0.1/cgi-bin/mrlg.cgi。
基本的实验室配置
我们的实验室配置包括两个 Cisco 3620 路由器和一个 ThinkPad X20(有一个内置的以太网接口和一个 Home-and-Away PCMCIA 以太网卡)。两个路由器通过串行线联接起来,并且每个路由器通过以太网连接到 ThinkPad。
使用 Zebra 配置接口
我们首先从 RIP 协议开始讲述使用 Zebra 来管理路由。如前所述,我们已经在 ThinkPad 上安装了 Zebra。由于我们在 ThinkPad 上还需要另一个网络接口,我们安装了一个虚拟的网络设备,如下:
modprobe dummy
ifconfig dummy0
我们 telnet 到 Zebra 端口来开始配置。我们按照以下顺序与 Zebra 会话:
清单 3. 配置 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
要注意的是我们没有用常规的方法设置 ThinkPad 的 IP 地址;而是通过 Zebra 来设置它们。这些设置保存在 /etc/zebra/zebra.conf 配置文件中,因此每次当 Zebra 服务启动时,这些设置就会生效。
Zebra.conf 文件中由 Zebra 修改的部分如下:
清单 4. 由 Zebra 修改过的 /etc/zebra/zebra.conf 文件
!
! Zebra configuration saved from vty
! 2003/08/20 00:07:51
!
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
!
我们还可以用 MRLG 来检查接口的状态,方法是:选择默认值,"router1",选中单选按钮 "show interface",然后点击 "Execute"。