您的位置:首页 > 理论基础 > 计算机网络

trunk vlan 加路由

2017-10-14 20:03 176 查看
1.
不同交换机 vlan间的trunk链路连接

拓扑图:图1



交换机SW1:
enable
configure terminal
hostname SW1
no ip domain lookup
line console 0
exec-timeout 0 0 #实际项目中不做该命令
line vty 0 4
no login /or/ password 666
exit
enable secret 888
vlan 2
name whatyouwant1
vlan 3
name whatyouwant2
exit
interface fastethernet 0/1
no shutdown #这条命令虽然多余 但 是条件反射666老铁没毛病...
switchport mode access #修改接口模式 虽然大部份默认access可不配,但设备如果是trunk模式下面命令不报错 但配置将无效 保险起见配置以下
switchport access vlan 2
description PC-1
interface fastethernet 0/2
no shutdown #多余 多敲不吃亏
switchport mode access
switchport access vlan 3
description PC-2
interface fastethernet 0/3
no shutdown
switchport mode trunk
description Trunk to SW2 fast0/3
end
show vlan brief
show interfaces trunk
write #互通ping测试 无误后

交换机SW2:
步骤同SW1 参数描述不同 如图2

2.
在 1 基础上,使得不同vlan可以互通。
方案1.
拓扑图:图2(实现做法之一)



在1基础上,添加一台路由器

交换机SW1:
enable
configure terminal
interface fastethernet 0/4
no shutdown
switchport mode access
switchport access vlan 2
end
show vlan brief
show interface fastethernet 0/4 switchport
write

交换机SW2:
步骤同SW1
fast0/4 加入vlan 3

方案2.

拓扑图:图3(实现做法之一)
在1基础上,添加一台三层交换机



交换机SW1:
enable
configure terminal
interface fastethernet 0/4
no shutdown
switchport mode trunk
end
show interface fastethernet 0/4 switchport
show vlan brief
write

三层交换机R1:
enable
configure terminal
hostname R1
no ip domain lookup
enable secret 666
line console 0
exec-timeout 0 0
line vty 0 4
no login //password 888
exit
ip routing

vlan 2
name hahaha
vlan 3
name wawawa
interface vlan 2
ip address 192.168.1.3 255.255.255.0
interface vlan 3
ip address 192.168.2.3 255.255.255.0
interface fastethernet 0/1
no shutdown
switchport trunk encapsulation dot1q #指定封装协议 根据设备而定
switchport mode trunk
end
show ip interface brief
show vlan brif
show interface fastethernet 0/1 switchport
write #ping测试互通后

今天就写这么多了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  网络 VLAN TRUNK