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
------------------------------------------------------------