思科 2950 交换机相关配置 <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />



基本操作

2950(config)#int vlan1 
   
 
  
2950(config-if)#ip address 192.168.1.100 255.255.255.0  
   ( 
   VLAN1 
   里面设置 
   IP 
   地址 
   ) 
    
   
 
  
2950(config)#ip default-gateway 192.168.1.1           ( 
   设置默认网关 
   ) 
   
 
  
2950(config)#ip name-server 192.168.1.1               
   ( 
   设置域名服务器 
   ) 
    
   
 
  
2950(config)#ip domain-name wqs.com                 
   ( 
   设置域名 
   )

 



端口配置


2950(config)#int f0/1       ( 
   进入接口 
   ) 
   
 
  
2950(config-if)#speed 100   
   ( 
   设置该接口速率为 
   100Mb/s 
   ) 
    
   
 
  
2950(config-if)#duplex ?     
   
 
  
 
   
 
 
  
auto                    Enable AUTO duplex configuration 
   
 
  
full                    Force full duplex operation 
   
 
  
half                    Force half-duplex operation2950(config-if)#description to_router1 
   
 
  
2950(config-if)#description to_router1       
   ( 
   设置端口描述 
   ) 
    
   
 
  
2950#show interfaces fastethernet1 [status]  
   ( 
   查看端口配置结果和状态 
   )

 



MAC 地址表相关命令



2950(config)#mac-address-table aging-time 100                    ( 
   设置超时时间为 
   100S) 
   
 
  
2950(config)#mac-address-table permanent <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />000.0c01.bbcc f0/3           ( 
   加入永久地址 
   ) 
   
 
  
2950(config)#mac-address-table restricted static 0000.0c02.bbcc f0/6 f0/7   ( 
   加入静态地址 
   ) 
   
 
  
2950#show mac-address-table                                  
   ( 
   查看整个 
   MAC 
   地址表 
   ) 
    
   
 
  
2950#clear mac-address-table restricted static                  
   ( 
   清除限制性 
   MAC 
   址表 
   )



 VTP 的配置



2950#vlan database                            
   ( 
   进入 
   VLAN 
   配置模式 
   ) 
    
   
 
  
2950(vlan)#vtp ?                               
   ( 
   查看 
   VTP 
   的子命令 
   ) 
    
   
 
  
domain                  Set the name of the VTP administrative domain. 
   
 
  
client                  Set the device to client mode. 
   
 
  
server                  Set the device to server mode. 
   
 
  
transparent             Set the device to transparent mode. 
   
 
  
password                Set the password for the VTP administrative domain. 
   
 
  
2950(vlan)#vtp domain server   
   ( 
   设置本交换机为 
   SEVER 
   模式 
   ) 
    
   
 
  
2950(vlan)#vtp domain wqs     
   ( 
   设置域名 
   ) 
    
   
 
  
2950(vlan)#vtp pruning         ( 
   启动修剪模式 
   ) 
   
 
  
2950#show vtp status           
   (查看 
   VTP 
   设置信息) 
    
   
 
  
 
   
 
 
  
配置 
   VLAN TRUNK 
   端口 
    
   
 
  
 
   
 
 
  
2950(config)#int f0/11              
   ( 
   进入 
   F 
   端口 
   ) 
    
   
 
  
2950(config-if)#switchport mode trunk  
   ( 
   设置该端口为 
   TRUNK 
   模式 
   ) 
    
   
 
  
2950(config-if)#switchport trunk encapsulation {dot1q | isl | negotiate } 
   ( 
   设置 
   TRUNK 
   封装 
   ) 
    
   
 
  
 
   
 
 
  
创建 
   VLAN 
   
 
  
 
   
 
 
  
2950#vlan database                    
   ( 
   进入 
   VLAN 
   配置模式 
   ) 
    
   
 
  
2950(vlan)#vlan 2                      
   ( 
   创建 
   VLAN 2 
   ) 
    
   
 
  
VLAN 2 added: 
   
 
  
    Name:VLAN0002                   
   ( 
   系统默认名 
   ) 
    
   
 
  
2950(vlan)#vlan 3 name wg_bisheng        
   ( 
   创建 
   VLAN 3 
   , 
   名为网工必胜 
   ) 
    
   
 
  
VLAN 3 added: 
   
 
  
    Name:wg_bisheng 
   
 
  
2950(config)#int f0/9                      
   ( 
   进入接口配置模式 
   ) 
    
   
 
  
2950(config-if)#switchport mode access        
   ( 
   设置该接口为 
   ACCESS 
   模式 
   ) 
    
   
 
  
 
   
 
 
  
2950(config-if)#switchport access vlan 2    
   ( 
   把端口 
   9 
   分配给 
   VLAN2 
   ) 
    
   
 
  
2950(config-if)#int f0/8 
   
 
  
2950(config-if)#switchport mode access 
   
 
  
2950(config-if)#switchport access vlan 3 
   
 
  
2950(config-if)#exit



 



 



 


转载于:https://blog.51cto.com/markcin/160115