练习如图:
1.先改名然后配置PC的ip与DNS(太简单不演视)
2.配置Vlan
打开记事本上写:
vlan bat 10 20
port-g group-m g0/0/1 g0/0/2
p l a
p d v 10
复制后打开SW2在系统视图上粘贴
[SW2]vlan bat 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2]port-g group-m g0/0/1 g0/0/2
[SW2-port-group]p l a
[SW2-GigabitEthernet0/0/1]p l a
[SW2-GigabitEthernet0/0/2]p l a
[SW2-port-group]p d v 20
[SW2-GigabitEthernet0/0/1]p d v 20
[SW2-GigabitEthernet0/0/2]p d v 20
将记事本中p d v 10改成p d v 20后复制打开SW3在系统视图上粘贴
[SW3]vlan bat 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW3]port-g group-m g0/0/1 g0/0/2
[SW3-port-group]p l a
[SW3-GigabitEthernet0/0/1]p l a
[SW3-GigabitEthernet0/0/2]p l a
[SW3-port-group]p d v 20
[SW3-GigabitEthernet0/0/1]p d v 20
[SW3-GigabitEthernet0/0/2]p d v 20
将记事本上第一行内容在SW1的系统视图下粘贴
[SW1]vlan bat 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
3.配置Trunk
在记事本上继续写
int g 0/0/3
p l t
p t a v 10
复制后分别在SW2与SW3的系统视图下粘贴
[SW2-port-group]q
[SW2]int g 0/0/3
[SW2-GigabitEthernet0/0/3]p l t
[SW2-GigabitEthernet0/0/3]p t a v 10
[SW3-port-group]q
[SW3]int g 0/0/3
[SW3-GigabitEthernet0/0/3]p l t
[SW3-GigabitEthernet0/0/3]p t a v 20
SW1配置trunk:
[SW1]port-g group-m g0/0/1 g0/0/2
[SW1-port-group]p l t
[SW1-GigabitEthernet0/0/1]p l t
[SW1-GigabitEthernet0/0/2]p l t
[SW1-port-group]p t a v 10 20
[SW1-GigabitEthernet0/0/1]p t a v 10 20
[SW1-GigabitEthernet0/0/2]p t a v 10 20
4.配置Eth-Trunk
记事本上继续写:
int eth 1
mode manual load-balance
trunkport g 0/0/4 0/0/5
p l t
p t a v a
复制后分别在SW2与SW3的系统视图下粘贴
[SW2]int eth 1
[SW2-Eth-Trunk1]mode manual load-balance
[SW2-Eth-Trunk1]trunkport g 0/0/4 0/0/5
[SW2-Eth-Trunk1]p l t
[SW2-Eth-Trunk1]p t a v a
[SW3-GigabitEthernet0/0/3]q
[SW3]int eth 1
[SW3-Eth-Trunk1]mode manual load-balance
[SW3-Eth-Trunk1]trunkport g 0/0/4 0/0/5
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW3-Eth-Trunk1]p l t
[SW3-Eth-Trunk1]p t a v a
5.配SW1
配SW1的Vlanif的IP以及静态路由以作为网关
[SW1-port-group]q
[SW1]int vlan 10
[SW1-Vlanif10]ip add 192.168.10.254 24
[SW1-Vlanif10]int vlan 20
[SW1-Vlanif20]ip add 192.168.20.254 24
[SW1-Vlanif20]q
[SW1]ip route-s 192.168.40.0 24 192.168.30.2
配SW1的g0/0/3口:
[SW1]vlan bat 30
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]int g0/0/3
[SW1-GigabitEthernet0/0/3]p l a
[SW1-GigabitEthernet0/0/3]p d v 30
[SW1-GigabitEthernet0/0/3]q
[SW1]int v 30
[SW1-Vlanif30]ip add 192.168.30.1 24
6.配置路由器R1
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.30.2 24
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.40.254 24
[R1-GigabitEthernet0/0/1]q
[R1]ip route-s 0.0.0.0 0 192.168.30.1
7.测试连通性:
这里有可能会ping不通是因为SW1,SW2,SW3形成环路有STP协议生效,若SW1为非根网桥则SW1与SW2、SW3之间端口会成为AP(Alternated Port)需要手动把SW1设为根网桥,或者在SW2上port trunk a v 20加上即可
[SW1]stp priority 0