ChinaUnix.net 首页 | 博客 | Linux | 论坛 | 人才 | 培训 | 知识库 | 资料 | 读书 | 手册 | 精华 | 下载 | 沙龙 | 搜索
Linux首页 | Linux论坛 | 论坛精华 | 开源新闻 | 技术文章 | 专题专栏 | 新手指南 | 迁移方案 | 产品方案 | 开源项目 | 开源图书 | 软件下载 | 人才招聘 | Linux博客
  搜索

  产品与方案
·中科红旗全面打造现代化邮政体系
·红旗助力“网上审批服务” 推动电子政务
·红旗正版化开创呼和浩特网吧建设新起点
·红旗Linux助信息产业部邮件服务器“快跑”
·中标普华Linux 为电子政务信息化保驾护航
·中标普华Linux助力基金产业
·中标普华Office率先支持UOF标准
·中标普华邮件系统助力西藏政府信息化建设
·红旗Linux助力国库集中支付系统改革
·红旗助中信卫星 掀起GIS通信应用风暴
·红旗软件助力烟草总局 全面建设“数字烟草”
·红旗助力“信访阳光工程”打造畅通信访渠道
·红帽联合FIS发布下一代实时核心银行平台
·红旗助力金盾 打造全无忧出入境信息系统
·红旗Linux全力打造中国邮政总局名址信息库
·爱尔兰证交所从Unix迁移到红帽企业Linux
·一流的意大利银行选择使用红帽企业Linux
·PLUS Finanzservice选择使用红帽企业Linux
·红帽助力TransACT Communications 公司
·法国零售业巨头Lapeyre采用Redhat Linux
·旅游预订网站选择使用红帽企业Linux
·马哈拉施特拉邦政府的红帽解决之道
·美国联邦政府案例
·红帽为慕尼黑展览会提供现代化集群系统
·Yuba郡用开源软件和红帽产品提高了效率
·红帽企业Linux助印度理工建立高性能计算中心
·采用红帽Linux 将系统维护时间缩短了65%
·从UNIX迁移到Linux使Peñoles公司获益非浅
·Hikal公司用红帽企业Linux开展任务关键的ERP项目
·KDE3.5.4新版本发布
·芝加哥商业交易所从Unix向Linux迁移
·南方基金管理有限公司成功案例 Red Hat Linux
·广东北电通讯设备有限公司成功案例
·挪威国家石油公司从UNIX迁移到红帽Linux,成本减半
·中央电视台CCTV动画部案例 Red Hat Linux

  图书

鸟哥的Linux私房菜基础学..


Linux程序设计.第3版


Linux设备驱动开发详解


  下载
·Endian Firewall
·linux kernel(Linux 内核)
·CentOS
·Fedora Core 6
·Scientific Linux
·Slackware 11.0
·Gentoo Linux
·ubuntu-6.10-i386服务器版本
·ubuntu-6.10-amd64服务器版
·ubuntu-6.10-i386桌面版
·ubuntu-6.10-amd64桌面版
·Engarde Linux
您的位置: Linux时代 > 新闻资讯 >

使用RANCID备份你的网络

日期:2006-07-31 作者:Walter Gould 


A couple of years ago, my employer, a large state university, was looking for an open source replacement for CiscoWorks to assist us in backing up our network configurations. We found RANCID (Really Awesome New Cisco config Differ), tried it, and have used it ever since.

RANCID, which its developers say is released under a BSD-like license, will check your network device configurations and back them up if changes have been made. It keeps a history of changes using either Concurrent Version System (CVS) or Subversion. RANCID is written in Perl and Expect. It supports Cisco routers, switches, and firewalls, Juniper routers, Foundry switches, Redback network-attached storage, Alteon and Hewlett-Packard ProCurve switches, and other devices. RANCID is a useful tool not only for backing up device configs, but also for troubleshooting network problems, because it lets you determine what changes were made since the last revision.

Before installing, you should scan the README file that is included with the package. It contains a quick installation guide that will help in configuring RANCID.

Installing RANCID is straightforward. If you are running FreeBSD, RANCID can be found in the ports under /usr/ports/net/rancid; running make install should do the trick. Ubuntu and Debian Linux distributions include RANCID packages that can be installed using APT. If you are using a distribution that does not include a RANCID package (Fedora Core, CentOS, Gentoo, etc.) you can manually install it by following the instructions in the README file.

After installing, add an unprivileged user that RANCID can run its scripts as -- "rancid," for instance. You also need to give that user privileges to run scripts in the directory that RANCID was installed in, with a command like chown -R rancid.rancid /usr/local/rancid.

Next, you need to modify the LIST_OF_GROUPS variable in the rancid.conf file, which defines the groups that you will classify your devices into. For example, your LIST_OF_GROUPS variable might be defined as LIST_OF_GROUPS="core border resnet engineering wireless firewalls library". Doing this makes things easier when you're adding devices, as you can place a device in a group that corresponds to its function or location.

The next step is to put a copy of the .cloginrc file in the home directory of the user that RANCID will run as. This file tells RANCID how to log in to the devices that are to be backed up. The syntax is pretty straightforward and there are examples in the cloginrc.sample file in the /usr/local/rancid/share/rancid/ directory.

After setting up your .cloginrc file, make sure that you change the permissions on the file so that is not readable or writable by other users, with a command like chmod 600 .cloginrc.

If you would like to be emailed a report about the configuration differences when a change has been made to a device config, or notification of error messages, modify your /etc/aliases file. RANCID will send reports to rancid-group@domain_name and errors to rancid-admin-group@domain_name, where group is the group you defined in the rancid.conf file.

Next, you should run $rancid_home/bin/rancid-cvs to create directories and configuration files for each of the groups you specified in the LIST_OF_GROUPS variable and import them into your RANCID CVS repository. These directories and config files will be created under $rancid_home/var/. You need to cd into each of these directories and add to the router.db file each device whose configuration is to be backed up. Be aware of what operating system your Cisco switch or router uses, and be sure to specify that in the router.db file. The README file contains examples that will help you in making these entries.

Now you should be ready to actually test RANCID. Run $rancid_home/bin/rancid-run and tail the logs in the $rancid_home/var/logs directory. If all goes well, you should see something similar to:

cvs add: scheduling file `10.3.1.1' for addition
cvs add: use 'cvs commit' to add this file permanently
RCS file: /usr/local/rancid/var/CVS/core/configs/10.3.1.1,v
done
Checking in 10.3.1.1;
/usr/local/rancid/var/CVS/core/configs/10.3.1.1,v <-- 10.3.41.1
initial revision: 1.1
done

Once you are able to run rancid-run without receiving errors in your logs, you should add a crontab entry for $rancid_home/bin/rancid-run, after you decide how often your configs need to be backed up. If you make many changes throughout the day, then it might be a good idea to have RANCID run every hour or two. If you only make a couple of changes during the day, then running RANCID once or twice a day would probably suffice. At our university, we back our configs up once per day, but I know of a company that backs up its configurations every hour.

RANCID is particular regarding device prompts, especially on Cisco Catalyst switches. The Catalyst OS does not include a ">" in its prompt, and that character is something RANCID looks for. If you have any CatOS switches, you will need to add a ">" after its prompt in order for RANCID to be able to log in and fetch the config. You can do this easily by issuing a set prompt switchname> command on the switch.

One file that has helped us in troubleshooting our RANCID configuration is $rancid_home/bin/clogin. If you notice login errors in your RANCID logs, trying running this file to log in to your switch or router. The syntax is easy: $rancid_home/bin/clogin ip_address. If the correct IP address and password combination is in your .cloginrc file and if there are no prompt issues (as mentioned above), running clogin should log you into the device that you specify. If clogin allows you to log in, that indicates that the IP and password combination in your .cloginrc file is correct -- so your problem lies elsewhere.

A useful package to run alongside RANCID is CVSweb. CVSweb is a CGI script that allows you to view your CVS repository using a Web browser. Our switch technicians use CVSweb to copy and paste device configs directly from a browser into a text editor, so they don't have to worry about knowing any CVS commands. You can also browse each file's revisions and even see and highlight the differences between each revision.

As helpful a tool as it is, RANCID is fairly hands-on to configure and requires someone to manage the list of devices to be backed up. In addition, it helps if you have a working knowledge of CVS. For these reasons, RANCID may not be a viable solution for everyone. For us, however, the benefits outweigh the costs and the minor inconveniences. On more than one occasion, RANCID has gotten us out of a tight spot.

原文链接:http://www.newsforge.com/article.pl?sid=06/07/20/1950259

本文被浏览



 相关新闻



 相关评论
关于我们 | 联系方式 | 广告合作 | 诚聘英才 | 网站地图 | 免费注册

Copyright © 2001-2006 ChinaUnix.net All Rights Reserved

感谢所有关心和支持过ChinaUnix的朋友们

京ICP证041476号