思科2950配置

  • 格式:txt
  • 大小:8.54 KB
  • 文档页数:4

配置Cisco2950交换机
一.CISCO2950交换机的基本配置
Switch>
Switch>enable 进入特权执行模式
Switch#
Switch#show running-config 列出运行配置清单
Switch#config terminal 进入配置模式
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#
Switch(config)#enable password cisco 设置enable口令
Switch(config)#enable secret cisco1 设置enable密码
Switch(config)#hostname c2950 设置主机名
c2950(config)#interface VLAN 1 进入VLAN 1的配置模式
c2950(config-if)#ip address 192.168.1.2 255.255.255.0
c2950(config-if)#no shut 保存配置
c2950(config-if)exit 退出
c2950(config)#ip default-gateway 192.168.1.10 设置缺省网关
c2950(config)#ip domain-name 设置域名
c2950(config)#ip name-server 202.1.1.1 202.1.1.2 设置域名服务器地址
c2950(config)#^Z
c2950#show version 查看版本信息
c2950#show interface VLAN 1 查看VLAN 1的配置和统计信息

二.配置CISCOc2950交换机的端口属性
c2950(config)#interface fastEthernet 0/1进入子接口配置模式
c2950(config-if)
c2950(config-if)#speed ?
10 Force 10 Mbps operation
100 Force 100 Mbps operation
auto Enable AUTO speed configuration
c2950(config-if)#speed 100 设置端口速率为100Mbit/s
c2950(config-if)#duplex ?
auto Enable AUTO duplex configuration
full Force full duplex operation
half Force half-duplex operation
c2950(config-if)#duplex full 设置端口为全双工
c2950(config-if)description TO_PC1 端口描述
c2950(config)#^Z
c2950#show interface fastEthernet 0/1
c2950#show interface fastEthernet 0/1 status
c2950#show interface fastEthernet 0/1 description

三.配置 VTP.VLAN和VLAN Trunk
两台2950交换机:c2950A,c2950B
(1)配置c2950A交换机的VTP和VLAN
c2950A#vlan database 进入VLAN配置模式
c2950A(vlan)#vtp ?
client Set the device to client mode.
domain Set the name of the VTP administrative domain.
password Set the password for the VTP administrative domain.
pruning Set the administrative domain to permit pruning.
server Set the device to server mode.
transparent Set the device to transparent mode.
v2-mode Set the administrative domain to V2 mode
c2950A(vlan)#vtp server 设置VTP模式
Device mode already VTP SERVER
c2950A(vlan)#vtp domain test 设置VTP域名
Changing VTP domain name from NULL to test
c2950A(vlan)#vlan 10 name v10 定义VLAN
VLAN 10 added:
Name: v10
c2950A(vlan)#
c2950A(vlan)#vlan 11 name v11
VLAN 11 added:
Name: v11
c2950A(vlan)#vlan 12 name v12
VLAN 11 added:
Name: v12
c2950A(vlan)#vlan 13 name v13
VLAN 13 added:
Name: v13
c2950A(vlan)#exit
APPLY completed.
Exiting....
c2950A#show vtp status 查看VTP状态
c2950A#show vtp counters 查看VTP统计数据
c2950A(config)#interface fastEthernet 0/1
c2950A(c

onfig-if)#switchport mode access设置静态VLAN访问模式
c2950A(config-if)#switchport acces vlan 10配置VLAN的归属
c2950A(config-if)#exit
c2950A(config)#interface fastEthernet 0/2
c2950A(config-if)#switchport mode access
c2950A(config-if)#switchport acces vlan 11
c2950A(config)#interface fastEthernet 0/3
c2950A(config-if)#switchport mode access
c2950A(config-if)#switchport acces vlan 12
c2950A(config)#interface fastEthernet 0/4
c2950A(config-if)#switchport mode access
c2950A(config-if)#switchport acces vlan 13
c2950A(config-if)#^Z
c2950A#show vlan 查看VLAN信息
c2950A#show vlan brief以简捷的形式查看VLAN信息
(2)配置c2950B交换机的VTP
c2950B(config)#interface vlan 1
c2950B(config-if)#ip address 192.168.1.1 255.255.255.0
c2950B(config-if)#no shut
c2950B(config)#^Z
c2950B#vlan database
c2950B(vlan)#vtp domain test 设置VTP域名
Changing VTP domain name from NULL to test
c2950B(vlan)#vtp client
Setting device to VTP CLIENT mode.
c2950B(vlan)#exit
APPLY completed.
Exiting....
c2950B#

(3)配置和监测C2950A和C2950B交换机之间VLAN trunk
c2950A
c2950A(config)#interface fastEthernet 0/24
c2950A(config)#switchport mode trunk 把端口设置成trunk模式
c2950A(config-if)#^Z
c2950A#show interface fastEthernet 0/24 查看相应端口的交换属性

c2950B
c2950B(config)#interface fastEthernet 0/24
c2950B(config)#switchport mode trunk 把端口设置成trunk模式
c2950B(config-if)#^Z
c2950B#show interface fastEthernet 0/24 查看相应端口的交换属性
(4)在c2950B上查看VTP和VLAN信息
c2950B#show vtp status 查看VTP状态
c2950B#ping 192.168.1.1
一、基于端口的MAC地址绑定
思科2950交换机为例,登录进入交换机,输入管理口令进入配置模式,敲入命令:
Switch#c onfig terminal
进入配置模式
Switch(config)# Interface fastethernet 0/1
#进入具体端口配置模式
Switch(config-if)#Switchport port-secruity
#配置端口安全模式
Switch(config-if )switchport port-security mac-address MAC(主机的MAC地址)
#配置该端口要绑定的主机的MAC地址
Switch(config-if )no switchport port-security mac-address MAC(主机的MAC地址)
#删除绑定主机的MAC地址
二、基于MAC地址的扩展访问列表
Switch(config)Mac access-list extended MAC
#定义一个MAC地址访问控制列表并且命名该列表名为MAC
Switch(config)permit host 0009.6bc4.d4bf any
#定义MAC地址为0009.6bc4.d4bf的主机可以访问任意主机
Switch(config)permit any host 0009.6bc4.d4bf
#定义所有主机可以访问MAC地址为0009.6bc4.d4bf的主机
Switch(config-if )interface Fa0/20
#进入配置具体端口的模式
Switch(config-if )mac access-group MAC in
#在该端口上应用名为MAC的访问列表(即前面我们定义的访问策略)
Switch(config)no mac access-list extended MAC
#清除名为MAC的访问列表
三、IP地址

的MAC地址绑定
只能将应用1或2与基于IP的访问控制列表组合来使用才能达到IP-MAC 绑定功能。
Switch(config)Mac access-list extended MAC
#定义一个MAC地址访问控制列表并且命名该列表名为MAC
Switch(config)permit host 0009.6bc4.d4bf any
#定义MAC地址为0009.6bc4.d4bf的主机可以访问任意主机
Switch(config)permit any host 0009.6bc4.d4bf
#定义所有主机可以访问MAC地址为0009.6bc4.d4bf的主机
Switch(config)Ip access-list extended IP
#定义一个IP地址访问控制列表并且命名该列表名为IP
Switch(config)Permit 192.168.0.1 0.0.0.0 any
#定义IP地址为192.168.0.1的主机可以访问任意主机
Permit any 192.168.0.1 0.0.0.0
#定义所有主机可以访问IP地址为192.168.0.1的主机
Switch(config-if )interface Fa0/20
#进入配置具体端口的模式
Switch(config-if )mac access-group MAC1in
#在该端口上应用名为MAC的访问列表(即前面我们定义的访问策略)
Switch(config-if )Ip access-group IP in
#在该端口上应用名为IP10的访问列表(即前面我们定义的访问策略)
Switch(config)no mac access-list extended MAC
#清除名为MAC的访问列表
Switch(config)no Ip access-group IP in
#清除名为IP的访问列表

在cisco交换机中为了防止ip被盗用或员工乱改ip,可以做以下措施,即ip与mac地址的绑定和ip与交换机端口的绑定。
一、通过IP查端口
先查Mac地址,再根据Mac地址查端口:
bangonglou3#show arp include 208.41 或者show mac-address-table 来查看整个端口的ip-mac表
Internet 10.138.208.41 4 0006.1bde.3de9 ARPA Vlan10
bangonglou3#show mac-add in 0006.1bde
10 0006.1bde.3de9 DYNAMIC Fa0/17
bangonglou3#exit
二、ip与mac地址的绑定,这种绑定可以简单有效的防止ip被盗用,别人将ip改成了你绑定了mac地址的ip后,其网络不同,(tcp/udp协议不同,但netbios网络共项可以访问),具体做法:
cisco(config)#arp 10.138.208.81 0000.e268.9980 ARPA
这样就将10.138.208.81 与mac:0000.e268.9980 ARPA绑定在一起了
三、ip与交换机端口的绑定,此种方法绑定后的端口只有此ip能用,改为别的ip后立即断网。有效的防止了乱改ip.
cisco(config)# interface FastEthernet0/17
cisco(config-if)# ip access-group 6 in
cisco(config)#access-list 6 permit 10.138.208.81
这样就将交换机的FastEthernet0/17端口与ip:10.138.208.81绑定了。

#password xxxxxx

#login

#exit

#username name password xxxxxx

#login local(telnet 显示是用户名和密码)

设置enable密码:

#enable password xxxxxx(明文显示)

#enable secret xxxxxx(密文显示)

所有密码使用密文显示:

#service password-encryption

2.ip 地址配置

#int vlan 1

#ip address 192.168.1.25

4 255.255.255.0(管理IP)

3.vlan 配置

#vlan database

#vlan 100 name test100

#end

4.把端口加入到VLAN中

#int fa0/x

#switchport mode access

#switchport access vlan 100

#end

5.把FA0/1 加入到TRUNK

#int fa0/1

#switchport mode trunk

#end

6.组端口配置

#int rang fa0/10 – 24

#switchport mode access

# spanning-tree portfast

所有端口快速启动,可以由原来30秒缩短为5秒,但只能用在连接单台机器,不能用于连接HUB,Switch等设备,否则容易产生环路。

switchport access vlan 100

end



7.端口安全(绑定MAC)

#int fa0/10

#switchport port-security mac-address xxx.xxx.xxxx


下载文档原格式

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