VLAN

 

 SW1配置

复制代码
vlan batch 10 12 20
interface Vlanif10
 ip address 192.168.10.254 255.255.255.0
#
interface Vlanif12
 ip address 192.168.12.1 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 10
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 20
#
interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 10 12 20
#

ospf 1 router-id 1.1.1.1
 area 0.0.0.0
  network 192.168.12.0 0.0.0.255
  network 192.168.10.0 0.0.0.255
#
复制代码

SW2配置

复制代码
vlan batch 10 12 20
interface Vlanif12
 ip address 192.168.12.2 255.255.255.0
#
interface Vlanif20
 ip address 192.168.20.254 255.255.255.0
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
 port link-type access
 port default vlan 10
#
interface GigabitEthernet0/0/2
 port link-type access
 port default vlan 20
#
interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 10 12 20
#

ospf 1 router-id 2.2.2.2
 area 0.0.0.0
  network 192.168.20.0 0.0.0.255
  network 192.168.12.0 0.0.0.255
复制代码

PC1测试

复制代码
PC>ping 192.168.10.3

Ping 192.168.10.3: 32 data bytes, Press Ctrl_C to break
From 192.168.10.3: bytes=32 seq=1 ttl=128 time=47 ms
From 192.168.10.3: bytes=32 seq=2 ttl=128 time=62 ms
From 192.168.10.3: bytes=32 seq=3 ttl=128 time=47 ms
From 192.168.10.3: bytes=32 seq=4 ttl=128 time=62 ms
From 192.168.10.3: bytes=32 seq=5 ttl=128 time=47 ms

--- 192.168.10.3 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 47/53/62 ms

PC>ping 192.168.20.2

Ping 192.168.20.2: 32 data bytes, Press Ctrl_C to break
From 192.168.20.2: bytes=32 seq=1 ttl=126 time=125 ms
From 192.168.20.2: bytes=32 seq=2 ttl=126 time=78 ms
From 192.168.20.2: bytes=32 seq=3 ttl=126 time=62 ms
From 192.168.20.2: bytes=32 seq=4 ttl=126 time=78 ms
From 192.168.20.2: bytes=32 seq=5 ttl=126 time=78 ms

--- 192.168.20.2 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 62/84/125 ms

PC>ping 192.168.20.4

Ping 192.168.20.4: 32 data bytes, Press Ctrl_C to break
From 192.168.20.4: bytes=32 seq=1 ttl=126 time=78 ms
From 192.168.20.4: bytes=32 seq=2 ttl=126 time=63 ms
From 192.168.20.4: bytes=32 seq=3 ttl=126 time=47 ms
From 192.168.20.4: bytes=32 seq=4 ttl=126 time=63 ms
Request timeout!

--- 192.168.20.4 ping statistics ---
  5 packet(s) transmitted
  4 packet(s) received
  20.00% packet loss
  round-trip min/avg/max = 47/62/78 ms

PC>
复制代码

 

posted @   星火撩原  阅读(175)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示