路由器与交换机的配置代码

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

1.配置路由器的主机名和提示信息。

Router(config)#

Router(config)#hostname R1

R1(config)#banner motd %

Enter TEXT message. End with the character '%'.

2.配置enable密码、配置console和vty密码。

R1(config)#enable secret class

R1(config)#line console 0

R1(config-line)#password cisco

R1(config-line)#login

R1(config-line)#line vty 0 4

R1(config-line)#password cisco

R1(config-line)#login

3.配置接口(s0/0和f0/0),并显示接口信息。

R1(config)#interface FastEthernet0/0

R1(config-if)#ip address 192.168.10.1 255.255.255.0

R1(config-if)#no shutdown

保存配置

R1#copy running-config startup-config

Destination filename [startup-config]?

Building configuration...

[OK]

删除启动配置

R1#erase startup-config

Erasing the nvram filesystem will remove all configuration files! Continue? [confirm] [OK]

Erase of nvram: complete

%SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram

查看R1的cdp邻居

R1#show cdp neighbors

关闭R1接口下的cdp

R1(config)#interface s0/0/0

R1(config-if)#no cdp enable

打开R1接口下的cdp

R1(config)#interface s0/0/0

R1(config-if)#cdp enable

ble

4)关闭和打开整个路由的cdp

关闭R1整个路由的cdp

R1(config)#no cdp run

打开R1整个路由的cdp

R1(config)#cdp run

关闭R2整个路由的cdp

R2(config)#no cdp run

打开R2整个路由的cdp

R2(config)#cdp run

5)在R1和R2上的s0/0上配置IP地址,以及enable密码和vty密码

对R1进行配置

R1(config)#interface s0/0/0

R1(config-if)#ip address 192.168.1.1 255.255.255.0

R1(config-if)#no shutdown

R1(config)#enable secret class

R1(config-line)#line vty 0 4

R1(config-line)#password cisco

R1(config-line)#login

Write)

4)把IOS从路由器备份到TFTP服务器上。

Router#copy running-config tftp:

Address or name of remote host []? 1.1.1.2

Destination filename [Router-confg]? aa.bak

Writing running-config...!!

[OK - 494 bytes]

2)在各路由器上用rip进行配置

R1:Router(config-router)#network 12.12.12.0

8)使用passive在Lo1接口上禁止rip发送信息

Router(config-router)#passive-interface lo1

Router(config-router)#RIP: received v1 update from 12.12.12.2 on Serial0/0/0

23.0.0.0 in 1 hops

2)在各路由器上用ospf进行配置(进程号自定,单区域)

R1:R1(config-router)#network 12.12.12.1 0.0.0.255 area 0

5)查看R1和R2上的f0/1链路谁是DR。在R1上改变router-id,使得R1为DR(要执行clear ip ospf process)。

由上图的show ip ospf neighbor看出R2的优先级最高,所以R2是DR,R1为BDR

R1(config)#router ospf 10

R1(config-router)#router-id 10.1.1.1

R1#clear ip ospf process

Reset ALL OSPF processes? [no]: yes

6)在R2上用ip ospf 的f0/1改变ospf 优先级(ip ospf priority xxx)使得R又成为DR。

Router(config)#interface f0/1

Router(config-if)#ip ospf priority 200

Router#show ip ospf neighbor

7)在R3配置ip route 0.0.0.0 0.0.0.0 3.3.3.254默认路由,模拟连接到Internet 上;在R3的ospf进程中用default-information originate命令;在R1、R2上查看是否有默认路由的产生。

R3进行配置:

Router(config)#ip route 0.0.0.0 0.0.0.0 3.3.3.254

Router(config)#rou

Router(config)#router os

Router(config)#router ospf 1

Router(config-router)#de

Router(config-router)#default-information originate

b)交换机各种密码的配置

配置特权执行口令

Switch(config)# enable secret cisco

Switch(config)#

配置控制台口令。

Switch(config)# line console 0

Switch(config-line)# password class

Switch(config-line)# login

配置虚拟线路口令

Switch(config-line)# line vty 0 15

Switch(config-line)# password cisco

Switch(config-line)# login

d)配置文件的保存、删除;查看flash信息、version信息。

文件的保存:

Switch#w

Building configuration...

OK]

Switch#

文件的删除:

Switch#delete ?

WORD File to be deleted

相关文档
最新文档