1:路由器ide
(1)命名blog
(2)设置网络段ip和协议ip
(3)激活指定端口路由
2:交换机文档
(1)命名terminal
(2)添加vlanget
(3)将指定端口划分到指定vlanit
(4)将指定端口设置成trunk模式io
3:PC(这里将路由器代替PC)
(1)命名
(2)设置IP并激活
4:查看命令
查看基本配置:show running-config
查看VLAN信息:show vlan-switch
查看trunk信:show interface 具体端口 switchport
查看路由表:show ip route
----------------------------------------------------------
配置文档:
r1:
enable \\命名
config terminal
hostname r1
interface f0/0.1 \\将指定网段添加指定VLAN并添加协议
ip address 192.168.10.1 255.255.255.0
no shutdown
encapsulation dot1q 2
exit
interface f0/0.2
ip address 192.168.1.1 255.255.255.0 \\将指定网段添加指定VLAN并添加协议
noshutdown
encapsulation dot1q 3
exit
interface f0/0 \\激活端口
no shutdown
end
write
---------------------------------------------------------
sw1:
enable
config terminal \\命名
hostname sw1
exit
vlan database \\添加VLAN
vlan 2
vlan 3
exit
config terminal \\ 将指定端口添加到指定VLAN
interface f0/1
switchport access vlan 2
exit
interface f0/2
switchport access vlan 3
exit
interface f0/0 \\将指定端口设置成trunk模式
switchport mode trunk
end
write
----------------------------------------------------------
PC1:
Enable \\命名并设置IP
config terminal
no ip routing
hostname pc1
interface f0/0
ip address 192.168.10.2 255.255.255.0
no shutdown
end
write
-----------------------------------------------------------
PC2: \\命名并设置IP
enable
config terminal
no ip routing
hostname pc2
interface f0/0
ip address 192.168.1.2 255.255.255.0
no shutdown
end
write
------------------------------------------------------------