设为首页收藏本站language 语言切换
查看: 1776|回复: 11
收起左侧

[求助] 配置三层交换机SVI实现VLAN间通信

[复制链接]
发表于 2016-5-10 18:33:45 | 显示全部楼层 |阅读模式
3鸿鹄币
大家好,本人有个疑问想请教一下各位,如下图: 00.png
四台电脑代表四个不同的VLAN,SW0是服务器,vtp mode server ,其余两个SW1和SW2是客户端,把SW0配置好之后SW1和SW2可以自动学习过来,最终结果是四台电脑(不同VLAN)可以ping成功,PC0的IP是192.168.10.2,PC1的IP是192.168.20.2依次类推,可是我配置好之后ping不同,交换机之间的trunk口也打上了,IP routing 也开启了,拜托大家了。

最佳答案

查看完整内容

我是直接强起trunk 配置是没有问题的 (1)你最好看下链路 的trunk是否协商成功 (2)每台交换机你都show下VLAN看看vlan是否全,用VTP做的话必须先起trunk,否则VTP是起不来的!
发表于 2016-5-10 18:33:46 | 显示全部楼层
archy8899 发表于 2016-5-10 22:16
SWO:
1.创建VLAN
Switch# config t

我是直接强起trunk
配置是没有问题的
(1)你最好看下链路 的trunk是否协商成功
(2)每台交换机你都show下VLAN看看vlan是否全,用VTP做的话必须先起trunk,否则VTP是起不来的!
沙发 2016-5-10 18:33:46 回复 收起回复
回复

使用道具 举报

发表于 2016-5-10 19:58:55 | 显示全部楼层
直接把SW的配置发给你参考。我实际配置没有出现你说的情况! 你对比下配置看有什么不同?

SW0#show run
ip dhcp pool 10  ##配置vlan的DHCP 地址池
network 192.168.10.0 255.255.255.0
default-router 192.168.10.254
ip dhcp pool 20
network 192.168.20.0 255.255.255.0
default-router 192.168.20.254
ip dhcp pool 30
network 192.168.30.0 255.255.255.0
default-router 192.168.30.254
ip dhcp pool 40
network 192.168.40.0 255.255.255.0
default-router 192.168.40.254
!
ip routing #启动3层路由
!
interface FastEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet0/2
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface Vlan10 ##配置vlan10的IP地址
ip address 192.168.10.254 255.255.255.0
!
interface Vlan20
ip address 192.168.20.254 255.255.255.0
!
interface Vlan30
ip address 192.168.30.254 255.255.255.0
!
interface Vlan40
ip address 192.168.40.254 255.255.255.0
!
## SW0/SW1/SW2 的VTP配置略
vtp mode server
vtp domain cisco
vtp password cisco

##客户机启用DHCP获取IP地址

板凳 2016-5-10 19:58:55 回复 收起回复
回复

使用道具 举报

 楼主| 发表于 2016-5-10 20:28:35 | 显示全部楼层
未来星10 发表于 2016-5-10 19:58
直接把SW的配置发给你参考。我实际配置没有出现你说的情况! 你对比下配置看有什么不同?

SW0#show run
...

你好,不同之处就是你配置了vlan的DHCP 地址池,其余的我都配了,还有交换机之间需要打trunk口
地板 2016-5-10 20:28:35 回复 收起回复
回复

使用道具 举报

发表于 2016-5-10 21:34:55 | 显示全部楼层
说下排错思路
1.SVI接口是否可以直接ping通

2.相同VLAN的PC之间是否可以ping通,能否ping通对应SVI接口地址
(1)分别检查SW1和SW2上同VLAN上的PC能否ping通

(2)SW1与SW2同VLAN 上的PC能否ping通

3.不同VLAN之间能否ping通,能否ping通对方SVI接口的地址
(1)SW1上不同VLAN之间的PC能否ping通

(2)SW1与SW2上不同VLAN之间能够ping通
5# 2016-5-10 21:34:55 回复 收起回复
回复

使用道具 举报

发表于 2016-5-10 21:37:14 | 显示全部楼层
诺鸡鸭5530 发表于 2016-5-10 21:34
说下排错思路
1.SVI接口是否可以直接ping通

PC上的网关有没有写
6# 2016-5-10 21:37:14 回复 收起回复
回复

使用道具 举报

 楼主| 发表于 2016-5-10 21:40:59 | 显示全部楼层
诺鸡鸭5530 发表于 2016-5-10 21:34
说下排错思路
1.SVI接口是否可以直接ping通

你好,能不能给我写个详细的教程,我搞了两天了,都没查出来问题,拜托了
7# 2016-5-10 21:40:59 回复 收起回复
回复

使用道具 举报

发表于 2016-5-10 21:46:29 | 显示全部楼层
没有配置地址池,你的PC有没有手动指定网关。如果指定网关了,看能不能ping通SW0,如果与SW0能通,那PC之间就能通,如果与SW0不同,那就要看你SW1,SW2和SW0之间的配置对不对了。show vlan brief,看看VLAN有没有学到。
8# 2016-5-10 21:46:29 回复 收起回复
回复

使用道具 举报

发表于 2016-5-10 22:10:40 | 显示全部楼层
本帖最后由 诺鸡鸭5530 于 2016-5-10 22:15 编辑

我没用VTP,每个交换机上的VLAN都是手动建的,PC的网关一定要配,很简单的吧

!
hostname SW0
!
!
!
!
!
!
!
ip routing
!
!
!
!
!
!
!
!
!
!
!
!
no ip domain-lookup
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface FastEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet0/2
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
no ip address
shutdown
!
interface Vlan10
ip address 192.168.10.1 255.255.255.0
!
interface Vlan20
ip address 192.168.20.1 255.255.255.0
!
interface Vlan30
ip address 192.168.30.1 255.255.255.0
!
interface Vlan40
ip address 192.168.40.1 255.255.255.0
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end

=====================

hostname SW1
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
no ip domain-lookup
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface FastEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 10
switchport mode access
!
interface FastEthernet0/3
switchport access vlan 20
switchport mode access
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
no ip address
shutdown
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end
==================

!
hostname SW2
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
no ip domain-lookup
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface FastEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet0/2
switchport access vlan 30
switchport mode access
!
interface FastEthernet0/3
switchport access vlan 40
switchport mode access
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
no ip address
shutdown
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
end


9# 2016-5-10 22:10:40 回复 收起回复
回复

使用道具 举报

 楼主| 发表于 2016-5-10 22:16:33 | 显示全部楼层

SWO:
1.创建VLAN
Switch# config t
Switch(config)#vlan 10
Switch(config-vlan)# name office1   
Switch(config)#vlan 20
Switch(config-vlan)# name office2   
Switch(config-vlan)#exit
省两步
2.划分VLAN
Switch(config)# # int f0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10   
Switch(config)#interface fastEthernet 0/2      
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20  
省两步
3. 启用三层交换机的路由功能
SW3500(config)#  ip routing                  
SW3500(config)# interface vlan 10                     
SW3500config-if)#ip address 192.168.10.1 255.255.255.0
SW3500(config-if)#no shutdown                        
SW3500(config-if)#exit
SW3500(config)# interface vlan 20
SW3500(config-if)# ip address 192.168.20.1 255.255.255.0
SW3500(config-if)# no shutdown
SW3500(config-if)#exit
省两步
4.trunk口
              switch(config)# int f 0/24
switch(config-if)# switchport mode dynamic desirable
switch(config-if)# switchport trunk encapsulation dot1q
需要打两个trunk口
5.vtp  server
          switch(config)# vtp domain aaa
switch(vlan)# vtp mode server
SW1和SW2:
1.        vtp client
  switch(config)# vtp domain aaa
switch(vlan)# vtp mode client
        需要打两个trunk口
2.再把PC机接入对应的端口中
PC机:配网关和IP以及掩码
            你看看有错吗?
10# 2016-5-10 22:16:33 回复 收起回复
回复

使用道具 举报

 楼主| 发表于 2016-5-10 22:28:02 | 显示全部楼层
诺鸡鸭5530 发表于 2016-5-10 22:24
我是直接强起trunk
配置是没有问题的
(1)你最好看下链路 的trunk是否协商成功

谢谢大神了,问题终于查出来了,SW1和SW2的VLAN划分没学习过来,trunk口没打好
11# 2016-5-10 22:28:02 回复 收起回复
回复

使用道具 举报

发表于 2016-5-11 14:19:52 | 显示全部楼层
子网掩码呢?如果是默认的,那它们是在不同网段,如果没有设置网关的话,即使在同一vlan并且开启了路由功能也不会ping通
12# 2016-5-11 14:19:52 回复 收起回复
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2025-2-8 14:25 , Processed in 0.062755 second(s), 13 queries , Redis On.  

  Powered by Discuz!

  © 2001-2025 HH010.COM

快速回复 返回顶部 返回列表