交换机常用命令
host主机名配置
Switch#configure terminal Switch(config)#hostname S1 S1(config)#
禁用dns查询
Switch#configure terminal
Switch(config)#no ip domain-lookup
vlan 配置
创建vlan
Switch(config)#vlan 2 Switch(config-if)#end Switch#
vlan ip 配置
Switch(config)#interface vlan 2 Switch(config-if)#ip address 192.168.2.1 255.255.255.0 Switch(config-if)#no shutdown Switch(config-if)#exit Switch(config)# Switch(config)#interface vlan 3 Switch(config-if)#ip address 192.168.3.1 255.255.255.0 Switch(config-if)#no shutdown Switch(config-if)#exit Switch(config)# Switch(config)#end Switch#show ip route Default gateway is not set Host Gateway Last Use Total Uses Interface ICMP redirect cache is empty Switch#
设置接口为access模式
设置接口为access模式,并加入vlan 10
S1(config)#inter fastEthernet 0/10 S1(config-if)#switchport mode access S1(config-if)#switchport access vlan 10 % Access VLAN does not exist. Creating vlan 10 S1(config-if)#no shutdown S1(config-if)#end S1#
设置接口为tag vlan模式
Switch(config)#interface fastEthernet 0/23 Switch(config-if)#switchport trunk encapsulation dot1q Switch(config-if)#switchport mode trunk Switch(config-if)#exit Switch(config)#
三层交换机开启路由功能
Switch#configure terminal Switch(config)#ip routing Switch(config)#end Switch#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set C 192.168.2.0/24 is directly connected, Vlan2 C 192.168.3.0/24 is directly connected, Vlan3 Switch#
网络实验工具
- 思科 Cisco Packet Tracer 6.2 网络模拟器正式版 链接:https://pan.baidu.com/s/1iebrRsRCkNFqo7-V6TBejQ 提取码:fi5i
参考链接
- Packet_Tracer使用教程 链接:https://pan.baidu.com/s/1LOv2XN3QfjGKqfevcPSpiA 提取码:f6l2
本文首发于独立博客【路飞小站】:http://www.noofi.cn/?post=45
长按二维码关注微信公众号【路飞学安全】,微信号【noofisec】