环境:

阿里云LB 内网地址类型,代理后面的k8s上的服务

公司和阿里云之间vpn打通

在windows上进行访问一切正常,在相同的办公局域网linux主机内访问不通,mac笔记本访问同样不通,telnet 端口是正常的,就很诡异

抓包,windows安装wireshark,curl该地址,然后对该端口进行抓包,这个时候需要知道MSS这个东西了

在内网linux上或者mac上进行curl 该地址,然后去k8s对应的服务pod内进行tcpdump抓包

 curl "http://10.255.30.26:8080/xxxxxxx&src=linux"  #&src=windows这个后缀自己加的用于筛选抓包的信息

  

tcpdump -i any  -vv -w src-linux  #输出结果到src-linx文件,用于导出到wireshark查看分析使用

  

结果:

从windows正常能访问的上面进行curl 然后在服务端抓包比较,方法和上面相同,把src=linux改成src=windows,这个就是为了筛选结果用,随意命名

对于网络自己不是很清楚,但是和mss的确有关系,相关介绍参看下面

https://blog.51cto.com/virtualadc/692407

https://blog.csdn.net/scythe666/article/details/51967606

最终解决办法,在路由上加了一条

firewall-cmd --permanent --direct --add-passthrough ipv4 -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

  

参考http://www.enerco.si/blog/centos-and-masquerading

https://blog.csdn.net/bytxl/article/details/45027921

原文内容:

The other day I had weird problems with masqueraded connections. Certain HTTP connections were simply going deaf after a random amount of time. The behaviour seemed random at first, but then I discovered that only specific webservers like www.nmap.org or www.speedtest.net are affected. 

The server, doing the masquerading was based on Centos 7. It was also using the new FirewallD system, so I thought the problem might be there. Normally, I wouldn't bother, but this one somehow didn't let me sleep. 

Following the leads, I discovered that certain TCP packets are not coming through. How come, if all the PING replies are there? I could confirm that the really big packets are being lost. This brought me to the TCP fragmentation. 

enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1492
See the MTU (maximum transmission unit) value? I guessed certain packets are not being properly fragmented, thus not passing the route. Doing some reading, I found this:

When a user requests a web site, a client/server negotiation occurs between the PC and the web server that hosts the web site. During the negotiation, a maximum MTU size is negotiated. Since the PC negotiates and its default MTU size is 1500 bytes (Windows 3x, 9x, NT, ME, and so forth), the web server negotiates an MTU size of 1500 bytes. Therefore, regardless of the MTU size you configure on the router, the web server still sends packets up to 1500 bytes in size.

Luckily the guys at Netfilter wrote an extension that solves the problem. In the words of the author.

This patch by Marc Boucher <marc+nf@mbsi.ca> adds a new target that allows you to examine and alter the MSS value of TCP SYN packets, to control the maximum size for that connection. As explained by Marc himself, THIS IS A HACK, used to overcome criminally brain-dead ISPs or servers which block ICMP Fragmentation Needed packets.

Typical usage would be :

# iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

So, applying this to the new firewalld system solved the problem.

firewall-cmd --permanent --direct --add-passthrough ipv4 -I FORWARD -p tcp --tcp-flags SYN,RST SYN
-j TCPMSS --clamp-mss-to-pmtu

A little bit of explanation here.

  

网站windows可以访问mac和linux无法访问【MTU MSS问题】的更多相关文章

  1. Golang 在 Mac、Linux、Windows 下如何交叉编译(转)

    原文地址:Golang 在 Mac.Linux.Windows 下如何交叉编译 Golang 支持交叉编译,在一个平台上生成另一个平台的可执行程序,最近使用了一下,非常好用,这里备忘一下. Mac 下 ...

  2. Golang 在 Mac、Linux、Windows 下如何交叉编译

    转自 https://blog.csdn.net/panshiqu/article/details/53788067 Golang 支持交叉编译,在一个平台上生成另一个平台的可执行程序,最近使用了一下 ...

  3. 在 Mac、Linux、Windows 下Go交叉编译

    Golang 支持交叉编译,在一个平台上生成另一个平台的可执行程序,最近使用了一下,非常好用,这里备忘一下. Mac 下编译 Linux 和 Windows 64位可执行程序 CGO_ENABLED= ...

  4. Linux内核访问外设I/O--动态映射(ioremap)和静态映射(map_desc) (转载)

    [转](转)Linux内核访问外设I/O资源的方式-静态映射(map_desc)方式 Linux内核访问外设I/O资源的方式 Author: Dongas Date: 08-08-02 我们知道默认外 ...

  5. windows下使用远程工具登录虚拟机上的Linux、访问虚拟机上的服务 、端口转发、win7 telnet登陆虚拟机

    首先要清楚virtual box如何设置端口转发: 一篇文章: 如何使用VirtualBox进行端口转发 由于默认的方式是用NAT来做虚拟机网络的,因此如果从外网想访问虚拟机的应用会比较麻烦.以前一直 ...

  6. 在Windows、Mac和 Linux系统中安装Python与 PyCharm

    “工欲善其事,必先利其器”,本文介绍 Python环境的安装和 Python的集成开发环境(IDE) PyCharn的安装.   一.Python安装( Windows.Mac和 Linux) 当前主 ...

  7. 如何选择一款适合自己操作系统、Windows、Mac还是Linux?

    如何选择一款适合自己操作系统.Windows.Mac还是Linux? 作者:我们都很努力着 简介:电脑已经逐渐离不开我们生活,但是如何选择一个我们最佳,最适合的电脑操作系统就成了一些困难选择人士的一个 ...

  8. linux查看访问windows共享目录NT_STATUS_DUPLICATE_NAME问题解决

    linux查看访问windows共享目录NT_STATUS_DUPLICATE_NAME问题解决 [jason@superfreak ~]$ smbclient //powerhouse-smb.my ...

  9. 在Linux下访问Windows共享目录的配置方法

    在Linux下访问Windows共享目录的配置方法 1.在Windows上设置一个共享目录 如:将d:\RedHat_disk设置为共享目录 2.在Windows上创建一个用户,如tommy,密码11 ...

随机推荐

  1. python中方法调用和函数调用的区别

    函数调用: 传几个参数,就会有几个实参方法调用: 默认传递一个参数self,至少要定义一个形参

  2. 150行代码打造.net core生产力工具,你值得拥有

    你是否在初学 .net core时,被依赖注入所折磨? 你是否在开发过程中,为了注入依赖而不停的在Startup中增加注入代码,而感到麻烦? 你是否考虑过或寻找过能轻松实现自动注入的组件? 如果有,那 ...

  3. Nginx. 用http访问https跨域

    用http 访问 https域名, 报跨越问题 解决方法: 在nginx相应服务的转发配置下添加: add_header 'Access-Control-Allow-Origin' 'http://i ...

  4. Sigmoid非线性激活函数,FM调频,胆机,HDR的意义

    前几天家里买了个二手车子,较老,发现只有FM收音机,但音响效果不错,车子带蓝牙转FM,可以手机蓝牙播放音乐,但经过几次转换以及对FM的质疑,所以怀疑音质是否会剧烈下降,抱着试试的态度放了一个手机上的音 ...

  5. 「 从0到1学习微服务SpringCloud 」08 构建消息驱动微服务的框架 Spring Cloud Stream

    系列文章(更新ing): 「 从0到1学习微服务SpringCloud 」01 一起来学呀! 「 从0到1学习微服务SpringCloud 」02 Eureka服务注册与发现 「 从0到1学习微服务S ...

  6. python文件与输入输出

    注:本文档是学习<Python核心编程(第二版)>时的整理. 1.文件对象 文件对象不仅可以用来访问普通的磁盘文件,也可以访问任何其他类型抽象层面上的"文件".一旦设置 ...

  7. 用tensorflow的Eager执行模式

    一.即时执行模式 import tensorflow as tfimport tensorflow.contrib.eager as tfetfe.enable_eager_execution() a ...

  8. 内部类、final与垃圾回收,面试时你一说,面试官就知道

    内部类并不常用,而且使用起来有一定的定式,比如在下面的InnterDemoByTrhead.java里,我们通过内部类的形式创建线程. 1 public class InnerDemoByThread ...

  9. Linux程序守护脚本

    不废话,直接上脚本,[]注释的下发语句需要按需替换: #!/usr/bin/env bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/us ...

  10. 机器学习-TensorFlow应用之classification和ROC curve

    概述 前面几节讲的是linear regression的内容,这里咱们再讲一个非常常用的一种模型那就是classification,classification顾名思义就是分类的意思,在实际的情况是非 ...