配置命令
交换机之间用交叉线
1进入特权模式:Switch>enable
2配置模式Switch#config
3配置主机名:Switch(config)#hostname S1
4.设置访问口令S1#configure terminal
S1(config)#line console 0
S1(config-line)#password cisco
S1(config-line)#login
S1(config-line)#line vty 0 15
S1(config-line)#password cisco
S1(config-line)#login
S1(config-line)#exit
5.将使能加密口令设置为class。
S1(config)#enable secret class
S1(config)#配置默认网关
6.在虚拟接口vlan99设置交换机ip地址
S1(config)#interface vlan99
S1(config-if)#
S1(config-if)#no shutdown
S1(config-if)#exit
7.交换机VLAN 分配端口
S1(config)#interface fa0/1
S1(config-if)#switchport mode access
S1(config-if)#switchport access vlan 99
S1(config-if)#exit
8.给vlan命名
S1(config)#vlan 10
S1(config-vlan)#name Faculty/Staff
S2.S3.本征vlan即分配端口 s2.s3连接s1 使用中继vlan S1中继vlan S1(config)#interface FastEthernet 0/1
S1(config-if)#switchport mode trunk
S1(config-if)#switchport trunk native vlan 99
9..设置交换机默认网关
S1(config)#
S1(config)#exit
10..配置快速以太网接口的端口速率和双工设置。
S1#configure terminal
S1(config)#interface fastethernet 0/18
S1(config-if)#speed 100
S1(config-if)#duplex full
S1(config-if)#end
11.清除mac地址表S1#clear mac-address-table dynamic
12.设置静态MAC 地址。
S1(config)#
13.在接入端口上配置端口安全性。
配置交换机端口FastEthernet 0/18 仅接受两台设备,动态学习这些设备的MAC 地址,并在发生安全违规事件时关闭端口。
S1(config-if)#switchport mode access
S1(config-if)#switchport port-security
S1(config-if)#switchport port-security maximum 2
S1(config-if)#switchport port-security mac-address sticky
S1(config-if)#switchport port-security violation shutdown
S1(config-if)#exit
14.配置并测试MOTD 标语。
配置当天消息(MOTD),文本使用?Authorized Access Only(仅限授权访问)。
标语文本区分大小写。
请勿在标语文本前后添加空格。
在标语文本前后使用定界符指示文本从何处开始,到何处结束。
下例中使用的定界符为?&,但是您可以使用标语文本中未使用的任何字符。
配置完MOTD 后,从交换机注销,然后再次登录,检查是否显示了上述标语。
S1(config)#banner motd &Authorized Access Only&
S1(config)#end [or exit]
S1#exit
15.首先必须启用端口安全性,方能在接口上使用其它端口安全性命令。
启用18号端口安全性
S1(config-if)#interface fa0/18
S1(config-if)#switchport port-security
Show
1.Show vlan 看默认vlan 配置
2.发出?show running-config?命令,检查当前的运行配置
3.发出?show startup-config?命令,检查当前NVRAM 的内容
4.发出?show interface vlan1?命令,检查虚拟接口VLAN1 的特征
5.现在使用?show ip interface vlan1?命令查看该接口的IP 属性
6.使用?show version?命令显示Cisco IOS 信息
7.使用?show interface fastethernet 0/18?命令检查PC1 所用快速以太网接口的默认属性。
8.在特权执行模式下使用?show mac-address-table?命令显示MAC 地址
9.创建VLAN 后,返回特权执行模式并发出?show vlan brief?命令,检查新VLAN 是否创建成功。
其他命令
删除vlan数据库信息Switch#delete flash:vlan.dat
从NVRAM中删除交换机启动配置文件Switch#erase startup-config
在特权执行模式提示符下,输入?reload?命令开始这一过程。
Switch#reload
要把运行配置文件的内容保存到非易失性RAM (NVRAM),请发出命令?copy
running-config startup-config。
Switch#copy running-config startup-config
第四章
1.vtp默认配置: show vtp status
2.S1 将成为VTP 服务器。
将S1 设置为服务器模式。
S1(config)#vtp mode server
Device mode already VTP SERVER.
3. 将S1 的VTP 域名配置为CCNA。
请记住,VTP 域名区分大小写。
S1(config)#vtp domain CCNA
Changing VTP domain name from NULL to CCNA
4. 将S1 的VTP 域口令配置为cisco。
请记住,VTP 域口令区分大小写。
S1(config)#vtp password cisco
Setting device VLAN database password to cisco
S1(config)#
5.配置主辅银桥
S1 (config): spanning-tree vlan 1 root primary
S1(config): spanning-tree vlan 1 root secondary
6.配置桥的优先级
S1 (config):spanning-tree vlan 1 priority 4096
7.检验网桥优先级
Show spanning-tree
8.
使用802.1Q 封装配置子接口。
在R1 上创建两个子接口:Fa0/1.10 和Fa0/1.30。
将这两个子接口分配到不同的VLAN。
要创建第一个子接口,请发出interface fa0/1.10 命令进入Fa0/1.10 的子接口配置模式。
请留意,路由器的命令提示符会更改。
在子接口配置模式下发出encapsulation dot1Q 10 命令,将封装类型设置为802.1Q 并将VLAN 10 分配给该虚拟接口。
为端口分配正确的IP 地址。
Fa0/1.10 的IP 地址应为,子网掩码为。
使用正确的IP 地址和VLAN ID 对Fa0/1.30 接口重复上述步骤。
R1(config)#interface fa0/1.10
R1(config-subif)#encapsulation dot1Q 10
R1(config-subif)#interface fa0/1.30
R1(config-subif)#encapsulation dot1Q 30
任务2:将PPP 配置为封装方法。
步骤1. 将R1 配置为与R2 之间使用PPP 封装。
R1(config)#interface serial0/0/0
R1(config-if)#encapsulation ppp
步骤1. 将ISP 配置为与R2 之间使用HDLC 封装。
ISP(config)#interface serial0/0/0
ISP(config-if)#encapsulation hdlc
ISP(config-if)#no shutdown
步骤1. 将ANSI 配置为R1、R2 和R3 上的LMI 类型。
对每台路由器的串行接口输入下列命令。
R1(config-if)#interface s0/0/0
R1(config-if)#frame-relay lmi-type ansi。