1.路由器、交换机基本配置

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

一.熟悉交换机,路由器的基本配置.
1.路由器的几个操作模式
Router> //用户模式
Router>enable //用户模式敲入enable进入特权模式
Router#configure terminal //特权模式敲入configure termina进入配置模式
Router(config)#interface ethernet 0 //配置模式敲入interface+接口类型+接口编号,进入配置模式(如:interface serial 0 或是interface serial 0/1 ,interface fast1/1,接口编号是多少具体要看是哪个型号的设备)
Router(config-if)#exit //从接口模式退出到配置模式
Router(config)#exit //从配置模式退出到enable模式
Router# //enable模式,也是特权模式.
注意:任何时候按Ctrl-z或是end都会退出到特权模式
2.命名主机名
路由默认主机名为Router
例如:把路由器的主机名命名为XM-WENPING-R2600-A
Router(config)#hostname XM-WENPING-R2600-A
XM-WENPING-R2600-A(config)#
XM-WENPING-R2600-A(config)#hostname Wisdom//设置主机名是Wisdom
Wisdom(config)#
3.给路由器设置时间
Wisdom(config)#Wisdom#clock set 23:46:50 sep 4 2006
Wisdom#show clock //用show clock 命令查看时间
23:46:57.527 UTC Mon Sep 4 2006
Wisdom#
4.给路由器设置banner//登录信息
Wisdom(config)#banner motd #
Enter TEXT message. End with the character '#'.
Welcome to wisdom !!
#
Wisdom(config)#end
Wisdom#exit
03:12:58: %SYS-5-CONFIG_I: Configured from console by console
Wisdom#exit
Wisdom con0 is now available
Press RETURN to get started.
Welcome to wisdom !!// 配置是banner之后无论谁登录到路由器都会先看到的信息. Wisdom>enable
Wisdom#
Banner信息很多情况下是一些警告的信息:
如:
banner motd ^C
*********************************************************
* [WARNING] *
* If you are not authorised to access this system *
* exit immediately. *
* Unauthorised access to this system is forbidden by *
* company policies, national, and international laws. *
* Unauthorised users are subject to criminal and civil *
* penalties as well as company initiated disciplinary *
* proceedings. *
* *
* By entry into this system you acknowledge that you *
* are authorised to access it and have the level of *
* privilege at which you subsequently operate on *
* this system *
* You consent by entry into this system to the *
* monitoring of your activities *
*********************************************************
^C
5.路由器,交换机接口的描述
Wisdom(config)#interface ethernet 0
Wisdom(config-if)#description To Fuzhou-R2600-A//描述ethernet0口是接到福州的路由器A,一般都要尽可以的描述详细一点,这样有利于日后的维护.
6.路由器,交换机密码的设置
A.enable密码的设置(enable的密码就是从用户模式到特权模式的密码,enable的密码有两种,一种是加密的,一种是不加密码的,建议使用enable secret 设置密码)
Wisdom(config)#enable password cisco
Wisdom(config)#enable secret cisco1
Wisdom(config)#end
Wisdom#disable
03:29:29: %SYS-5-CONFIG_I: Configured from console by console
Wisdom>enable
Password://这里要输入的是cisco1 ,如果enable的两个密码同时设置,只是secret生效.Wisdom#
Wisdom#show run
Building configuration...
Current configuration:
!
enable secret 5 $1$LNtZ$XFAQft5YyTsrXFV AXNp0Y///加密过的
enable password cisco //显示为明文,容易被破解.不过可以手工加密,用命令service password-encryption 进行加密
Wisdom(config)#service password-encryption
Wisdom#show run
Building configuration...
Current configuration:
!
enable secret 5 $1$LNtZ$XFAQft5YyTsrXFV AXNp0Y///加密过的
enable password 7 104D000A0618//手工加密过的
B.设置交换机路由器的console 口密码
Wisdom(config)#line console 0
Wisdom(config-line)#login//启用密码no login 是不启用密码
Wisdom(config-line)#password cisco //设置的密码为cisco
Wisdom(config-line)#end
03:39:51: %SYS-5-CONFIG_I: Configured from console by console
Wisdom#exit
Wisdom con0 is now available
Press RETURN to get started.
Welcome to wisdom !!
User Access Verification
Password://要输入console口密码cisco 才可以进入用户模式Wisdom>
C.设置路由器交换机的vty 密码(也是就是远程登陆telnet的密码)
Wisdom(config)#line vty 0 4//04的意思是0到4,5个人可以同时登录Wisdom(config-line)#login//启用密码,no login 是不启用密码
Wisdom(config-line)#password cisco//设置的密码为cisco
测试网络的连通性:
telnet+IP address
D:删除enable ,console ,vty 密码
Wisdom(config)#no enable password
Wisdom(config)#no enable secret
Wisdom(config)#line con
Wisdom(config)#line console 0
Wisdom(config-line)#no password
Wisdom(config)#line vty 0 4
Wisdom(config-line)#no password
Wisdom(config-line)#
E.两条常用的命令
阻止会话退出--exec-timeout
使光标还原到原来的位置,重新显示被覆盖的命里--logging synchronous
Wisdom(config)#line console 0
Wisdom(config-line)#exec-timeout 0 0//0分0秒表示永远不超时,等同于no exec-timeout
Wisdom (config)#line console 0
Wisdom (config-line)#logging synchronous
F.路由器和交换机的基本配置是一样的.大同小异.这里介绍怎么远程telnet 到交换机. Switch(config)#hostname SW2950 //命名主要机
SW2950(config)#interface vlan 1 //在二层的交换机上配置一个三层管理地址
SW2950(config-if)#ip add 192.168.10.225 255.255.255.0
SW2950(config-if)#no shutdown //启用接口
SW2950(config)#line vty 0 4
SW2950(config-line)#login
SW2950(config-line)#password cisco
SW2950(config-line)#
pc>telnet 192.168.10.225
Trying 192.168.10.225 ... Open
User Access Verification
Password:
SW2950>
这证明远程telnet 成功.
G:配置R1.R2.R3的基本配置,使得在R1可以ping通12.1.1.2,ping通13.1.1.3
配置R1:
R1(config)#no ip domain-lookup //关掉域名查找
R1(config)#line console 0
R1(config-line)#login
R1(config-line)#password cisco
R1(config-line)#logging synchronous
R1(config-line)#exec-timeout 0 0
R1(config-line)#
配置路由器的E0口IP地址
Router(config)#hostname R1
R1(config)#interface ethernet 0 //配置E0接口的IP地址
R1(config-if)#ip address 11.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#no keepalive
R1(config-if)#exit
配置路由器的S0 口IP地址
R1(config)#interface serial 0
R1(config-if)#ip address 12.1.1.1 255.255.255.0
R1(config-if)#clock rate 4000000 //给DCE接口配置时钟
R1(config-if)#no shutdown
配置路由器的S1 口IP地址
R1(config)#interface serial 1
R1(config-if)#ip address 13.1.1.1 255.255.255.0
R1(config-if)#clock rate 4000000
R1(config-if)#no shutdown
配置R2:
R2(config)#no ip domain-lookup //关掉域名查找
R2(config)#line console 0
R2(config-line)#login
R2(config-line)#password cisco
R2(config-line)#logging synchronous
R2(config-line)#exec-timeout 0 0
R2(config-line)#
Router(config)#hostname R2
R2(config)#interface ethernet 0
R2(config-if)#ip address 22.1.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#no keepalive
R2(config-if)#exi
R2(config)#interface serial 0
R2(config-if)#ip address 12.1.1.2 255.255.255.0
R2(config-if)#no shutdown
配置R3:
R3(config)#no ip domain-lookup //关掉域名查找
R3(config)#line console 0
R3(config-line)#login
R3(config-line)#password cisco
R3(config-line)#logging synchronous
R3(config-line)#exec-timeout 0 0
R3(config-line)#exit
Router(config)#hostname R3
R3(config)#interface ethernet 0
R3(config-if)#ip address 33.1.1.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#no keepalive
R3(config)#int serial 0
R3(config-if)#ip address 13.1.1.3 255.255.255.0
R3(config-if)#no shutdown
配置了以前步骤之后用命令show interface 检查接口的状态. R1#show ip interface brief
Ethernet0 11.1.1.1 YES manual up up Serial0 12.1.1.1 YES manual up up Serial1 13.1.1.1 YES manual up up
R1#show interfaces ethernet 0
Ethernet0 is up, line protocol is up
Hardware is Lance, address is 00e0.b05b.018e (bia 00e0.b05b.018e)
Internet address is 11.1.1.1/24
MTU 1500 bytes, BW 10000 Kbit, DL Y 1000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive not set
ARP type: ARPA, ARP Timeout 04:00:00
…………..
…………..
R1#show interfaces serial 0
Serial0 is up, line protocol is up
Hardware is HD64570
Internet address is 12.1.1.1/24
MTU 1500 bytes, BW 1544 Kbit, DL Y 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
Keepalive set (10 sec)
…………
……………….
R1#show interfaces serial 1
Serial1 is up, line protocol is up
Hardware is HD64570
Internet address is 13.1.1.1/24
MTU 1500 bytes, BW 1544 Kbit, DL Y 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation HDLC, loopback not set
Keepalive set (10 sec)
……………..
……………………..
R1#
R2#show ip interface brief
Ethernet0 22.1.1.2 YES manual up up Serial0 12.1.1.2 YES manual up up Serial1 unassigned YES unset administratively down down
R3#show ip interface brief
Interface IP-Address OK? Method Status Protocol Ethernet0 33.1.1.3 YES manual up up Serial0 13.1.1.3 YES manual up up Serial1 unassigned YES unset administratively down down
在R1测试到R2 R3的连通性,使用ping 的命令
Ping + ip address
如:
R1#ping 12.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
!!!!! //5个!表明网络是通的
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/8 ms
R1#ping 13.1.1.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 13.1.1.3, timeout is 2 seconds:
!!!!! //5个!表明网络是通的
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/8 ms
R1#
在路由器或是交换机里使用ping命令
如果ping的结果是!!!!!则表明网络正常.
..则表明网络不通.
如果ping的结果是…
如果ping的结果是U.U.U则表明下一跳不可达.
H:路由器交换机几条常用的命令:
Show version //查看软件版本
show running-config //查看当前运行的配置文件
show startup-config //查看已保存过的配置文件
show ip int brie //查看接口基本状态
show interface //查看接口状态的详细信息
copy run star //把当前运行的配置COPY到NVRAM(断电后不丢失)
show controller serial 0 //检察s0口的串行线是否连接好
R1#show controllers serial 0
HD unit 0, idb = 0x29A524, driver structure at 0x2A1AE8
buffer size 1524 HD unit 0, V.35 DCE cable, clockrate 4000000
…………
R1#show controllers serial 1
HD unit 0, idb = 0x29A524, driver structure at 0x2A1AE8
buffer size 1524 HD unit 0, V.35 DCE cable, clockrate 4000000 //DCE接口要配置时钟…………
R2#show controllers serial 0
HD unit 0, idb = 0x270B50, driver structure at 0x278108
buffer size 1524 HD unit 0, V.35 DTE cable //DTE接口不用配置时钟
………………
I.清除NVRAM(注:交换机和路由器所用命令一样)
SW2950#erase startup-config
要重起路由器或是交换机,配置才会丢失.。

相关文档
最新文档