1.插入switches的设备可以同时传输数据,而hubs不可以。
2.在switches中,每个端口处于1个单独的冲突域里,而hubs的所有端口处于1个大的冲突域里,可想而知,前者在LAN内可以有效的增加带宽.但是这2种设备的所有端口仍然处于1个大的广播域里。
The Physical Layer
the Physical layer负责发送和接受比特.比特由1或者0组成.这层也用于识别数据终端装备(data terminal equipment,DTE)和数据通信装备(data communication equipment,DCE)的接口
DCE一般位于服务商(sevice provider)而DTE一般是附属设备.可用的DTE服务通常是经由modem或者channel service unit/data sevice unit(CSU/DSU)来访问
hubs:其实是多端口的repeaters,重新放大信号用,解决线路过长,信号衰减等问题.
1个物理星形(star)拓扑结构,实际在逻辑上是逻辑总线(bus)拓扑结构
Ethernet Networking
以太网采用1种争夺(contention) 介质访问方法,这个机制使得在1个网络上所有主机共享带宽.采用了Physical layer和Data Link layer的规范.它采用1种带冲突检测的载波监听多路访问的(Carrier Sense Multiple Access with Collision Detection,CSMA/CD)机制
自动检测机制(auto-detection mechanism):当全双工以太网端口电源启动时,它先与远端相连,并且与之进行协商.看是以10Mbps的速度还是以100Mbps的速度运行;再检查是否可以采用全双工模式,如果不行,则切换到半双工模式。
Ethernet at the Data Link Layer
4种类型的以太网帧:
1.Ethernet II
2.IEEE 802.2
3.IEEE 802.3
4.SNAP
协议数据单元(protocol data units,PDU):数据包括封装进去的信息在OSI参考模型每层的叫法:
1.Transport layer:segment
2.Network layer:packet或者datagram
3.Data Link layer:frame
4.Physical layer:bits(Written by 红头发,ChinaITLab BBS)
时间: 2005-1-8 23:46
作者: citycat
CCNA中文笔记第2章:Internet Protocols
作者:红头发
Chapter2 Internet Protocols
从全局模式退出到特权模式可以使用快捷键Ctrl+Z
Editing and Help Features
一些特写:
1.在命令行下输入?,将得到该模式下可以使用的命令列表以及其描述
2.假如你不确定1个命令是如何写的,比如你只记得是字母c开头,你可以输入c加1个?,将得到该模式下可以使用的所有命令:
Router#c?
clear clock configuration connect copy
Router#clock ?
set Set the time and date
4.router支持命令缩写,比如show可以缩写为sh,sho,但是假如你像如下那样输入了不完整的缩写,将得到错误提示:Ambiguous command
Router#sh te
% Ambiguous command: sh te
Router#sh te?
tech-support template terminal
一切其他的快捷键:
1.Ctrl+A:把光标快速移动到整行的最开始
2.Ctrl+E:把光标快速移动到整行的最末尾
3.Esc+B:后退1个单词
4.Ctrl+B:后退1个字符
5.Esc+F:前进1个单词
6.Ctrl+F:前进1个字符
7.Ctrl+D:删除单独1个字符
8.Backspace:删除单独1个字符
9.Ctrl+R:重新显示1行
10.Ctrl+U:擦除1整行
11.Ctrl+W:删除1个单词
12.Tab:自动补齐命令
13.Up arrow或者Ctrl+P:显示之前最后输入过的命令
14.Down arrow或者Ctrl+N:显示之前刚刚输入过的命令
其他的一些关于历史的命令:
1.show history:显示最后输入的10条命令,默认是10条,可以修改该值
2.terminal history size:修改显示最后输入过的的命令的数量,默认是10条,最大是256条
3.show terminal:显示命令历史缓存大小,如下:
Router#sh terminal
(略)
History is enabled,history size is 10
(略)
Router#terminal history size ?
<0-256> Size of history buffer
Router#terminal history size 25
Router#sh terminal
(略)
History is enabled,history size is 25
(略)
Gather Basic Routing Information
show version:显示系统硬件的基本配置和软件版本,以及配置文件的名字和来源,还有启动镜象,最后是configuration register的值
Router(config)#enable secret 123
Router(config)#enable secret 123
The enable password you have chosen is the same as your enable secret.This is not recommended.Re-enter the enable password
Router(config)#enable secret 321
如果VTY线路的密码没有设置,你将无法使用telnet来连上它
Auxiliary Password
配置AUX密码:
Router#conf t
Router(config)#line aux ?
<0-0> First line number
Router(config)#line aux 0
Router(config-line)#login
Router(config-line)#password 123
Console Password
配置console密码以及一些辅助命令:
Router#conf t
Router(config)#line console ?
<0-0> First line number
Router(config)#line console 0
Router(config-line)#login
Router(config-line)#password 123
Router(config-line)#exec-timeout ?
<0-35791> Timeout in minutes
Router(config-line)#exec-timeout 0 ?
<0-2147483> Timeout in seconds
Encryption Your Passwords
只有enable secret是加密的,当你在特权模式下输入sh running-config显示DRAM的配置文件时,其他密码将被罗列出来:
Router#sh run
(略)
!
enable secret jhdflkdfg$#sdf
enable password 123
!
(略)
对密码进行加密:在全局配置模式下使用service password-encryption命令
Banners
banner类似标语,问候语.最常用的是MOTD(message of the day),分界符用于分隔信息,但是分隔符不能出现在MOTD信息中,如下:
Router(config)#banner motd #
The Router is mine
#
Router(config)#^Z(Ctrl+Z)
Router#exit
Router con0 is now available
Press RETURN to get started
The Router is mine
Router>
配置router的接口,一般命令模式采用:interface type number的格式,比如:
Router(config)#int ethernet 0
但是Cisco的2600,3600,4000和7000等系列采用了物理卡槽和模块化的端口机制.因此,命令变化为:interface type slot/port,比如:
Router(config)#int fastethernet 0
% Imcomplete command
Router(config)#int fastethernet 0?
/
Router(config)#int fastethernet 0/?
<0-1> Fastethernet interface number
Router(config)#int fastethernet 0/1
配置连接器的介质类型,使用media-type命令,不过这个一般是自动检测,如下:
Router(config)#int fa 0/0
Router(config-if)#media-type ?
100BaseX Use RJ45 for -TX; SC F0 for –FX
MII Use MII connector
Bring Up an Interface
打开和关闭1个接口,分别使用shutdown和no shutdown命令,当你关闭某个接口的时候,使用sh interfaces命令可以查看接口状态,并且你将看到以下输出:
Router#sh int e0
Ethernet0 is administratively down,line protocol is down
(略)
接口是关闭的,所以你要手动打开它,如下:
Router#conf t
Router(config)#int e0
Router(config-if)#no shut
Router(config-if)#^Z
Router#sh int e0
Ethernet is up,line protocol is up
(略)
如果你需要在1个接口添加第二个子网地址,在末尾使用secondary参数,这将替换现有IP地址,如下:
Router(config)#int e0
Router(config-if)#ip address 172.16.20.2 255.255.255.0 secondary
Router(config-if)#^Z
来验证下:
Router#sh run
(略)
!
interface Ethernet0
ip address 172.16.20.2 255.255.255.0 secondary
ip address 172.16.10.2 255.255.255.0
!
Serial Interface Commands
Serial口一般是连接在CSU/DSU等类型的提供时钟频率的设备上.但是,假如你在个实验环境里采用了背对背配置,那么1端将作为DCE设备提供时钟频率.默认Cisco的router都是DTE,所以你必须让1个serial接口来提供时钟频率,采用的命令是:clock rate,如下:
Router(config)#int s0
Router(config-if)#clock rate ?
Speed (bits per second)
1200
(略)
56000
64000
(略)
Router(config-if)#clock rate 64000
% Error: This commands applies only to DCE interfaces
Router(config-if)#int s1
Router(config-if)#clock rate 64000
确定serial接口是否是DCE线缆使用sh controllers命令,如下:
Router>sh controllers s 0
HD unit 0, idb=0x297DE8, driver structure at 0x29F3A0
Buffer size 1524 HD unit 0, V.35 DCE cable
Cisco的router的默认serial连接带宽是T-1(1.544Mbps).有的路由协议要以带宽做为度来进行衡量,所以,我们给它配置带宽,使用bandwidth命令,注意参数单位是kb,如下:
Router(config-if)#bandwidth ?
<1-10000000> Bandwidth in kilobits
Router(config-if)#bandwidth 64
Hostnames
给router配置主机名,使用hostname命令,这个是本地标志,不影响router在Internet上的工作,注意回车立即生效,如下:
Router(config)#hostname Noko
Noko(config)#hostname Noco
Noco(config)#
Descriptions
description命令:本地标志,可以给接口加描述,以便用于区分,如下:
Noco(config)#int e0
Noco(config-if)#description Sales LAN
Noco(config-if)#^Z
来验证下:
Noco#sh int e0
(略)
Description: Sales LAN
(略)
Viewing and Saving Configurations
将running-config(DRAM)的文件复制到startup-config(NVRAM)里,使用copy running-config startup-config命令:
Noco#copy run start
可以使用erase startup-config命令删除startup-config文件,如下:
Noco#erase startup-config
(略)
Noco#sh start
%% Non-volatile configuration memory is not present
假如在这个情况下在特权模式使用reload命令重新启动router,将进入setup模式
show ip interface:提供router接口的层3信息,包括:
1.接口状态
2.IP地址和掩码
3.访问列表(access-list)信息
4.一些其他的基本的IP信息
Using the show ip interface brief Command
show ip interface brief:和show ip interface类似,只是提供简洁点的总结信息
Using the show controllers Command
sh controllers:显示物理接口的信息,还提供serial口线缆信息,如下:
Router#sh controllers serial 0/0
(略)
buffer size 1524 HD unit 0, V.35 DTE cable
(略)
Router#sh controllers serial 0/1
(略)
buffer size 1524 HD unit 1, V.35 DCE cable
(略)。(Written by 红头发,ChinaITLab BBS)
时间: 2005-1-8 23:52
作者: citycat
CCNA中文笔记第5章:IP路由
作者:红头发
Chapter5 IP Routing
Routing Basics
当主机A发送个IP包到主机B,目标MAC地址使用的是默认网关的以太网接口地址.这是因为帧不能放置在远端网络.
show ip route:查看路由表信息,比如:
Router#sh ip route
(略)
Gateway of last resort is not set
C 192.168.10.0/24 is directly connected, FastEthernet0/0
C 192.168.20.0/24 is directly connected, Serial 0/0
Router#
C代表的是:直接相连
验证配置好的路由信息,如下:
RouterA#sh ip route
(略)
R 192.168.50.0 [120/2] via 192.168.20.2, 00:00:23, Serial0/0
(略)
注意R代表的是RIP,[120/2]分别代表AD和度,在这里,度即为跳数.假如说你在这个信息里看到的是[120/15],那么下1跳为16,不可达,这条路由线路也将随之无效,将被丢弃
Holding Down RIP Propagation
如果你想阻止RIP更新信息传播到LANs和WANs上,可以使用passive-interface命令,这条命令可以防止RIP更新信息广播从你定义了的接口上发送出去,但是这个接口仍然可以接受到更新信息,如下:
RouterA(config)#router rip
RouterA(config-router)#network 192.168.10.0
RouterA(config-router)#passive-interface s 0/0
我们来验证下:
RouterA#sh ip route
(略)
I 192.168.50.0 [100/170420] via 192.168.20.2, Serial0/0
(略)
I代表IGRP[100/170420]为AD和复合度,度越低越好
Verifying Your Configurations
一些验证性的命令:
show protocols:显示所有的可路由协议和查看接口及其相关协议,如下:
RouterB#sh protocols
Gloabal values:
Internet Protocol routing is enabled
FastEthernet0 is up, line protocol is up
Internet Address is 192.168.30.1/24
Serial0/0 is up, line protocol is up
Internet Address is 192.168.20.2/24
Serial0/1 is up, line protocol is up
Internet Address is 192.168.40.1/24
RouterB#
show ip protocols:显示router上配置好了的路由协议,如下:
RouterB#sh ip protocols
Routing Protocols is “rip”
(略)
debug ip rip:发送控制台消息显示有关在router接口上收发RIP数据包的信息,关闭debug,使用undebug all或者no debug all命令,如下:
RouterB#debug ip rip
RIP protocol debugging is on
RouterB#
07:12:56: RIP: received v1 update from 192.168.40.2 on Serial0/1
07:12:56: 192.168.50.0 in 1 hops
(略)
RouterB#undebug all
All possible debugging has been turned off
RouterB#
debug ip igrp events:提供在网络中运行的IGRP路由选择信息的概要,关闭使用undebug ip igrp events或undebug all命令,如下:
RouterB#debug ip igrp events
IGRP event debugging is on
07:13:50: IGRP: received request from 192.168.40.2 on Serial0/1
07:13:50: IGRP: sending update to 192.168.40.2 via Serial1(192.168.40.1)
07:13:51: IGRP: Update contains 3 interior, 0 system, and 0 exterior routes
07:13:51: IGRP: Total route in update: 3
(略)
RouterB#un all
All possible debugging has been turned off
debug ip igrp transactions:显示来自相邻router要求更新的请求消息和由router发到相邻router的广播消息,关闭使用undebug all,如下:
RouterB#debug ip igrp transactions
07:14:05: IGRP: received request from 192.168.40.2 on Serial1
07:14:05: IGRP: sending update to 192.168.40.2 via Serial1(192.168.40.1)
07:14:05: subnet 192.168.30.0, metric=1100
07:14:05: subnet 192.168.20.0, metric=158250
(略)
RouterB#un all
All possible debugging has been turned off
RouterB#。(Written by 红头发,ChinaITLab BBS)
[M] Menus IP Configuration
Enter Selection:K
CLI session with the switch is open
To end the CLI session, enter [Exit].
>
而2950的启动,有点像router,先进入setup模式.但是默认你可以不对其进行配置,启动如下:
--- System Configuration Dialog ---
Would you like to enter the initial configuration dialog? [yes/no]: no
Press RETURN to get started!
00:04:53: %LINK-5-CHANGED: Interface Vlan1, changed state to administratively down
00:04:54: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
Switch>
1900下,输入K进入CLI,输入enable进入特权模式,再输入config t进入全局配置模式,如下:
>en
#config t
(config)#
当进入全局配置模式后,使用enable password命令配置登陆密码个启用密码,如下:
(config)#enable password ?
level Set exec level password
(config)#enable password level ?
<1-15> Level Number
level1为登陆密码,level15为启用密码,密码长度范围是4到8字符之间,如下:
(config)#enable password level 1 nocoluvsnoko
Error: Invalid password length.
Password must be between 4 and 8 characters
重配置并验证:
(config)#enable password level 1 noco
(config)#enable password level 15 noko
(config)#exit
#exit
2950下的配置和配置router有点类似,如下:
Switch>en
Switch#conf t
Switch(config)#line ?
<0-16> First Line number
console Primary terminal line
vty Virtual terminal
Switch(config)#line vty ?
<0-15> First Line number
Switch(config)#line vty 0 15
Switch(config-line)#login
Switch(config-line)#password noko
Switch(config-line)#line con 0
Switch(config-line)#login
Switch(config-line)#password noco
Switch(config-line)#exit
Switch(config)#exit
Switch#
2950下的配置和router类似,但是enable secret和enable passwor不可以设置成一样的,如下:
Switch(config)#enable password noko
Switch(config)#enable secret noko
The enable secret you have chosen is the same as your enable password.
This is not recommended. Re-enter the enable secret.
Switch(config)#enable secret noco
Switch(config)#
Setting the Hostname
给1900配置主机名,使用hostname命令,如下:
(config)#hostname Noko
Noko(config)#
给2950配置主机名,使用hostname命令,如下:
Switch(config)#hostname Noco
Noco(config)#
1900和2950的配置文件是存储在NVRAM里的,但是1900里你不能查看NVRAM或startup-config的内容,只能查看running-config的内容,在1900里,你对配置所进行的修改自动被复制到NVRAM里,所以没有copy run start这样的命令;但是2950就有startup-config和running-config,使用copy run start来保存配置到NVRAM里,擦除2950里startup-config文件使用erase startup-config命令;擦除1900里的使用delete命令.如下:
假如你有太多的VLAN,数量超过了router接口数量,明显上面的方法就不适用了.你可以使用Cisco的3层switch Cisco3550,或者使用router的快速以太网接口来做ISL或者802.1Q的 trunk link,这样的方法叫做单臂路由(router on a stick).如下图:
Configuring VLANs
创建VLAN:
1900下,使用vlan [vlan#] name [name] [vlan#]命令, 如下:
>en
#config t
(config)#hostname 1900
1900(config)#vlan 2 name sales
1900(config)#vlan 3 name marketing
1900(config)#vlan 4 name mis
1900(config)#exit
验证,使用show vlan命令,记住在你没给VLAN分配端口之前,之前做的VLAN是不会起作用的.而且所有的端口默认是处在VLAN1的,VLAN1是管理VLAN.如下:
1900#sh vlan
VLAN Name Status Ports
----------------------------------------------------------------------------
1 default Enable 1-12, AUI, A, B
2 sales Enable
3 marketing Enable
(略)
VLAN Name Status Ports
----------------------------------------------------------------------------
1 default active Fa0/1...Fa0/12
2 Marketing active
3 Accounting active
(略)
验证配置信息,如下:
2950#sh vlan brief
VLAN Name Status Ports
----------------------------------------------------------------------------
1 default active Fa0/1 Fa0/5...Fa0/12
2 Marketing active Fa0/2
3 Accounting active Fa0/3
(略)
Configuring Trunk Ports
1900只使用动态ISL(DISL)封装方式,在快速以太网配置trunk,在接口配置模式下使用trunk [参数]的命令,如下,将26接口设置为trunk端口:
1900(config)#int f0/26
1900(config-if)#trunk ?
auto Set DISL state to AUTO
desirable Set DISL state to DESIRABLE
nonegotiate Set DISL state to NONEGOTIATE
off Set DISL state to OFF
on Set DISL state to ON
1900(config-if)#trunk on
设置参数为on,即接口将作为永久ISL的trunk端口,可以和和相连的设备协商,并且把连接转换成trunk link
2950下在接口配置模式,使用switchport命令,如下:
2950(config)#int f0/12
2950(config-if)#switchport mode trunk
2950(config-if)#^Z
2950#
验证配置信息:
2950#sh run
(略)
!
interface FastEthernet0/12
switchport mode trunk
no ip address
!
(略)
Configuring Inter-VLAN Routing
1900下,在全局配置模式下使用vtp命令,如下:
1900(config)#vtp ?
client VTP client
domain Set VTP domain name
password Set VTP password
pruning VTP pruning
server VTP server
transparent VTP transparent
trap VTP trap
1900(config)#vtp server
1900(config)#vtp domain noco
1900(config)#vtp password noko
在特权模式下使用show vtp命令验证,如下:
1900#sh vtp
VTP version: 1
Configuration revision: 0
Maximum VLANs supported locally: 1005
Number of existing VLANs: 5
VTP domain name: noco
VTP password: noko
VTP operating mode: Server
(略)
2950如下:
2950(config)#vtp mode server
2950(config)#vtp domain noco
验证信息,如下:
2950#sh vtp ?
counters VTP statistics
status VTP domain status
2950#sh vtp status
(略)
Configuring Switching in Our Sample Internetwork
创建子接口,每个接口对应1个VLAN.注意,如果你试图在第一个子接口分配IP地址,将收到错误信息,除非你先定义了封装类型,如下:
Trunkrouter(config-if)#int f0/0.1
Trunkrouter(config-subif)#ip address 172.16.10.1 255.255.255.0
Configuring IP routing on a LAN subinterface is only allowed if that subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q, or ISL VLAN.
验证配置信息,如下:
Trunkrouter#sh run
(略)。(Written by 红头发,ChinaITLab BBS)