‘壹’ cisco交换机安全配置设定命令
cisco交换机安全配置设定命令大全
思科交换机的安全怎么设置,下面为大家分交换机安全设置的配置命令,希望对同学们学习思科交换机有所帮助!
一、交换机访问控制安全配置
1、对交换机特权模式设置密码尽量采用加密和md5 hash方式
switch(config)#enable secret 5 pass_string
其中 0 Specifies an UNENCRYPTED password will follow
5 Specifies an ENCRYPTED secret will follow
建议不要采用enable password pass_sting密码,破解及其容易!
2、设置对交换机明文密码自动进行加密隐藏
switch(config)#service password-encryption
3、为提高交换机管理的灵活性,建议权限分级管理并建立多用户
switch(config)#enable secret level 7 5 pass_string7 /7级用户进入特权模式的密码
switch(config)#enable secret 5 pass_string15 /15级用户进入特权模式的密码
switch(config)#username userA privilege 7 secret 5 pass_userA
switch(config)#username userB privilege 15 secret 5 pass_userB
/为7级,15级用户设置用户名和密码,Cisco privilege level分为0-15级,级别越高权限越大
switch(config)#privilege exec level 7 commands
/为7级用户设置可执行的命令,其中commands可以根据分配给用户的权限自行定义
4、本地console口访问安全配置
switch(config)#line console 0
switch(config-line)#exec-timeout 5 0 /设置不执行命令操作的超时时间,单位为分钟和秒
switch(config-line)#logging synchronous
/强制对弹出的干扰日志信息进行回车换行,使用户输入的命令连续可见
设置登录console口进行密码验证
方式(1):本地认证
switch(config-line)#password 7 pass_sting /设置加密密码
switch(config-line)#login /启用登录验证
方式(2):本地AAA认证
switch(config)#aaa new-model /启用AAA认证
switch(config)#aaa authentication login console-in group acsserver local
enable
/设置认证列表console-in优先依次为ACS Server,local用户名和密码,enable特权密码
switch(config)#line console 0
switch(config-line)# login authentication console-in
/调用authentication设置的console-in列表
5、远程vty访问控制安全配置
switch(config)#access-list 18 permit host x.x.x.x
/设置标准访问控制列表定义可远程访问的PC主机
switch(config)#aaa authentication login vty-in group acsserver local
enable
/设置认证列表vty-in, 优先依次为ACS Server,local用户名和密码,enable特权密码
switch(config)#aaa authorization commands 7 vty-in group acsserver local
if-authenticated
/为7级用户定义vty-in授权列表,优先依次为ACS Server,local授权
switch(config)#aaa authorization commands 15 vty-in group acsserver local
if-authenticated
/为15级用户定义vty-in授权列表,优先依次为ACS Server,local授权
switch(config)#line vty 0 15
switch(config-line)#access-class 18 in /在线路模式下调用前面定义的标准ACL 18
switch(config-line)#exec-timeout 5 0 /设置不执行命令操作的超时时间,单位为分钟和秒
switch(config-line)#authorization commands 7 vty-in /调用设置的授权列表vty-in
switch(config-line)#authorization commands 15 vty-in
switch(config-line)#logging synchronous
/强制对弹出的干扰日志信息进行回车换行,使用户输入的命令连续可见
switch(config-line)#login authentication vty-in
/调用authentication设置的vty-in列表
switch(config-line)#transport input ssh
/有Telnet协议不安全,仅允许通过ssh协议进行远程登录管理
6、AAA安全配置
switch(config)#aaa group server tacacs+ acsserver /设置AAA服务器组名
switch(config-sg-tacacs+)#server x.x.x.x /设置AAA服务器组成员服务器ip
switch(config-sg-tacacs+)#server x.x.x.x
switch(config-sg-tacacs+)#exit
switch(config)# tacacs-server key paa_string /设置同tacacs-server服务器通信的密钥
二、交换机网络服务安全配置
禁用不需要的各种服务协议
switch(config)#no service pad
switch(config)#no service finger
switch(config)#no service tcp-small-servers
switch(config)#no service udp-small-servers
switch(config)#no service config
switch(config)#no service ftp
switch(config)#no ip http server
switch(config)#no ip http secure-server
/关闭http,https远程web管理服务,默认cisco交换机是启用的
三、交换机防攻击安全加固配置
MAC Flooding(泛洪)和Spoofing(欺骗)攻击
预防方法:有效配置交换机port-security
STP攻击
预防方法:有效配置root guard,bpguard,bpfilter
VLAN,DTP攻击
预防方法:设置专用的native vlan;不要的接口shut或将端口模式改为access
DHCP攻击
预防方法:设置dhcp snooping
ARP攻击
预防方法:在启用dhcp snooping功能下配置DAI和port-security在级联上层交换机的trunk下
switch(config)#int gi x/x/x
switch(config-if)#sw mode trunk
switch(config-if)#sw trunk encaps dot1q
switch(config-if)#sw trunk allowed vlan x-x
switch(config-if)#spanning-tree guard loop
/启用环路保护功能,启用loop guard时自动关闭root guard
接终端用户的端口上设定
switch(config)#int gi x/x/x
switch(config-if)#spanning-tree portfast
/在STP中交换机端口有5个状态:disable、blocking、listening、learning、forwarding,只有处于forwarding状态的端口才可以发送数据。但需经过从blocking-->listening
15s,listening-->learning 15s,learning-->forwarding 20s
共计50s的时间,启用portfast后将直接从blocking-->forwarding状态,这样大大缩短了等待的时间。
说明:portfast仅适用于连接终端或服务器的交换机端口,不能在连接交换机的端口上使用!
switch(config-if)#spanning-tree guard root
/当一端口启用了root
guard功能后,当它收到了一个比根网桥优先值更优的.BPDU包,则它会立即阻塞该端口,使之不能形成环路等情况。这个端口特性是动态的,当没有收到更优的包时,则此端口又会自己变成转发状态了。
switch(config-if)#spanning-tree bpfilter enable
/当启用bpfilter功能时,该端口将丢弃所有的bp包,可能影响网络拓扑的稳定性并造成网络环路
switch(config-if)#spanning-tree bpguard enable
/当启用bpguard功能的交换机端口接收到bp时,会立即将该端口置为error-disabled状态而无法转发数据,进而避免了网络环路!
注意:同时启用bpguard与bpfilter时,bpfilter优先级较高,bpguard将失效!
广播、组播风暴控制设定
switch(config-if)#storm-control broadcast level 10 /设定广播的阀值为10%
switch(config-if)#storm-control multicast level 10 /设定组播的阀值为10%
switch(config-if)#storm-control action shutdown / Shutdown this interface
if a storm occurs
or switch(config-if)#storm-control action trap / Send SNMP trap if a storm
‘贰’ 思科三层交换机的详细配置命令是什么
三层交换机基本配置
【实验名称】
三层交换机端口配置。
【实验目的】
配置开启三层交换机的三层功能,实现路由作用。
【背景描述】
公司现有1台三层交换机,要求你进行测试,该交换机的三层功能是否工作正常
【技术原理】
三层交换机是在二层交换的基础上实现了三层的路由功能。三层交换机基于“一次路由,多次交换”的特性,在局域网环境中转发性能远远高于路由器。而且三层交换机同时具备二层的功能,能够和二层的交换机进行很好的数据转发。三层交换机的以太网接口要比一般的路由器多很多,更加适合多个局域网段之间的互联。
三层交换机的所有端口在默认情况下都属于二层端口,不具备路由功能。不能给物理端口直接配置IP地址。但可以开启物理端口的三层路由功能。
三层交换机默认开启了路由功能,可利用ip
routing命令进行控制。
【实现功能】
开启三层交换机物理端口的路由功能。
【实验设备】
S3550-24或S3550-48(1台),直连线(1条)
【实验步骤】
步骤1.
开启三层交换机的路由功能。
Switch>enable
Switch#configure
terminal
Switch(config)#hostname
S3550-24
S3550-24(config)#ip
routing
!开启三层交换机的路由功能
步骤2.
配置三层交换机端口的路由功能。
S3550-24(config)#interface
fastethernet
0/5
S3550-24(config-if)#no
switchport
!开启端口的三层路由功能
S3550-24(config-if)#ip
address
192.168.5.1
255.255.255.0
!
给端口配置IP地址
S3550-24(config-if)#no
shutdown
S3550-24(config-if)#end
步骤3.
验证、测试配置。
S3550#show
ip
interface
!查看接口状态信息
Interface
:
Fa0/5
Description
:
FastEthernet100BaseTX
0/5
OperStatus
:
up
!接口状态是UP
ManagementStatus
:
Enabled
Primary
Internet
address:
192.168.5.1/24
Broadcast
address
:
255.255.255.255
PhysAddress
:
00d0.f8ff.bd43
S3550#show
interfaces
f0/5
!查看接口状态信息
Interface
:
FastEthernet100BaseTX
0/5
Description
:
AdminStatus
:
up
!接口状态是UP
OperStatus
:
up
Medium-type
:
copper
Hardware
:
10/100BaseTX
Mtu
:
1500
LastChange
:
0d:0h:32m:49s
AdminDuplex
:
Auto
OperDuplex
:
Unknown
AdminSpeed
:
Auto
OperSpeed
:
Unknown
FlowControlAdminStatus
:
Off
FlowControlOperStatus
:
Off
Priority
:
0
Broadcast
blocked
:DISABLE
Unknown
multicast
blocked
:DISABLE
Unknown
unicast
blocked
:DISABLE
ARP
Timeout
:
3600
sec
Primary
Internet
address:
192.168.5.1/24
PhysAddress
:
00d0.f8ff.bd43
ManagementStatus:Enabled
Broadcast
address
:
255.255.255.255
主机测试:将PC1的IP地址设为192.168.5.2/24,在PC1上ping
192.168.5.1。
ping
192.168.5.1
Pinging
192.168.5.1
with
32
bytes
of
data:
Reply
from
192.168.5.1:
bytes=32
time<1ms
TTL=64
Reply
from
192.168.5.1:
bytes=32
time<1ms
TTL=64
Reply
from
192.168.5.1:
bytes=32
time<1ms
TTL=64
Reply
from
192.168.5.1:
bytes=32
time<1ms
TTL=64
Ping
statistics
for
192.168.5.1:
Packets:
Sent
=
4,
Received
=
4,
Lost
=
0
(0%
loss),
Approximate
round
trip
times
in
milli-seconds:
Minimum
=
0ms,
Maximum
=
0ms,
Average
=
0ms
【参考配置】
S3550-24#show
running-config
System
software
version
:
1.02
Build
Oct
17
2005
Release
Building
configuration...
Current
configuration
:
145
bytes
version
1.0
hostname
Switch
vlan
1
interface
FastEthernet
0/5
no
switchport
ip
address
192.168.5.1
255.255.255.0
!
end
‘叁’ 两台思科交换机堆叠如何配置
默认不需要配置就能堆叠成功,采用菊花链的方式连接。
switch01 stack port 01 --- switch02 stack port 02,
switch02 stack port 01 --- switch03 stack port 02,
switch03 stack port 01 --- switch01 stack port 02,
以此类推
‘肆’ 寻求思科4506交换机配置命令
1.在基于IOS的交换机上设置主机名/系统名:
switch(config)# hostname hostname
在基于CLI的交换机上设置主机名/系统名:
switch(enable) set system name name-string
2.在基于IOS的交换机上设置登录口令:
switch(config)# enable password level 1 password
在基于CLI的交换机上设置登录口令:
switch(enable) set password
switch(enable) set enalbepass
3.在基于IOS的交换机上设置远程访问:
switch(config)# interface vlan 1
switch(config-if)# ip address ip-address netmask
switch(config-if)# ip default-gateway ip-address
在基于CLI的交换机上设置远程访问:
switch(enable) set interface sc0 ip-address netmask broadcast-address
switch(enable) set interface sc0 vlan
switch(enable) set ip route default gateway
4.在基于IOS的交换机上启用和浏览CDP信息:
switch(config-if)# cdp enable
switch(config-if)# no cdp enable
为了查看Cisco邻接设备的CDP通告信息:
switch# show cdp interface [type modle/port]
switch# show cdp neighbors [type mole/port] [detail]
在基于CLI的交换机上启用和浏览CDP信息:
switch(enable) set cdp {enable|disable} mole/port
为了查看Cisco邻接设备的CDP通告信息:
switch(enable) show cdp neighbors[mole/port]
[vlan|plex|capabilities|detail]
太多了,一次写不完
‘伍’ 思科交换机详细配置方法和命令
思科交换机的基本配置命令学习
一、交换机口令设置:
switch>enable ;进入特权模式
switch#config terminal ;进入全局配置模式
switch(config)#hostname csico ;设置交换机的主机名
switch(config)#enable secret
csico1 ;设置特权加密口令
switch(config)#enable password csico8 ;设置特权非密口令
switch(config)#line console 0 ;进入控制台口
switch(config-line)#line vty 0 4
;进入虚拟终端
switch(config-line)#login ;虚拟终端允许登录
switch(config-line)#password
csico6 ;设置虚拟终端登录口令csico6
switch#exit ;返回命令
二、交换机显示命令:
switch#write ;保存配置信息
switch#show vtp ;查看vtp配置信息
switch#show run ;查看当前配置信息
switch#show
vlan ;查看vlan配置信息
switch#show interface ;查看端口信息
switch#show int f0/0
;查看指定端口信息
switch#show int f0/0 status;查看指定端口状态
switch#dir flash: ;查看闪存
Cisco路由器配置命令大全网络 2010-06-26 06:43:44 阅读657 评论0 字号:大中小 订阅 .
(1)模式转换命令
用户模式----特权模式,使用命令"enable"
特权模式----全局配置模式,使用命令"config
t"
全局配置模式----接口模式,使用命令"interface+接口类型+接口号"
全局配置模式----线控模式,使用命令"line+接口类型+接口号"
注:
用户模式:查看初始化的信息.
特权模式:查看所有信息、调试、保存配置信息
全局模式:配置所有信息、针对整个路由器或交换机的所有接口
接口模式:针对某一个接口的配置
线控模式:对路由器进行控制的接口配置
(2)配置命令
show running config 显示所有的配置
show
versin 显示版本号和寄存器值
shut down 关闭接口
no shutdown 打开接口
ip add +ip地址
配置IP地址
secondary+IP地址 为接口配置第二个IP地址
show interface+接口类型+接口号 查看接口管理性
show controllers interface 查看接口是否有DCE电缆
show history 查看历史记录
show
terminal 查看终端记录大小
hostname+主机名 配置路由器或交换机的标识
config memory
修改保存在NVRAM中的启动配置
exec timeout 0 0 设置控制台会话超时为0
service password-encryptin
手工加密所有密码
enable password +密码 配置明文密码
ena sec +密码 配置密文密码
line vty 0
4/15 进入telnet接口
password +密码 配置telnet密码
line aux 0 进入AUX接口
password
+密码 配置密码
line con 0 进入CON接口
password +密码 配置密码
bandwidth+数字 配置带宽
no ip address 删除已配置的IP地址
show startup config 查看NVRAM中的配置信息
run-config atartup config 保存信息到NVRAM
write 保存信息到NVRAM
erase
startup-config 清除NVRAM中的配置信息
show ip interface brief 查看接口的谪要信息
banner
motd # +信息 + # 配置路由器或交换机的描素信息
description+信息 配置接口听描素信息
vlan database
进入VLAN数据库模式
vlan +vlan号+ 名称 创建VLAN
switchport access vlan +vlan号
为VLAN为配接口
interface vlan +vlan号 进入VLAN接口模式
ip add +ip地址 为VLAN配置管理IP地址
vtp+service/tracsparent/client 配置SW的VTP工作模式
vtp +domain+域名 配置SW的VTP域名
vtp +password +密码 配置SW的密码
switchport mode trunk 启用中继
no vlan +vlan号
删除VLAN
show spamming-tree vlan +vlan号 查看VLA怕生成树议
三. 路由器配置命令
ip
route+非直连网段+子网掩码+下一跳地址 配置静态/默认路由
show ip route 查看路由表
show protocols
显示出所有的被动路由协议和接口上哪些协议被设置
show ip protocols 显示了被配置在路由器上的路由选择协议,同时给出了在路由选择协议中使用
的定时器
等信息
router rip 激活RIP协议
network +直连网段 发布直连网段
interface lookback 0 激活逻辑接口
passive-interface +接口类型+接口号 配置接口为被动模式
debug ip +协议 动态查看路由更新信息
undebug all 关闭所有DEBUG信息
router eigrp +as号
激活EIGRP路由协议
network +网段+子网掩码 发布直连网段
show ip eigrp neighbors 查看邻居表
show ip eigrp topology 查看拓扑表
show ip eigrp traffic 查看发送包数量
router
ospf +process-ID 激活OSPF协议
network+直连网段+area+区域号 发布直连网段
show ip ospf
显示OSPF的进程号和ROUTER-ID
encapsulation+封装格式 更改封装格式
no ip admain-lookup
关闭路由器的域名查找
ip routing 在三层交换机上启用路由功能
show user 查看SW的在线用户
clear line
+线路号 清除线路
四. 三层交换机配置命令
配置一组二层端口
configure terminal 进入配置状态
nterface range {port-range} 进入组配置状态
配置三层端口
configure terminal 进入配置状态
interface {{fastethernet | gigabitethernet} interface-id} | {vlan vlan-id} |
{port-
channel port-channel-number} 进入端口配置状态
no switchport
把物理端口变成三层口
ip address ip_address subnet_mask 配置IP地址和掩码
no shutdown 激活端口
例:
Switch(config)# interface gigabitethernet0/2
Switch(config-if)#
no switchport
Switch(config-if)# ip address 192.20.135.21 255.255.255.0
Switch(config-if)# no shutdown
配置VLAN
configure terminal 进入配置状态
vlan vlan-id 输入一个VLAN号, 然后进入vlan配态,可以输入一个新的VLAN号或旧的来进行修改
‘陆’ 思科交换机怎么给端口配置ip
1、在思科模拟器上找到Cisco 2960交换机一台,PC 2台,直通线若干条,进行连接配置。
注意事项:
交换机根据工作位置的不同,可以分为广域网交换机和局域网交换机。广域的交换机就是一种在通信系统中完成信息交换功能的设备,它应用在数据链路层。交换机有多个端口,每个端口都具有桥接功能,可以连接一个局域网或一台高性能服务器或工作站。实际上,交换机有时被称为多端口网桥。
‘柒’ Cisco交换机Trunk配置命令!
1.(config)#int
f0/0
//进入相应接口,如果是多个接口可以使用命令
int
range
f0/
0
-
n
2.(config-if)#switchport
trunk
encapsulation
{dot1q|isl
}//封装dot1q或者isl(isl为思科私有,dot1q是802.1q,通用)
3.(config-if)#switchport
mode
trunk
//配置端口为trunk类型
4.(config-if)#switchport
trunk
allowed
vlan
all
//trunk允许所有vlan的流量通过
注意:2和3顺序不可颠倒
‘捌’ 求答两台思科3750交换机堆叠的配置,有详细配置和讲解最好
堆叠有几个前提,ios要求一致,设备型号最好是一致
比如cisco3750g 和cisco3750x是不能做堆叠的
2台堆叠 A机的stack1 接 B机的stack2 A机的stack2 接 B 机的stack1
‘玖’ Packet Tracer 如何配置两台交换机堆叠(希望给出相关配置命令)
模拟器不能模拟堆叠,堆叠是要专门的堆叠线才可以
‘拾’ 两台思科交换机堆叠如何配置
堆叠需要在2台交换机上都加配置,1台配了,1台没配是无法堆叠的。
在添加配置的时候,可以指定优先级,用优先级来决定主备关系。如果不配置,则由交换机之间根据ip地址的大小来选举主机。
堆叠完成后,部分配置会重合,逻辑上2台已经“合体”了,堆叠配置就只保留一份,但如果继续堆叠,就需要在后进的交换机上继续配置,这个不是直接插上就好的技术。