百度空间 | 百度首页 
 
查看文章
 
交换机和路由器基本配置(五)
2007年06月27日 星期三 下午 07:18

v      路由

§         跨越从源主机到目标主机的一个互联网络来转发数据包的过程

路由器--能够将数据包转发到正确的目的地,并在转发过程中选择最佳路径的设备.

静态与默认路由适用的环境

v      静态路由

§         特点

         路由表是手工设置的

         除非网络管理员干预,否则静态路由不会发生变化

         路由表的形成不需要占用网络资源

§         适用环境

         一般用于网络规模很小、拓扑结构固定的网络中

v       默认路由

§         特点

         在所有路由类型中,默认路由的优先级最低

§         适用环境

         一般应用在只有一个出口的末端网络中

         或作为其他路由的补充

路由和交换对比

v      路由工作在网络层

§         根据路由表转发数据

§         路由选择

§         路由转发

v      交换工作在数据链路层

§         根据“MAC地址表转发数据

§         硬件转发

路由器的配置模式

v      用户模式:Router>

v      特权模式:Router#

v      全局配置模式:Router(config)#

v      接口配置模式:Router(config-if)#

v      子接口配置模式: Router(config)#interface fa0/0.1

                        Router(config-subif)#

v      Line模式:Router(config-line)#

v      路由模式:Router(config-router)#

静态路由的配置

Router A>enable                                     

Router A#config terminal

Router A(config) #interface f0/0

Router A(config-if) #ip address 192.168.2.2 255.255.255.0

Router A(config-if)#no shutdown

Router A(config-if)#exit

Router A(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1

默认路由的配置

Router B>enable                                     

Router B#config terminal

Router B(config) #interface f0/1

Router B(config-if) #ip address 192.168.2.1 255.255.255.0

Router B(config-if)#no shutdown

Router B(config-if)#exit

Router B(config) #interface f0/0

Router B(config-if) #ip address 192.168.1.1 255.255.255.0

Router B(config-if)#no shutdown

Router B(config-if)#exit

Router B(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.2

查看路由器配置

Router A#show running-config

!

interface Loopback0

no ip address

!

interface FastEthernet0/0

ip address 192.168.2.2 255.255.255.0

duplex auto

speed auto

!

ip classless

ip route 192.168.1.0 255.255.255.0 192.168.2.1

no ip http server

line con 0

line aux 0

line vty 0 4

查看路由表

RouterA#show ip route

Codes: C - connected, S - static, 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

       i - IS-IS, su - IS-IS summary, 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

S    192.168.1.0/24 [1/0] via 192.168.2.1

C    192.168.2.0/24 is directly connected, FastEthernet0/0

检查配置是否正确

v      在路由器A上,使用ping命令检查与192.168.1.0网段的主机是否连通:

      Router A# ping  192.168.1.10

    • 如果ping通,此时在路由器A上显示:

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.1.10, timeout is 2 seconds:

! ! ! ! !

Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms

    • 如果不通,在路由器A上会显示:

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.1.10, timeout is 2 seconds:

. . . . .

Success rate is 0 percent (0/5)

Cisco 2600路由器配置密码

v      配置控制台密码

teacher(config)#line console 0

teacher((config_line)#login

teacher((config_line)#password cisco

v      配置特权模式密码

teacher(config)#enable password cisco

v      配置加密保存的密码

teacher(config)#enable secret 1234

v      对所有密码加密

teacher(config)#service password-encryption

Cisco 2600路由器的描述信息

v      配置路由器的banner信息

teacher(config)#banner motd $This is Aptech

company’s Router! Please don’t change the

configuration without permission! $

v      配置路由器接口的描述信息

teacher(config)#interface fastethernet 0/0

teacher(config_if)#description This is a fast ethernet

port used to connecting the company’s intranet!

配置路由器的控制台会话

v      配置控制台会话时间

teacher(config)#line console 0

teacher(config_line)#exec-timeout 0 0

v      配置控制台输出日志同步

teacher(config)#line console 0

teacher(config_line)#logging synchronous

v       配置禁用DNS

teacher(config)#no ip domain-lookup

路由器密码恢复

v      进入ROM Monitor模式

v      修改配置寄存器的值,启动时绕过startup-config文件:

§         rommon1>confreg 0x2142

§         rommon2>reset

v      startup-config覆盖running-config:

§         Router#copy startup-config running-config

v      修改密码:

§         Router(config)#enable password cisco

v      修改配置寄存器的值:

§         Router(config)#config-register 0x2102

查看路由器配置

teacher #show version

Cisco Internetwork Operating System Software

IOS (tm) 2600 Software (C2600-JS-L), Version 12.0(3), RELEASE SOFTWARE (fc1)

Copyright (c) 1986-1999 by cisco Systems, Inc.

Compiled Mon 08-Feb-99 18:18 by phanguye

Image text-base: 0x03050C84, data-base: 0x00001000

ROM: System Bootstrap, Version 11.0(10c), SOFTWARE

BOOTFLASH: 3000 Bootstrap Software (IGS-BOOT-R), Version 11.0(10c), RELEASE SOFTWARE(fc1)

wg_ro_a uptime is 20 minutes

System restarted by reload

System image file is "flash:c2600-js-l_120-3.bin"

(output omitted)

--More--

Configuration register is 0x2102

单臂路由的配置

Router(config)# interface f0/0.1

Router(config-subif)# encapsolution dot1q 1

Router(config-subif)# ip address  192.168.1.1 255.255.255.0

Router(config)# interface f0/0.2

Router(config-subif)# encapsolution dot1q 2

Router(config-subif)# ip address  192.168.2.1 255.255.255.0

DCEDTE设置

router# show controllers serial0    查看串口0的物理层信息 主要是查看DTE/DCE

(config-if)# encapsulation ppp      封装ppp

(config-if)# clockrate 64000        如果是DCE使需要设置时钟速率
                                    
如果是DTE使不必设置
(config-if)# bandwidth 64           
设置端口带宽为64K


类别:交换&路由 | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu