交换机和路由器直连不通,打了流统计发现发送和回复都收到包了,但就是不通
yxzf-H3C-Core-S7506-TRF]display qos policy interface GigabitEthernet 2/5/0
/3
Interface: GigabitEthernet2/5/0/3
Direction: Inbound
Policy: 1
Classifier: 1
Operator: AND
Rule(s) :
If-match acl 3005
Behavior: 1
Accounting enable:
5 (Packets)
Interface: GigabitEthernet2/5/0/3
Direction: Outbound
Policy: 1
Classifier: 1
Operator: AND
Rule(s) :
If-match acl 3005
Behavior: 1
Accounting enable:
5 (Packets)
配置发出来看下
交换机接口port trunk permit vlan 296 这个296就是那个对应的IP地址
你不应该打access?如果你打trunk,要和三层的路由器互通,你trunk 需要打pvid吧
port link-mode bridge description To 乐业县巡察办 port link-type trunk undo port trunk permit vlan 1 port trunk permit vlan 296 1000 1296 port trunk pvid vlan 296 qos apply policy 1 inbound qos apply policy 1 outbound
路由器的接口是怎么配的呢
GE0/4.296 up up 10.172.246.14/30 -- -- GE0/4.1000 up up 10.172.255.196/24 -- -- GE0/4.1296 up up 10.172.247.14/30 -- --
ip address 10.172.246.14 255.255.255.252 ospf timer hello 1 ospf timer dead 3 ospf network-type p2p packet-filter 3001 inbound nat outbound 3000 address-group 1 vlan-type dot1q vid 296
子接口是不是没终结vlan
你要么把交换机把pvid删掉,换回默认vlan1
你交换机配了pvid296,路由器有终结了vlan296,所以其中一边要去掉
策略路由、安全策略、路由协议或QoS策略上。以下是详细的排查步骤:
一、问题分析
从您的流统计信息可以看到:
双向都有5个数据包(可能是ping包)
QoS策略在入向和出向都匹配了ACL 3005
问题可能出现在:QoS策略动作导致丢包、ACL规则不匹配实际流量、策略路由环路等
二、详细排查步骤
1. 查看ACL 3005的具体规则
# 查看ACL 3005配置
display acl 3005
# 或者查看详细配置
display current-configuration | include acl 3005
2. 查看Behavior 1的具体动作
# 查看Behavior配置
display traffic behavior 1
# 查看完整的QoS策略配置
display qos policy 1
3. 检查QoS策略的动作
# 查看Classifier 1和Behavior 1的完整配置
display traffic classifier 1
display traffic behavior 1
# 查看QoS策略的详细动作
display qos policy 1 classifier 1
三、可能的原因及解决方案
原因1:QoS策略动作是deny或redirect
# 如果Behavior配置如下,会导致丢包:
traffic behavior 1
filter deny # 会丢弃数据包
# 或者
redirect xxx # 重定向到其他地方
解决方案:
# 删除或修改QoS策略
system-view
qos policy 1
undo classifier 1 behavior 1
quit
# 或者删除整个策略
undo qos policy 1
# 在接口上取消应用
interface GigabitEthernet 2/5/0/3
undo qos apply policy 1 inbound
undo qos apply policy 1 outbound
quit
原因2:ACL规则不匹配实际流量
# 查看ACL 3005的规则
display acl 3005
# 示例:如果ACL规则是deny,那么匹配的流量会被丢弃
acl advanced 3005
rule 5 deny ip # 拒绝所有IP流量
解决方案:
# 修改ACL规则
system-view
acl advanced 3005
rule 5 permit ip # 改为允许
quit
原因3:存在多个QoS策略冲突
# 检查是否有其他策略
display qos policy interface GigabitEthernet 2/5/0/3 verbose
原因4:策略路由导致环路
# 检查是否有策略路由
display policy-based-route
# 检查接口是否有策略路由
display ip policy-based-route interface GigabitEthernet 2/5/0/3
原因5:安全策略阻止
# 检查安全策略
display security-policy
# 检查域间策略
display zone-pair security
四、完整的排查流程
步骤1:临时移除QoS策略测试
# 在接口上移除QoS策略
system-view
interface GigabitEthernet 2/5/0/3
undo qos apply policy 1 inbound
undo qos apply policy 1 outbound
quit
# 保存配置
save force
# 测试连通性
ping -c 5 对端IP地址
步骤2:如果恢复连通,分析QoS策略问题
# 查看QoS策略详细配置
display qos policy 1 verbose
# 查看流分类和行为的具体内容
display traffic classifier 1
display traffic behavior 1
步骤3:检查其他可能的配置
# 1. 检查接口配置
display interface GigabitEthernet 2/5/0/3
# 2. 检查VLAN配置
display vlan brief
# 3. 检查IP地址配置
display ip interface brief
# 4. 检查ARP表
display arp
# 5. 检查路由表
display ip routing-table
# 6. 检查STP状态
display stp brief
# 7. 检查端口安全
display port-security interface GigabitEthernet 2/5/0/3
五、常见配置错误示例
错误1:QoS策略导致丢包
# 错误配置示例
traffic behavior 1
filter deny # 丢弃所有匹配流量
# 正确配置示例
traffic behavior 1
remark dscp af11 # 重新标记DSCP
# 或者什么都不做(默认permit)
错误2:ACL规则错误
# 错误:ACL deny了需要通过的流量
acl advanced 3005
rule 5 deny ip source 192.168.1.0 0.0.0.255 destination any
rule 10 permit ip # 但此规则可能不生效
# 正确:先permit后deny,或者正确配置规则
acl advanced 3005
rule 5 permit ip source 192.168.1.0 0.0.0.255 destination any
rule 10 deny ip
错误3:端口配置问题
# 检查双工、速率
display interface GigabitEthernet 2/5/0/3
# 确保两端双工、速率一致
# 检查MTU
display interface GigabitEthernet 2/5/0/3 | include MTU
# 确保MTU一致(通常1500)
六、诊断命令汇总
# 1. 综合诊断
display diagnostic-information
# 2. 抓包分析(关键)
# 在交换机上抓包
packet-capture interface GigabitEthernet 2/5/0/3 inbound
packet-capture interface GigabitEthernet 2/5/0/3 outbound
# 3. 查看更详细的流统计
display qos policy interface GigabitEthernet 2/5/0/3 statistics
# 4. 查看会话表(如果有安全策略)
display session table verbose
# 5. 查看CPU使用率
display cpu-usage
# 6. 查看日志
display logbuffer | include GigabitEthernet 2/5/0/3
七、快速解决方案
方案A:完全清除QoS策略
# 备份当前配置
display current-configuration > flash:/backup.cfg
# 清除QoS策略
system-view
interface GigabitEthernet 2/5/0/3
undo qos apply policy 1 inbound
undo qos apply policy 1 outbound
quit
# 删除QoS策略
undo qos policy 1
# 删除流分类和行为
undo traffic classifier 1
undo traffic behavior 1
# 保存并测试
save force
方案B:只修改行为动作
# 如果Behavior是deny,改为permit
system-view
traffic behavior 1
undo filter
quit
# 或者重新配置
traffic behavior 1
remark dscp 0
quit
方案C:创建测试用的permit规则
# 创建新的ACL允许所有
acl advanced 3999
rule 0 permit ip
quit
# 创建新的Behavior
traffic behavior test
permit # 显式允许
quit
# 创建新的流分类
traffic classifier test
if-match acl 3999
quit
# 创建新的QoS策略
qos policy test
classifier test behavior test
quit
# 应用到接口
interface GigabitEthernet 2/5/0/3
qos apply policy test inbound
qos apply policy test outbound
quit
八、预防措施
1. 配置前测试
# 先保存当前配置
save flash:/before_qos.cfg
# 配置QoS前先备份
archive configuration location flash:/
2. 使用commit机制
# 进入配置会话
configuration commit list
# 逐步配置并验证
configuration commit revert timer 10 # 10分钟自动回滚
3. 配置验证脚本
# 创建验证脚本
system-view
diagnostic
diagnostic script check-connectivity
display interface brief
display ip interface brief
ping 对端IP 5
display qos policy interface all
quit
九、后续监控
# 监控QoS策略统计
display qos policy interface GigabitEthernet 2/5/0/3 statistics refresh
# 设置告警
snmp-agent
snmp-agent trap enable qos
总结建议
根据您的现象,最可能的原因是Behavior 1的动作是deny。请按以下顺序排查:
立即执行:
display traffic behavior 1
查看行为动作。如果是filter deny,这就是问题所在。
临时解决:
interface GigabitEthernet 2/5/0/3
undo qos apply policy 1 inbound
undo qos apply policy 1 outbound
quit
然后测试连通性。
根本解决:
# 查看完整配置
display current-configuration | section policy
display current-configuration | section behavior
display current-configuration | section acl 3005
# 根据实际业务需求重新配置QoS策略
如果您能提供以下信息,我可以给出更精确的建议:
display traffic behavior 1的输出
display acl 3005的输出
接口的IP地址配置
ping测试的具体参数(源IP、目的IP等)
看看对端接口情况
ip address 10.172.246.14 255.255.255.252 ospf timer hello 1 ospf timer dead 3 ospf network-type p2p packet-filter 3001 inbound nat outbound 3000 address-group 1 vlan-type dot1q vid 296
ip address 10.172.246.14 255.255.255.252 ospf timer hello 1 ospf timer dead 3 ospf network-type p2p packet-filter 3001 inbound nat outbound 3000 address-group 1 vlan-type dot1q vid 296
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
都测试了还是不行 现在重启一下路由器试一下