这是一台交换机、一台路由器和两台pc客户端组成的简单的三叉戟型的简单网络,下面是配置vlan间的单臂路由的方法和步骤。 实验的拓扑图: 1.配置pc机ip地址和网关的方法(略)
2.在交换机上创建VLAN,并将接口加入相应的VLAN中
en
conf t
vlan 10
vlan 20
exit
int f0/1
switchport mode access
swithchport access vlan 10
int f0/2
switchport mode access
swithcport access vlan 20
int f0/3
switchport mode trunk
exit
2.在路由器F0/0上配置子接口,并封装vlan号
en
conf t
int f0/0
no shut
int f0/0.1
encapsulation dot1Q 10 *配置以太网子接口vlan号,封装格式为 802.1q
ip add 192.168.1.254 255.255.255.0
no shut
int f0/0.2
encapsulation dot1Q 20 *不首先配置VLAN号,给子接口设置IP 地址将失败
ip add 192.168.2.254 255.255.255.0
no shut
exit
3.在路由器上show ip route
4.验证:PC1pingPC2
|
域名转让和技术支持QQ:2000617|Archiver|ROS软路由论坛 ROSABC.com
GMT+8, 2026-9-29 03:32 , Processed in 1.322371 second(s), 16 queries .
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.