clip_image002基本思路:

1:路由器

(1)命名

(2)设置网络段ip和协议

(3)激活指定端口

2:交换机

(1)命名

(2)添加vlan

(3)将指定端口划分到指定vlan

(4)将指定端口设置成trunk模式

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

------------------------------------------------------------