我将机器中的tcp初始窗口更改为10,如下所示
[user@site etc]$ sudo ip route change default via 17.255.209.1 dev eth0 proto static initcwnd 10
并tcp_slow_start_after_idle
如下图所示更改
[user@site etc]$ sudo sysctl -a | grep tcp_slow_start_after_idle
net.ipv4.tcp_slow_start_after_idle = 0
IP路由显示确认如下
[user@site etc]$ ip route show
default via 17.255.209.1 dev eth0 proto static initcwnd 10
169.254.0.0/16 dev eth0 scope link metric 1002
17.255.209.0/24 dev eth0 proto kernel scope link src 17.255.209.19
现在,当我在网站上执行tcpdump时,在初始窗口中似乎看不到更改,默认情况下WIN / MSS仍为4。5840/1460 = 4
[user@site etc]$ sudo tcpdump -n -i any 'tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn and port 80'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
11:17:45.048174 IP 21.101.151.198.45873 > 17.255.209.19.http: Flags [S], seq 2008673341, win 5840, options [mss 1460,sackOK,TS val 1724223146 ecr 0,nop,wscale 6], length 0
我对网页进行的卷曲搜索请求了大约30 KB的数据。
[user@machine ~]$ curl http://www.site.com/js/main.js > /dev/null
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 88212 100 88212 0 0 179k 0 --:--:-- --:--:-- --:--:-- 272k
我的方法有什么问题?
核心
[user~]$ uname -r
3.0.4x86_64-linode21
作为更新,这是我尝试google.com时的结果
[user@site ~]$ sudo tcpdump -n -i any 'tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn and host www.google.com'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
17:20:28.033236 IP 17.255.209.19.42799 > 74.125.127.106.http: Flags [S], seq 3148947324, win 14600, options [mss 1460,sackOK,TS val 193695310 ecr 0,nop,wscale 4], length 0
如您所见,在这种情况下,WIN / MSS为14600/1460 = 10
我尝试通过curl从服务器计算机本身访问我的站点,结果如下:
[user@site ~]$ sudo tcpdump -n -i any 'tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn and host www.site.com'
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
17:25:14.584338 IP 17.255.209.19.35008 > 17.255.209.19.http: Flags [S], seq 3894567470, win 32792, options [mss 16396,sackOK,TS val 193981861 ecr 0,nop,wscale 4], length 0
在这种情况下WIN / MSS为32792/16396 = 2