数据包设置了不允许分片Don't fragment: Set
node2:/root/test#cat t22.py
import socket
import IN
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
hostName = '192.168.137.2'
Port = 8080
s.connect((hostName, Port))
s.setsockopt(socket.IPPROTO_IP, IN.IP_MTU_DISCOVER, IN.IP_PMTUDISC_DO)
#s.setsockopt(socket.IPPROTO_IP, IN.IP_MTU_DISCOVER, IN.IP_PMTUDISC_DONT)
try:
aa='#' * 147
print len(aa)
s.send(aa)
except socket.error:
print 'The message did not make it'
option = getattr(IN, 'IP_MTU', 14)
print 'MTU:', s.getsockopt(socket.IPPROTO_IP, option)
else:
print 'The big message was sent! Your network supports really big packets!'
node2:/root/test#python t22.py
147
The big message was sent! Your network supports really big packets!