三层交换配置路由

3.1 问题
如何使用三层交换机和路由配置实现全网互通?
配置思路:
1.终端设备pc
2.交换机
-sw1.2.4 接口设置
3.三层交换
-sw3建立vlan
-与交换机连接设置trunk允许所有
-vlanif 设置ip地址
-创建vlan 300 接口0/0/3设置acce模式
加入vlan 300 进入vlanif 300 设置ip地址
-设置静态路由60 70网段下一跳
4.路由器
-子接口设置ip地址 打开ARP广播
-g0/0/2接口设置IP地址
-设置默认静态路由
5.验证与测试

三层交换配置路由_第1张图片

SW1
SW2

[SW4]vlan batch 10 20 30 40 50 60 70
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW4]int e0/0/1
[SW4-Ethernet0/0/1]port link-type access
[SW4-Ethernet0/0/1]port default vlan 60
[SW4-Ethernet0/0/1]int e0/0/2
[SW4-Ethernet0/0/2]port link-type access
[SW4-Ethernet0/0/2]port default vlan 70
[SW4-Ethernet0/0/2]int e0/0/3
[SW4-Ethernet0/0/3]port link-type trunk
[SW4-Ethernet0/0/3]port trunk allow-pass vlan all

[SW3]vlan batch 10 20 30 40 50 60 70
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW3]port-group 1
[SW3-port-group-1]group-member g0/0/1 g0/0/2
[SW3-port-group-1]port link-type trunk
[SW3-port-group-1]port trunk allow-pass vlan all
[SW3]int vlanif 10
[SW3-Vlanif10]ip add 192.168.10.1 24
[SW3-Vlanif10]int v20
[SW3-Vlanif20]ip add 192.168.20.1 24
[SW3-Vlanif20]int v30
[SW3-Vlanif30]ip add 192.168.30.1 24
[SW3-Vlanif30]int v40
[SW3-Vlanif40]ip add 192.168.40.1 24
[SW3-Vlanif40]int v50
[SW3-Vlanif50]ip add 192.168.50.1 24
[SW3-Vlanif50]q
[SW3]vlan 300
[SW3-vlan300]q
[SW3]int g0/0/3
[SW3-GigabitEthernet0/0/3]port link-type access
[SW3-GigabitEthernet0/0/3]port default vlan 300
[SW3-GigabitEthernet0/0/3]q
[SW3]int vlanif 300
[SW3-Vlanif300]ip add 192.168.3.3 24
[SW3-Vlanif300]q
[SW3]ip route-static 192.168.60.0 24 192.168.3.1
[SW3]ip route-static 192.168.70.0 24 192.168.3.1

[R1]int g0/0/0.1
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 60
[R1-GigabitEthernet0/0/0.1]ip add 192.168.60.1 24
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
[R1-GigabitEthernet0/0/0.1]int g0/0/0.2
[R1-GigabitEthernet0/0/0.2]dot1q termination vid 70
[R1-GigabitEthernet0/0/0.2]ip add 192.168.70.1 24
[R1-GigabitEthernet0/0/0.2]arp broadcast enable
[R1-GigabitEthernet0/0/0.2]q
[R1]int g0/0/02
[R1-GigabitEthernet0/0/2]ip add 192.168.3.1 24

g0/0/0.1 192.168.60.1 24
g0/0/0.2 192.168.70.1 24
进入子接口 设置ip地址 开启arp广播