首页 > 其他分享 >考古笔记6:单臂路由子接口实现VLAN间通讯

考古笔记6:单臂路由子接口实现VLAN间通讯

时间:2023-05-26 17:07:00浏览次数:32  
标签:seq VLAN bytes 192.168 84 icmp config 路由 单臂

拓扑构成

拓扑:

考古笔记6:单臂路由子接口实现VLAN间通讯_VLAN



配置过程

配置信息:R1

R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#interface f0/0
R1(config-if)#no shut
R1(config-if)#interface f0/0.1
R1(config-subif)#encapsulation dot1Q 10
//后面的数字 1 代表是的侦听VLAN号为 10 的传输数据
*Mar  1 00:06:55.083: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
R1(config-subif)#ip address 192.168.10.254 255.255.255.0
R1(config-subif)#no shut
R1(config-subif)#
R1(config-subif)#interface f0/0.2
R1(config-subif)#encapsulation dot1Q 20
//后面的数字 1 代表是的侦听VLAN号为 10 的传输数据
R1(config-subif)#ip address 192.168.20.254 255.255.255.0
R1(config-subif)#no shut
R1(config-if)#end 
R1# 
*Mar  1 00:08:20.167: %SYS-5-CONFIG_I: Configured from console by console 


R1# 
R1#copy run start 
Destination filename [startup-config]? 
Building configuration... 
[OK] 
R1# 
R1#show ip route
 Codes: C - connected, S - static, 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
        i - IS-IS, su - IS-IS summary, 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.10.0/24 is directly connected, FastEthernet0/0.1 
C    192.168.20.0/24 is directly connected, FastEthernet0/0.2 

R1#


配置信息:SW1

SW1#vlan database
SW1(vlan)#vlan 10
VLAN 10 added:
    Name: VLAN0010
SW1(vlan)#vlan 20
VLAN 20 added:
    Name: VLAN0020
SW1(vlan)#apply
APPLY completed.
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#


SW1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#no ip routing
SW1(config)#




SW1(config)#interface f0/0
SW1(config-if)#switchport mode trunk
*Mar  1 00:12:14.687: %DTP-5-TRUNKPORTON: Port Fa0/15 has become dot1q trunk
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#no shut
SW1(config-if)#exit
SW1(config)#


SW1(config)#interface f0/1
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10
SW1(config-if)#no shut
SW1(config-if)#exit
SW1(config)#


SW1(config)#interface f0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10
SW1(config-if)#no shut
SW1(config-if)#exit


SW1(config)#interface f0/3
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 20
SW1(config-if)#no shut
SW1(config-if)#exit
SW1(config)#

SW1(config)#interface f0/4
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 20
SW1(config-if)#no shut
SW1(config-if)#exit



SW1(config)#interface f0/15
SW1(config-if)#switchport mode trunk
*Mar  1 00:12:14.687: %DTP-5-TRUNKPORTON: Port Fa0/15 has become dot1q trunk
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#no shut
SW1(config-if)#end
SW1#
*Mar  1 00:15:50.355: %SYS-5-CONFIG_I: Configured from console by console


SW1#copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
SW1#



SW1#show vlan-switch

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/10, Fa0/11, Fa0/12
                                                Fa0/13, Fa0/14
10   VLAN0010                         active    Fa0/1, Fa0/2
20   VLAN0020                         active    Fa0/3, Fa0/4
1002 fddi-default                     active
1003 token-ring-default               active
1004 fddinet-default                  active
1005 trnet-default                    active

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        1002   1003
10   enet  100010     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0
1005 trnet 101005     1500  -      -      1        ibm  -        0      0
SW1#

配置信息:SW2

SW2#vlan database
SW2(vlan)#vlan 10
VLAN 10 added:
    Name: VLAN0010
SW2(vlan)#vlan 20
VLAN 20 added:
    Name: VLAN0020
SW2(vlan)#apply
APPLY completed.
SW2(vlan)#exit
APPLY completed.
Exiting....
SW2#


SW2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#no ip routing
SW2(config)#




SW2(config)#interface f0/0
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 10
SW2(config-if)#no shut
SW2(config-if)#exit
SW2(config)#


SW2(config)#interface f0/1
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 20
SW2(config-if)#no shut
SW2(config-if)#exit
SW2(config)#



SW2(config)#interface f0/15
SW2(config-if)#switchport mode trunk
*Mar  1 00:12:14.687: %DTP-5-TRUNKPORTON: Port Fa0/15 has become dot1q trunk
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#no shut
SW2(config-if)#end
SW2#
*Mar  1 00:15:50.355: %SYS-5-CONFIG_I: Configured from console by console


SW2#copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
SW2#



SW2#show vlan-switch

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/2, Fa0/3, Fa0/4, Fa0/5
                                                Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14
10   VLAN0010                         active    Fa0/0
20   VLAN0020                         active    Fa0/1
1002 fddi-default                     active
1003 token-ring-default               active
1004 fddinet-default                  active
1005 trnet-default                    active

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        1002   1003
10   enet  100010     1500  -      -      -        -    -        0      0
20   enet  100020     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0
1005 trnet 101005     1500  -      -      1        ibm  -        0      0
SW2#


验证与测试

测试:PC-1

PC-1> ip 192.168.10.1 255.255.255.0 192.168.10.254
Checking for duplicate address...
PC1 : 192.168.10.1 255.255.255.0 gateway 192.168.10.254

PC-1> save
Saving startup configuration to startup.vpc
.  done

PC-1> ping 192.168.10.254
84 bytes from 192.168.10.254 icmp_seq=1 ttl=255 time=30.032 ms
84 bytes from 192.168.10.254 icmp_seq=2 ttl=255 time=15.936 ms
84 bytes from 192.168.10.254 icmp_seq=3 ttl=255 time=15.954 ms
84 bytes from 192.168.10.254 icmp_seq=4 ttl=255 time=15.940 ms
84 bytes from 192.168.10.254 icmp_seq=5 ttl=255 time=14.991 ms

PC-1> ping 192.168.20.254
84 bytes from 192.168.20.254 icmp_seq=1 ttl=255 time=15.915 ms
84 bytes from 192.168.20.254 icmp_seq=2 ttl=255 time=14.971 ms
84 bytes from 192.168.20.254 icmp_seq=3 ttl=255 time=15.293 ms
84 bytes from 192.168.20.254 icmp_seq=4 ttl=255 time=15.415 ms
84 bytes from 192.168.20.254 icmp_seq=5 ttl=255 time=16.032 ms

PC-1>


测试:PC-2

PC-2> ip 192.168.10.2 255.255.255.0 192.168.10.254
Checking for duplicate address...
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.254

PC-2> save
Saving startup configuration to startup.vpc
.  done

PC-2> ping 192.168.10.254
84 bytes from 192.168.10.254 icmp_seq=1 ttl=255 time=14.934 ms
84 bytes from 192.168.10.254 icmp_seq=2 ttl=255 time=14.952 ms
84 bytes from 192.168.10.254 icmp_seq=3 ttl=255 time=15.134 ms
84 bytes from 192.168.10.254 icmp_seq=4 ttl=255 time=15.940 ms
84 bytes from 192.168.10.254 icmp_seq=5 ttl=255 time=14.929 ms

PC-2> ping 192.168.20.254
84 bytes from 192.168.20.254 icmp_seq=1 ttl=255 time=15.720 ms
84 bytes from 192.168.20.254 icmp_seq=2 ttl=255 time=16.293 ms
84 bytes from 192.168.20.254 icmp_seq=3 ttl=255 time=16.051 ms
84 bytes from 192.168.20.254 icmp_seq=4 ttl=255 time=15.894 ms
84 bytes from 192.168.20.254 icmp_seq=5 ttl=255 time=15.761 ms

PC-2> ping 192.168.10.1
84 bytes from 192.168.10.1 icmp_seq=1 ttl=64 time=1.998 ms
84 bytes from 192.168.10.1 icmp_seq=2 ttl=64 time=0.969 ms
84 bytes from 192.168.10.1 icmp_seq=3 ttl=64 time=2.009 ms
84 bytes from 192.168.10.1 icmp_seq=4 ttl=64 time=1.960 ms
84 bytes from 192.168.10.1 icmp_seq=5 ttl=64 time=2.000 ms

PC-2>


测试:PC-3

PC-3> ip 192.168.20.1 255.255.255.0 192.168.20.254
Checking for duplicate address...
PC1 : 192.168.20.1 255.255.255.0 gateway 192.168.20.254

PC-3> save
Saving startup configuration to startup.vpc
.  done

PC-3> ping 192.168.20.254
84 bytes from 192.168.20.254 icmp_seq=1 ttl=255 time=15.671 ms
84 bytes from 192.168.20.254 icmp_seq=2 ttl=255 time=15.425 ms
84 bytes from 192.168.20.254 icmp_seq=3 ttl=255 time=14.967 ms
84 bytes from 192.168.20.254 icmp_seq=4 ttl=255 time=15.886 ms
84 bytes from 192.168.20.254 icmp_seq=5 ttl=255 time=16.266 ms

PC-3> ping 192.168.10.254
84 bytes from 192.168.10.254 icmp_seq=1 ttl=255 time=15.863 ms
84 bytes from 192.168.10.254 icmp_seq=2 ttl=255 time=16.150 ms
84 bytes from 192.168.10.254 icmp_seq=3 ttl=255 time=14.825 ms
84 bytes from 192.168.10.254 icmp_seq=4 ttl=255 time=14.715 ms
84 bytes from 192.168.10.254 icmp_seq=5 ttl=255 time=15.019 ms

PC-3> ping 192.168.10.1
192.168.10.1 icmp_seq=1 timeout
192.168.10.1 icmp_seq=2 timeout
84 bytes from 192.168.10.1 icmp_seq=3 ttl=63 time=30.853 ms
84 bytes from 192.168.10.1 icmp_seq=4 ttl=63 time=30.859 ms
84 bytes from 192.168.10.1 icmp_seq=5 ttl=63 time=30.903 ms

PC-3>


测试:PC-4

PC-4> ip 192.168.20.2 255.255.255.0 192.168.20.254
Checking for duplicate address...
PC1 : 192.168.20.1 255.255.255.0 gateway 192.168.20.254

PC-4> save
Saving startup configuration to startup.vpc
.  done

PC-4> ping 192.168.20.254
84 bytes from 192.168.20.254 icmp_seq=1 ttl=255 time=15.671 ms
84 bytes from 192.168.20.254 icmp_seq=2 ttl=255 time=15.425 ms
84 bytes from 192.168.20.254 icmp_seq=3 ttl=255 time=14.967 ms
84 bytes from 192.168.20.254 icmp_seq=4 ttl=255 time=15.886 ms
84 bytes from 192.168.20.254 icmp_seq=5 ttl=255 time=16.266 ms

PC-4> ping 192.168.10.254
84 bytes from 192.168.10.254 icmp_seq=1 ttl=255 time=15.863 ms
84 bytes from 192.168.10.254 icmp_seq=2 ttl=255 time=16.150 ms
84 bytes from 192.168.10.254 icmp_seq=3 ttl=255 time=14.825 ms
84 bytes from 192.168.10.254 icmp_seq=4 ttl=255 time=14.715 ms
84 bytes from 192.168.10.254 icmp_seq=5 ttl=255 time=15.019 ms

PC-4> ping 192.168.10.1
192.168.10.1 icmp_seq=1 timeout
192.168.10.1 icmp_seq=2 timeout
84 bytes from 192.168.10.1 icmp_seq=3 ttl=63 time=30.853 ms
84 bytes from 192.168.10.1 icmp_seq=4 ttl=63 time=30.859 ms
84 bytes from 192.168.10.1 icmp_seq=5 ttl=63 time=30.903 ms

PC-4>


测试:PC-5

PC-5> ip 192.168.10.3 255.255.255.0 192.168.10.254
Checking for duplicate address...
PC1 : 192.168.10.3 255.255.255.0 gateway 192.168.10.254

PC-5> save
Saving startup configuration to startup.vpc
.  done

PC-5> ping 192.168.10.1
84 bytes from 192.168.10.1 icmp_seq=1 ttl=64 time=2.005 ms
84 bytes from 192.168.10.1 icmp_seq=2 ttl=64 time=3.002 ms
84 bytes from 192.168.10.1 icmp_seq=3 ttl=64 time=0.993 ms
84 bytes from 192.168.10.1 icmp_seq=4 ttl=64 time=2.999 ms
84 bytes from 192.168.10.1 icmp_seq=5 ttl=64 time=3.476 ms

PC-5> ping 192.168.20.1
192.168.20.1 icmp_seq=1 timeout
192.168.20.1 icmp_seq=2 timeout
84 bytes from 192.168.20.1 icmp_seq=3 ttl=63 time=31.916 ms
84 bytes from 192.168.20.1 icmp_seq=4 ttl=63 time=30.917 ms
84 bytes from 192.168.20.1 icmp_seq=5 ttl=63 time=31.011 ms

PC-5>

测试 :PC-6

PC-6> ip 192.168.20.3 255.255.255.0 192.168.20.254
Checking for duplicate address...
PC1 : 192.168.20.3 255.255.255.0 gateway 192.168.20.254

PC-6> save
Saving startup configuration to startup.vpc
.  done

PC-6> ping 192.168.10.1
192.168.10.1 icmp_seq=1 timeout
192.168.10.1 icmp_seq=2 timeout
84 bytes from 192.168.10.1 icmp_seq=3 ttl=63 time=31.475 ms
84 bytes from 192.168.10.1 icmp_seq=4 ttl=63 time=31.468 ms
84 bytes from 192.168.10.1 icmp_seq=5 ttl=63 time=31.642 ms

PC-6> ping 192.168.20.1
84 bytes from 192.168.20.1 icmp_seq=1 ttl=64 time=3.454 ms
84 bytes from 192.168.20.1 icmp_seq=2 ttl=64 time=3.257 ms
84 bytes from 192.168.20.1 icmp_seq=3 ttl=64 time=1.998 ms
84 bytes from 192.168.20.1 icmp_seq=4 ttl=64 time=1.962 ms
84 bytes from 192.168.20.1 icmp_seq=5 ttl=64 time=2.998 ms

PC-6>

以上

就是本次实验有关利用”单臂路由子接口实现VLAN间通讯“的全部内容。



标签:seq,VLAN,bytes,192.168,84,icmp,config,路由,单臂
From: https://blog.51cto.com/mlxia/6357559

相关文章

  • vue3 router 路由传参
    路由跳转importrouterfrom"@/router";router.push({path:"/iframe",query:{url:frameurl.value}});获取参数importrouterfrom"@/router";import{useRoute}from"vue-router";constroute=useRoute();const......
  • vlan tag untag
    vlantaguntagvlantaguntagvlantaguntag untag一般vlan用的,tag是多个vlan互通用的,把vlan比成隔离钢板的话那么tag是穿甲弹,untag是鸡蛋因为不具有穿透能力1,端口接收数据时:(1)如果端口是tagged方式,当数据包本身不包含VLAN的话,输入的数据包就加上该缺省vlan。(2)如果数据包本身......
  • Vue2路由嵌套是注意子路由path问题
    1、当子路由以/开始时,它会被视为根路由,并且会显示在URL的根路径中2、当子路由不以/开始时,它将被视为相对路径,相对于父路由的路径......
  • 软路由 & 旁路由 All In One
    软路由&旁路由AllInOne路由器KeXue上网软路由旁路由demos(......
  • 双交换机多主机vlan隔离(eNSP)
     交换机工作原理:交换机通过mac地址学习,对除了来源端口以外的其他端口发送广播,并根据形成的mac地址表进行1对1发送数据帧。每300s更新一次mac-address。实验说明:本实验通过对两台SW交换机配置,进行vlan划分,将PC1,PC2主机划分到同一个vlan,C1,C2主机划分到另一个vlan,实现PC1与PC2互......
  • Cisco® Catalyst® 8000V 边缘软件 (Catalyst 8000V) 17.11.1a 发布 - 虚拟路由器
    Cisco®Catalyst®8000V边缘软件(Catalyst8000V)17.11.1a发布-虚拟路由器CiscoCatalyst8000vEdgeSoftware,IOSXEReleaseDublin-17.11.1aED请访问原文链接:https://sysin.org/blog/cisco-catalyst-8000v/,查看最新版。原创作品,转载请保留出处。作者主页:sysin.or......
  • drf-路由组件
    目录一路由Routers1.1什么情况下使用自动生成路由1.2自动生成路由使用方法1.3代码演示视图函数路由一路由Routers路由写法有多种-原始写法-映射的写法:path('books/',BookView.as_view({'get':'list','post':'create'}))-自动生成路由1.1什么情况下使用自动生成路......
  • Django 路由分发
    Django路由分发当一个url请求过来之后1、先到项目主目录下的urls内。2、由这个url做处理分发给其他app内的urls。一级路由:主目录urls内引入includefromdjango.conf.urlsimporturl,includeurlpatterns=[#指定分发的app目录名称url(r'^cmdb/',include("app0......
  • 考古笔记3:通过L3交换机实现VLAN间通讯
    本主要介绍:在cisco中通过L3交换机实现VLAN间通讯。拓扑拓扑A:配置过程配置步骤1:sw2SW2#vlandataSW2(vlan)#vlan10VLAN10added:Name:VLAN0010SW2(vlan)#vlan20VLAN20added:Name:VLAN0020SW2(vlan)#applyAPPLYcompleted.SW2(vlan)#exitAPPLYcompleted.E......
  • drf——5个视图扩展类、9个视图子类、视图集、drf之路由
    5个视图扩展类#写5个类(不叫视图类视图拓展类需要配合GenericAPIView一起用)每个类有一个方法以后想写哪个接口就继承哪个类即可fromrest_framework.responseimportResponse####自己封装的5个视图拓展类classListModelMixin:deflist(self,request):......