第一部分交换机配置
一、基础配置
1、模式进入
Switch>
Switch>en
Switch#config
Switch(Config)#interfaceethernet0/2
2、配置交换机主机名
命令:hostname<主机名>
3、配置交换机IP地址
Switch(Config)#interfacevlan1
Switch(Config-If-Vlan1)#ipaddress10.1.128.251255.255.255.0
Switch(Config-If-Vlan1)#noshut
4、为交换机设置Telnet授权用户和口令:
登录到Telnet的配置界面,需要输入正确的用户名和口令,否则交换机将拒绝该Telnet用户的访
问。该项措施是为了保护交换机免受非授权用户的非法操作。若交换机没有设置授权Telnet用户,则
任何用户都无法进入交换机的Telnet配置界面。因此在允许Telnet方式配置管理交换机时,必须在
Cole的全局配置模式下使用命令usernameprivilege[password(0|7)
]为交换机设置Telnet授权用户和口令并使用命令authenticationlinevtyloginlocal打开本
地验证方式,其中privilege选项必须存在且为15。
例:Switch>enable
Switch#config
Switch(config)#usernametestprivilege15password0test
Switch(config)#authenticationlinevtyloginlocal
Switch(Config)#telnet-usertestpassword0test
Switch(Config)#telnet-serverenable://启动远程服务功能
5、配置允许Telnet管理交换机的地址限制(单独IP或IP地址段)
(1)限制单个IP允许Telnet登录交换机
switch(config)#authenticatiecurityip192.168.1.2
(2)限制允许IP地址段Telnet登录交换机
switch(config)#access-list1permit192.168.1.00.0.0.255
switch(config)#authenticationipaccess-class1in
5、为交换机设置Web授权用户和口令:web-user<用户名>password{0|7}<密码>
例:Switch(Config)#web-useradminpassword0digital
6、设置系统日期和时钟:clockset
7、设置退出特权用户配置模式超时时间
exectimeout//单位为分钟,取值范围为0~300
8、保存配置:write
9、显示系统当前的时钟:Switch#showclock
10、指定登录用户的身份是管理级还是访问级
Enable[level{visitor|admin}[<密码>]]
11、指定登录配置模式的密码:Enablepasswordlevel{visitor|admin}
页1
12、配置交换机的用户名密码:usernameadminprivilege15password0admin000
13、配置enable密码为ddd:enablepassword0dddlevel15
14、配置登录时认证:authenticationlinevtyloginlocal
15、设置端口的速率和双工模式(接口配置模式下)
命令:speed-duplex{auto|force10-half|force10-full|force100-half|force100-full|
{
{force1g-half|force1g-full}[nonegotiate[master|slave]]}}
nospeed-duplex
二、单交换机VLA划分
1、VLA基本配置
(1)新建VLA:vlan
(2)命名VLA:name
(3)为VLA分配交换机端口
Switch(Config-If-Vlan1)#switchportinterfaceEthernet0/2
(4)设置Trunk端口允许通过VLA:
Switch(Config-ethernet0/0/5)#switchporttrunkallowedvlan1;3;5-20
2、划分VLA:
(1)进入相应端口:Switch(config)#interfaceEthernet0/2
(2)修改模式:Switch(Config-ethernet0/0/5)switchportmodeaccess
(3)划分VLA:Switch(Config-ethernet0/0/5)#switchportaccessvlan4
三、跨交换机VLA划分(两台交换机作相同操作)
1、新建VLA
2、划分VLA
3、修改链路模式
(1)进入相应端口:Switch(config)#interfaceEthernet0/1
(2)修改模式:Switch(config-if)#switchportmodetrunk
四、VLA间主机的通信
1、新建VLA
2、划分VLA
3、修改链路模式
(1)进入相应端口:Switch(config)#interfaceEthernet0/1
(2)修改模式:Switch(config-if)#switchportmodetrunk
注意:如果是三层交换机,在修改模式先封装802.1协议:
Switch(config-if)#switchporttrunkencapsulationdot1q
4、建立VLA子接口
(1)、进入VLA接口模式:Switch(config)#interfacevlan2
(2)、设置VLA子接口地址:Switch(config-if)#ipaddress192.168.0.1255.255.255.0
(3)、打开端口:Switch(config-if)#noshutdown
5、设置各主机IP地址、子网掩码、网关
注意:(1)各主机IP地址应与其所在的VLA在同一网段。
(2)192.168.0.1/24中的“24”表示子网掩码为3个255。
(3)主机所在的VLA的子接口地址就是主机的网关。
页2
五、端口安全配置
1、启用和禁用端口安全功能:
启用:Switch(config-if)#switchportport-security
禁用:Switch(config-if)#noswitchportport-security
2、设置接口上安全地址的最大个数(1~128)
Switch(config-if)#switchportport-securitymaximum1
3、设置处理违例的方式
Switch(config-if)#switchportport-securityviolatihutdown
4、手工配置接口上的安全地址
Switch(config-if)#switchportport-securitymac-address00d0.d373.B060
5、查看安全配置:
Switch#showport-security
六、设置广播风暴抑制功能
Switch(Config)#broadcast-suppression
参数:代表每秒钟允许通过的广播数据报的个数,取值范围为1~262143。
七、端口聚合
1、创建portgroup:Switch(Config)#port-group1//数字范围1-16
2、把物理端口加入组:Switch(Config-Ethernet0/0/1)#port-group1modeon
3、进入port-channel配置模式:Switch(Config)#interfaceport-channel1
4、修改链路模式:switchportmodetrunk
第二部分路由器配置
一、路由器基本配置
1、进入特权模式:Router>en
2、进入全局配置模式:Router#config
3、定义路由器的名字为DCR:Router(Config)#hostnameDCR
4、特权用户的口令:DCR(Config)#enablepassword123456
5、启动远程服务功能:DCR(Config)#telnet-serverenable
6、配置远程用户的口令:DCR(Config)#telnetadminpassword7admin
7、配置时钟频率:Router(Config-Serial2/0)#physical-layerspeed64000
8、配置用户登录路由器时认证:aaaauthenticationlogindefaultlocallineenable
9、配置进入特权模式时认证:aaaauthenticationenabledefaultenable
10、配置路由器的用户名密码:usernameadminpassword0admin000
11、配置进入特权模式密码:enablepassword0admin000level15
页3
二、静态路由配置
1、命令:iproute<目的IP><子网掩码>{<接口名称>|<下一跳IP地址>}[<路由优先级>]
为路由优先级,取值范围为1~255,preference的值越小优先级越高。
Router(config)#iproute1.1.1.0255.255.255.02.1.1.1
2、默认路由
iproute0.0.0.00.0.0.0{<接口名称>|<下一跳IP地址>}[<路由优先级>]
三、单臂路由
1、打开端口:
2、进入子接口配置IP地址,并封装dot1q协议到对应的VLA。
Router_config#inte

最低0.47元/天 解锁文章
3249





