码迷,mamicode.com
首页 > 其他好文 > 详细

单臂路由

时间:2020-06-17 16:39:55      阅读:63      评论:0      收藏:0      [点我收藏+]

标签:address   enc   mob   download   info   nal   one   col   ring   

技术图片
Switch>en 进入模式
Switch#conf 配置
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int f0/3
Switch(config-if)#switchport mode trunk 更改为trunk模式
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
Switch(config-if)#vlan 2 创建vlan2
Switch(config-vlan)#int f0/1 进入到接口f0/1
Switch(config-if)#switchport access vlan 2 将接口加入到vlan2
Switch(config-if)#vlan 3
Switch(config-vlan)#int f0/2
Switch(config-if)#switchport access vlan 3 同理将switch的接口加入到vlan3

路由器的配置:
Router(config)#
Router(config)#int f0/0
Router(config-if)#no shut
Router(config-if)#no shutdown
Router(config-if)#int f0/0.1 #进入子接口
Router(config-subif)#encapsulation dot1Q 2 #封装为doc1Q 且为vlan2
Router(config-subif)#ip add
Router(config-subif)#ip address 192.168.1.254 255.255.255.0 #添加I
Router(config-subif)#int f0/0.2
Router(config-subif)#encapsulation dot1Q 3
Router(config-subif)#ip address 192.168.2.254 255.255.255.0
退出:
Router#show ip route 查看路由表生成的两条路由
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

    • candidate default, U - per-user static route, o - ODR
      P - periodic downloaded static route

Gateway of last resort is not set

C 192.168.1.0/24 is directly connected, FastEthernet0/0.1 #directly:直接
C 192.168.2.0/24 is directly connected, FastEthernet0/0.2
Router#
此时的vlan2与vlan3PC机虽然不同的vlan但是却可以相互通信

单臂路由

标签:address   enc   mob   download   info   nal   one   col   ring   

原文地址:https://blog.51cto.com/14847540/2505154

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!