计算机技术论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

  • 欢迎访问 计算机技术论坛-电脑迷与初学者的家园!由于论坛管理严格,新注册会员可能遇到各种问题,无法解决的请发邮件 admin@jsjbbs.cn
查看: 3227|回复: 0

路由器的配置与调试

[复制链接]
发表于 2009-1-7 15:45:54 | 显示全部楼层 |阅读模式
  路由器在计算机网络中有着举足轻重的地位,是计算机网络的桥梁。通过它不仅可以连通不同的网络,还能选择数据传送的路径,并能阻隔非法的访问。
  路由器的配置对初学者来说,并不是件十分容易的事。现将路由器的一般配置和简单调试介绍给大家,供朋友们在配置路由器时参考,本文以Cisco2501为例。
  Cisco2501有一个以太网口(AUI)、一个Console口(RJ45)、一个AUX口(RJ45)和两个同步串口,支持DTE和DCE设备,支持 EIA/TIA-232、 EIA/TIA-449、 V.35 、X.25和EIA-530接口。
  一.配置
  1.配置以太网端口
  # conf t(从终端配置路由器)
  # int e0(指定E0口)
  # ip addr ABCD XXXX(ABCD 为以太网地址,XXXX为子网掩码)
  # ip addr ABCD XXXX secondary(E0口同时支持两个地址类型。如果第一个为 A类地址,则第二个为B或C类地址)
  # no shutdown(激活E0口)
  # exit
  完成以上配置后,用ping命令检查E0口是否正常。如果不正常,一般是因为没有激活该端口,初学者往往容易忽视。用no shutdown命令激活E0口即可。
  2.X.25的配置
  # conf t
  # int S0(指定S0口)
  # ip addr ABCD XXXX(ABCD 为以太网S0 的IP地址,XXXX为子网掩码)
  # encap X25-ABC(封装X.25协议。ABC指定X.25为DTE或DCE操作,缺省为DTE)
  # x25 addr ABCD(ABCD为S0的X.25端口地址,由邮电局提供)
  # x25 map ip ABCD XXXX br(映射的X.25地址。ABCD为对方路由器(如:S0)的IP 地址,XXXX为对方路由器(如:S0)的X.25端口地址)
  # x25 htc X(配置最高双向通道数。X的取值范围1-4095,要根据 邮电局实际提供的数字配置)
  # x25 nvc X(配置虚电路数,X不可超过邮电局实际提供的数否则将影响数据的正常传输)
  # exit
  S0端口配置完成后,用no shutdown命令激活E0口。如果ping S0端口正常,ping 映射的X.25 IP地址即对方路由器端口IP地址不通,则可能是以下几种情况引起的:1)本机X.25地址配置错误,重新与邮局核对(X.25地址长度为13位);2)本机映射IP地址或X.25地址配置错误,重新配置正确;3)对方IP地址或X.25地址配置错误;4)本机或对方路由配置错误。
  能够与对方通讯,但有丢包现象。出现这种情况,一般有以下几种可能:1)线路情况不好,或网卡、RJ45插头接触不良;2)x25 htc最高双向通道数X的取值范围和x25nvc 虚电路数X超出邮电局实际提供的数字。最高双向通道数和虚电路数这两个值越大越好,但绝对不能超出邮电局实际提供的数字,否则就会出现丢包现象。
  3.专线的配置
  # conf t
  # int S2(指定S2口)
  # ip addr ABCD XXXX(ABCD 为S2 的IP地址,XXXX为子网掩码)
  # exit
  专线口配置完成后,用no shutdown命令激活S2口即可。
  4.帧中继的配置
  # conf t
  # int s0
  # ip addr ABCD XXXX (ABCD 为S0 的IP地址,XXXX为子网掩码)
  # encap frame_relay (封装frame_relay 协议)
  # no nrzi_encoding (NRZI=NO)
  # frame_relay lmi_type q933a (LMI使用Q933A标准.LMI(Local management Interface) 有3种:ANSI:T1.617、CCITTY:Q933A和Cisco特有的标准)
  # frame-relay intf-typ ABC(ABC为帧中继设备类型,它们分别是DTE设备、DCE交换机或NNI(网络接点接口)支持)
  # frame_relay interface_dlci 110 br(配置DLCI(数据链路连接标识符))
  # frame-relay map ip ABCD XXXX broadcast (建立帧中继映射。ABCD为对方IP地址,XXXX为本地DLCI号,broadcast允许广播向前转发或更新路由)
  # no shutdown (激活本端口)
  # exit
  帧中继S0端口配置完成后,用ping命令检查S0口。如果不正常,通常是因为没有激活该端口,用no shutdown命令激活S0口即可。如果ping S0端口正常,ping 映射的IP地址不正常,则可能是帧中继交换机或对方配置错误,需要综合排查。
  5.配置同步/异步口(适用于2522)
  # conf t
  # int s2
  # ph asyn (配置S2为异步口)
  # ph sync (配置S2为同步口)
  6.动态路由的配置
  # conf t
  # router eigrp 20 (使用EIGRP路由协议。常用的路由协议有RIP、IGRP、IS-IS等)
  # passive-interface serial0 (若S0与X.25相连,则输入本条指令)
  # passive-interface serial1 (若S1与X.25相连,则输入本条指令)
  # network ABCD (ABCD为本机的以太网地址)
  # network XXXX (XXXX为S0的IP地址)
  # no auto-summary
  # exit
  7.静态路由的配置
  # ip router ABCD XXXX YYYY 90 (ABCD为对方路由器的以太网地址,XXXX 为子网掩码,YYYY为对方对应的广域网端口地址)
  # dialer-list 1 protocol ip permit
  二. 综合调试
  当路由器全部配置完毕后,可进行一次综合调试。
  1.首先将路由器的以太网口和所有要使用的串口都激活。方法是进入该口,执行no shutdown。
  2.将和路由器相连的主机加上缺省路由(中心路由器的以太地址)。方法是在Unix系统的超级用户下执行:router add default XXXX 1(XXXX为路由器的E0口地址)。每台主机都要加缺省路由,否则,将不能正常通讯。
  3.ping本机的路由器以太网口,若不通,可能以太网口没有激活或不在一个网段上。ping广域网口,若不通,则没有加缺省路由。ping对方广域网口,若不通,路由器配置错误。ping主机以太网口,若不通,对方主机没有加缺省路由。
  4.在专线卡X.25主机上加网关(静态路由)。方法是在Unix系统的超级用户下执行:router add X.X.X.X Y.Y.Y.Y 1(X.X.X.X为对方以太网地址,Y.Y.Y.Y为对方广域网地址)。
  5.使用Tracert对路由进行跟踪,以确定不通网段。
  路由器的选购
  选择路由器时应注意安全性、控制软件、网络扩展能力、网管系统、带电插拔能力等方面。
  1.由于路由器是网络中比较关键的设备,针对网络存在的各种安全隐患,路由器必须具有如下的安全特性:
  (1)可靠性与线路安全 可靠性要求是针对故障恢复和负载能力而提出来的。对于路由器来说,可靠性主要体现在接口故障和网络流量增大两种情况下,为此,备份是路由器不可或缺的手段之一。当主接口出现故障时,备份接口自动投入工作,保证网络的正常运行。当网络流量增大时,备份接口又可承当负载分担的任务。 (2)身份认证 路由器中的身份认证主要包括访问路由器时的身份认证、对端路由器的身份认证和路由信息的身份认证。
  (3)访问控制 对于路由器的访问控制,需要进行口令的分级保护。有基于IP地址的访问控制和基于用户的访问控制。
  (4)信息隐藏 与对端通信时,不一定需要用真实身份进行通信。通过地址转换,可以做到隐藏网内地址,只以公共地址的方式访问外部网络。除了由内部网络首先发起的连接,网外用户不能通过地址转换直接访问网内资源。
  (5)数据加密
  (6)攻击探测和防范
  (7)安全管理
  2.路由器的控制软件是路由器发挥功能的一个关键环节。从软件的安装、参数自动设置,到软件版本的升级都是必不可少的。软件安装、参数设置及调试越方便,用户使用就越容易掌握,就能更好地应用。
  3.随着计算机网络应用的逐渐增加,现有的网络规模有可能不能满足实际需要,会产生扩大网络规模的要求,因此扩展能力是一个网络在设计和建设过程中必须要考虑的。扩展能力的大小主要看路由器支持的扩展槽数目或者扩展端口数目。
  4.随着网络的建设,网络规模会越来越大,网络的维护和管理就越难进行,所以网络管理显得尤为重要。 5.在我们安装、调试、检修和维护或者扩展计算机网络的过程中,免不了要给网络中增减设备,也就是说可能会要插拔网络部件。那么路由器能否支持带电插拔,是路由器的一个重要的性能指标。
  外型尺寸的选择
  如果网络已完成楼宇级的综合布线,工程要求网络设备上机式集中管理,应选择19英寸宽的机架式路由器,如Cisco2509、华为2501(配置同Cisco2501)。如果没有上述需求,桌面型的路由器如Intel的8100和Cisco的1600系列,具有更高的性能价格比。
  协议的选择
  由于最初局域网并没先出标准后出产品,所以很多厂商如Apple和IBM都提出了自己的标准,产生了如AppleTalk和IBM协议,Novell公司的网络操作系统运行IPX/SPX协议,在连接这些异构网络时需要路由器对这些协议提供支持。Intel9100系列和9200系列的路由器可提供免费支持,3Com的系列路由产品也提供较广泛的协议支持。
  路由器作为网络设备中的“黑匣子”,工作在后台。用户选择路由器时,多从技术角度来考虑,如可延展性、路由协议互操作性、广域数据服务支持、内部ATM支持、SAN集成能力等。另外,选择路由器还应遵循如下基本原则:即标准化原则、技术简单性原则、环境适应性原则、可管理性原则和容错冗余性原则。对于高端路由器,更多的还应该考虑是否和如何适应骨干网对网络高可靠性、接口高扩展性以及路由查找和数据转发的高性能要求。高可靠性、高扩展性和高性能的“三高”特性是高端路由器区别于中、低端路由器的关键所在。
  CISCO路由器初始配置简介
  很多初学路由器知识的网友对路由器的初始配置可能感到很陌生,本人在初学时也很困惑,因为一下出来很多提问不知如何是好,下面将最近刚调试的一台CISCO3640的初始配置整理出来与各位网友交流,如有疏漏之处,还请大家指正。
  1.用CISCO随机带CONSOLE线,一端连在CISCO路由器的CONSOLE口,一端连在计算机的COM口。
  2.打开电脑,启动超级终端.为您的连接取个名字,比如CISCO_SETUP,下一步选定连接时用COM1,下一步选定第秒位数9600,数据位8,奇偶校验无,停止位1,数据流控制无.最后选确定。
  3.打开路由器电源,这时超级终端将出现以下画面:
  System Bootstrap, Version 11.1(20)AA2, EARLY DEPLOYMENT RELEASE SOFTWARE (fc1)
  Copyright (c) 1999 by cisco Systems, Inc.C3600 processor with 32768 Kbytes of main memory Main memory is configured to 64 bit mode with parity disabled
  program load complete, entry point: 0x80008000, size: 0x4ed478 Self decompressing the image :
  ###################################################################
  ###################################################################
  ###################################################################
  ###################################################################
  ###################################################################
  ###################################################################
  ###################################################################
  [OK]
  Restricted Rights Legend
  Use, duplication, or disclosure by the Government is
  subject to restrictions as set forth in subparagraph
  (c) of the Commercial Computer Software - Restricted
  Rights clause at FAR sec. 52.227-19 and subparagraph
  (c) (1) (ii) of the Rights in Technical Data and Computer
  Software clause at DFARS sec. 252.227-7013.
  cisco Systems, Inc.
  170 West Tasman Drive
  San Jose, California 95134-1706
  Cisco Internetwork Operating System Software
  IOS (tm) 3600 Software (C3640-I-M), Version 12.1(2)T, RELEASE SOFTWARE (fc1)
  Copyright (c) 1986-2000 by cisco Systems, Inc.
  Compiled Tue 16-May-00 12:26 by ccai
  Image text-base: 0x600088F0, data-base: 0x60924000
  cisco 3640 (R4700) processor (revision 0x00) with 24576K/8192K bytes of memory.
  Processor board ID 25125768
  R4700 CPU at 100Mhz, Implementation 33, Rev 1.0
  Bridging software.
  X.25 software, Version 3.0.0.
  2 FastEthernet/IEEE 802.3 interface(s)
  1 Serial network interface(s)
  DRAM configuration is 64 bits wide with parity disabled.
  125K bytes of non-volatile configuration memory.
  8192K bytes of processor board System flash (Read/Write)
  --- System Configuration Dialog ---
  Would you like to enter the initial configuration dialog? [yes/no]: y
  您是否进入初始化配置对话,选Y
  At any point you may enter a question mark '?' for help.
  Use ctrl-c to abort configuration dialog at any prompt.
  Default settings are in square brackets '[]'.Basic management setup configures only enough connectivity
  for management of the system, extended setup will ask you
  to configure each interface on the system
  Would you like to enter basic management setup? [yes/no]: n
  您是否进入基本配置安装,选N
  First, would you like to see the current interface summary? [yes]: y
  首先,您是否看一下当前端口状态
  Any interface listed with OK? value "NO" does not have a valid configuration
  Interface IP-Address OK? Method Status Protocol
  FastEthernet0/0unassigned NO unset up down
  Serial0/0 unassigned NO unset down down
  FastEthernet0/1unassigned NO unset up down
  Configuring global parameters:
  Enter host name [Router]:RouterA
  输入路由器的名字
  The enable secret is a password used to protect access to
  privileged EXEC and configuration modes. This password, after
  entered, becomes encrypted in the configuration.
  Enter enable secret: aaa
  输入密文
  The enable password is used when you do not specify an
  enable secret password, with some older software versions, and
  some boot images.
  Enter enable password: bbb
  输入密码(不能和密文相同)
  The virtual terminal password is used to protect
  access to the router over a network interface.
  Enter virtual terminal password: ccc
  输入虚拟终端的密码(以备远程登录)
  Configure SNMP Network Management? [yes]: n
  配置简单网管吗?选N
  Configure IP? [yes]: y
  配置IP吗?选Y
  Configure IGRP routing? [yes]: n
  配置IGRP路由选择协议吗?选N
  Configure RIP routing? [no]:
  配置IGRP路由选择协议吗?选N
  Configure bridging? [no]:
  配置桥接吗?选N
  Async lines accept incoming modems calls. If you will have
  users dialing in via modems, configure these lines.
  Configure Async lines? [yes]: n
  配置异步线路吗?选N
  Configuring interface parameters:
  Do you want to configure FastEthernet0/0 interface? [yes]: y
  您是否想配置fastethernet0/0接口?选Y
  Use the 100 Base-TX (RJ-45) connector? [yes]: y
  用RJ45的连接器吗?选Y
  Operate in full-duplex mode? [no]: y
  选用全双工模式?选Y
  Configure IP on this interface? [yes]: y
  在这个接口上配置IP吗?选Y
  IP address for this interface: 192.168.0.1
  配置该接口的IP地址(在此地址为192.168.0.1
  Subnet mask for this interface [255.255.255.0] :
  配置该接口的子网掩码.(默认的是255.255.255.0,可以手工输入修改)
  Class C network is 192.168.0.0, 24 subnet bits; mask is /24
  Do you want to configure Serial0/0 interface? [yes]: y
  您想配置serial0/0接口吗?选Y
  Some supported encapsulations are
  ppp/hdlc/frame-relay/lapb/x25/atm-dxi/smds
  Choose encapsulation type [hdlc]:
  选择封装方式(默认的封装方式是HDLC,您可根据与您的路由器相连选用的封装类型来决定用什么样的封装类型
  No serial cable seen.
  Choose mode from (dce/dte) [dte]:
  (因为没有连串口线所以会让您选择设备类型)
  Configure IP on this interface? [yes]: y
  (在接口上配置IP)
  Configure IP unnumbered on this interface? [no]:
  IP address for this interface: 172.16.0.5
  配置该接口的IP地址(在此地址为172.16.0.5)
  Subnet mask for this interface [255.255.0.0] : 255.255.255.252
  配置该接口的子网掩码.(默认的是255.255.0.0,可以手工输入修改为255.255.255.252)
  Class B network is 172.16.0.0, 30 subnet bits; mask is /30
  (以下配置同上)
  Do you want to configure FastEthernet0/1 interface? [yes]:
  Use the 100 Base-TX (RJ-45) connector? [yes]:
  Operate in full-duplex mode? [no]: y
  Configure IP on this interface? [yes]: y
  IP address for this interface: 172.16.0.9
  Subnet mask for this interface [255.255.0.0] : 255.255.255.252 Class B network is 172.16.0.0, 30 subnet bits; mask is /30
  The following configuration command script was created:
  (把您的配置显示出来)
  hostname aaa
  enable secret 5 $ul/V$ezbZFgvzGHD.YPSieC0Ew/
  enable password RouterA
  line vty 0 4
  password ccc
  no snmp-server
  !
  ip routing
  no bridge 1
  !
  interface FastEthernet0/0
  media-type 100BaseX
  full-duplex
  ip address 192.168.0.1 255.255.255.0
  !
  interface Serial0/0
  encapsulation hdlc
  ip address 172.16.0.5 255.255.255.252
  !
  interface FastEthernet0/1
  media-type 100BaseX
  full-duplex
  ip address 172.16.0.9 255.255.255.252
  dialer-list 1 protocol ip permit
  dialer-list 1 protocol ipx permit
  !
  end
  以下提示您是否保存这次设置
  [0] Go to the IOS command prompt without saving this config.
  [1] Return back to the setup without saving this config.
  [2] Save this configuration to nvram and exit.
  Enter your selection [2]: 2
  选择2保存设置并存入NVRAM中
  Building configuration...
  [OK] Use the enabled mode 'configure' command to modify this configuration.
  Press RETURN to get started!
  路由器重新启动
  00:00:08: %LINK-3-UPDOWN: Interface Serial0/0, changed state to down
  00:00:08: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
  00:00:08: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
  00:00:09: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0, changed state to down
  00:00:09: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down
  00:00:09: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
  00:03:18: %IP-5-WEBINST_KILL: Terminating DNS process
  00:03:24: %SYS-5-RESTART: System restarted --
  Cisco Internetwork Operating System Software
  IOS (tm) 3600 Software (C3640-I-M), Version 12.1(2)T, RELEASE SOFTWARE (fc1)
  Copyright (c) 1986-2000 by cisco Systems, Inc.
  Compiled Tue 16-May-00 12:26 by ccai
  RouterA>
  进入用户模式
  RouterA>en
  Password:
  RouterA#
  进入全局模式
  RouterA#sh run
  查看现在运行的配置
  Building configuration...
  Current configuration:
  !
  version 12.1
  service timestamps debug uptime
  service timestamps log uptime
  no service password-encryption
  !
  hostname RouterA
  !
  enable secret 5 $ul/V$ezbZFgvzGHD.YPSieC0Ew/
  enable password bbb
  !
  memory-size iomem 25
  ip subnet-zero
  !
  interface FastEthernet0/0
  ip address 192.168.0.1 255.255.255.0
  speed auto
  full-duplex
  !
  interface Serial0/0
  ip address 172.16.0.5 255.255.255.252
  clockrate 2000000
  !
  interface FastEthernet0/1
  ip address 172.16.0.9 255.255.255.252
  speed auto
  full-duplex
  !
  ip classless
  no ip http server
  !
  dialer-list 1 protocol ip permit
  dialer-list 1 protocol ipx permit
  !
  line con 0
  transport input none
  line aux 0
  line vty 0 4
  password ccc
  login
  !
  end
  现在您就完成了了一个新路由器的基本配置,接下来就可以进行进一步的详细配置了
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

无图版|手机版|计算机技术论坛 JSJBBS.CN @ 2008-2024 ( 鲁ICP备17021708号 )

技术支持 : 北京康盛新创科技有限责任公司

快速回复 返回顶部 返回列表