交换机常用命令

交换机常用命令

设置端口类型:
speed-duplex {auto|force10-half|force10-full|
force100-half|force100-full|force100-fx|
{{force1g-half | force1g-full} [nonegotiate [master
|slave]]}}

端口隔离,配置上行端口:
switch(config)#isolate-port allowed e 0/0/25;26(其余为下行端口)(当某个或某些端口被配置成上行口后,可访问任意口,剩下的端口为下行口,下行口之间不可互访,但可以访问上行口。)

设置端口的速率:
bandwidth control <<62-1000000>kbps> [transmit/下载速度][receive/上传][both/双向](以交换机端口为参照物,对于用户要限制下载的速度时候就是限制transmit的速度)

开启流控:
Switch(Config)#interface ethernet 0/0/1-8
Switch(Config-Port-Range)#flow control
(当端口接收到的流量大于端口缓存所能容纳的大小时,
端口将通过算法或者协议通知向其发送流量的设备减慢发送速度,以防止丢包。)


ARP绑定:
在接口vlan 1 配置静态ARP。
Switch(Config-If-Vlan1)#arp 1.1.1.1 00-03-0f-f0-12-34 eth 0/0/2

mac地址表:
Switch(Config)#mac-address-table static address 00-03-0f-f0-00-18 vlan 200 interface  ethernet 0/0/5


端口的MAC 地址绑定功能:
接口模式:switchport port-security
接口模式:switchport port-security mac-address  <mac-address>

绑定端口下学习到的动态mac并转换成静态的
Switch(Config-Ethernet0/0/1)#switchport port-security lock
Switch(Config-Ethernet0/0/1)#switchport port-security convert

mac地址过滤:
mac-address-table blackhole mac-add vlan-id(表中的mac不会允许上网)

配置ARP静态表项:
在接口vlan 1配置静态ARP。
Switch(Config-if-Vlan1)#arp 1.1.1.1 00-03-0f-f0-12-34 interface eth 1/2

AM 配置命令:
Switch(Config)#am enable
Switch(Config)#interface Ethernet 0/0/1
Switch(Config-Ethernet0/0/1)#am port
Switch(Config-Ethernet0/0/1)#ip pool 192.1.1.2  9或
Switch(Config-Ethernet0/0/1)#mac-ip pool 00-01-10-22-33-10 192.1.1.2

ARP Guard 配置:
Switch(Config)#interface ethernet0/0/1(连接pc的交换机端口)
Switch(Config- Ethernet 0/0/1)# arp-guard ip 100.1.1.1

防ARP 扫描:
Switch(Config)#anti-arpscan enable
Switch(Config)#anti-arpscan port-based threshold 20
Switch(Config)#anti-arpscan port-based threshold 30
Switch(Config)#interface ethernet 0/0/5(上联口)
Switch(Config-if-ethernet 0/0/5)# anti-arpscan trust port

DHCP Snooping(动态的) 配置命令:
Switch(Config)#ip dhcp snooping enable
Switch(Config)#ip dhcp snooping binding enable
Switch(Config)#interface ethernet 0/0/1
Switch(Config- Ethernet 0/0/1)#ip dhcp snooping binding user-control
Switch(Config)#interface ethernet 0/0/24
Switch(Config- Ethernet 0/0/24)#ip dhcp snooping trust
Switch(Config-Ethernet0/0/22)#ip dhcp snooping action shutdown

DHCP Snooping(静态的) 配置命令:
Switch(Config)#ip dhcp snooping enable
Switch(Config)#ip dhcp snooping binding enable
Switch(Config)#ip dhcp snooping binding user 00-11-22-77-55-11 add 192.168.1.222 255.255.255.0 vlan 2 int e0/0/3
Switch(Config- Ethernet 0/0/24)#ip dhcp snooping trust

端口环路检测功能:
Switch(config)#loopback-detection interval-time 35 15
Switch (config)#interface ethernet 0/0/1(连接另一个交换网络的接口)
Switch (Config-If-Ethernet0/0/1)#loopback-detection control
Switch (Config-If-Ethernet0/0/1)#loopback-detection control block

MAC ACL 的设置:

Switch(Config)#access-list (1100-1199) deny 00-1e-8c-b1-2e-a3 ff-ff-ff-ff-ff-ff any-destination-mac ff-ff-ff-ff-ff-ff
Switch(Config)#int e0/0/20
Switch(Config-Ethernet0/0/20)#mac access-group 1101 in

MAC-IP ACL 的设置:
Switch(Config-MacIp-Ext-Nacl-ee)#deny 00-1e-8c-b1-2e-a3 ff-ff-ff-ff-ff-ff any-destination-mac ip any-source any-destination
Switch(Config)#int e0/0/20
Switch(Config-Ethernet0/0/20)#mac-ip access-group ee in

开启web界面管理:
ip http server
web-user admin password 0 admin

设置登录超时时间
Switch(Config)#exec timeout 6  分钟


时间设置:
DCRS-5200-28#clock set 12:52:54 2010.10.20
DCRS-5200-28#show clock

NTP功能配置:
Switch(config)#ntp enable
Switch(config)#ntp server 192.168.1.11


给交换机物理端口命名:
Switch(config)#int e1/2
Switch(config-if-ethernet1/2)#name cc
给交换机vlan命名:
Switch(config)#vlan 3333
Switch(config-vlan3333)#name dd

查看接口收发包:
Switch#show int ethernet counter packet


删除交换机三层接口
DCRS-5200-28(Config)#no interface vlan 3(只有在删除了三层接口的情况下才允许删除相应vlan(vlan3))


设置trunk口的native vlan:
Switch(Config)#interface ethernet 0/0/5
Switch(Config-ethernet0/0/5)#switchport mode trunk
Switch(Config-ethernet0/0/5)#switchport trunk native vlan 100
Switch(Config-ethernet0/0/5)#exit

你可能感兴趣的:(职场,休闲,交换机,交换机配置,交换机常用命令)