高分求高手
是这样的,我住的这个房东的网速原来一直很好。但是近来网速慢的出奇!!有时候qq登上去都能自动掉下来。每次我就发现网线就掉了,然后在链接上的时候网速开始就能好一点点。房东给我说是他重启路由器了。要不然实在是没办法了。
我就想问问高手们,我咋才能知道是不是这里面有人在捣乱。因为原来网速一直很好呀! 还有我和房东挺熟的,他让我帮他弄,所以我现在可以等上去路由器。 记得原来上学的时候老师给我们教过原始套接字 还写过一点小程序,我用我的程序运行的结果是这样的:
~ 1 MAC: 00:50:56:C0:00:08==>FF:FF:FF:FF:FF:FF
2 2 IP: 192.168.227.1 => 192.168.227.255
3 3 Protocol: UDP,source port: 138,dest port: 138
4 4 MAC: 00:50:56:C0:00:08==>FF:FF:FF:FF:FF:FF
5 5 IP: 192.168.227.1 => 192.168.227.255
6 6 Protocol: UDP,source port: 138,dest port: 138
7 7 MAC: 00:50:56:E5:30:2B==>00:0C:29:76:22:D7
8 8 IP: 192.168.227.254 => 192.168.227.128
9 9 Protocol: UDP,source port: 67,dest port: 68
10 10 MAC: 00:50:56:C0:00:08==>FF:FF:FF:FF:FF:FF
11 11 IP: 192.168.227.1 => 192.168.227.255
12 12 Protocol: UDP,source port: 138,dest port: 138
程序的源代码是这样
/***************SimpelSniffer.c*************/#include <stdio.h>#include <unistd.h>#include <sys/socket.h>#include <sys/types.h>#include <linux/if_ether.h>#include <linux/in.h>#define BUFFER_MAX 2048int main(int argc, char *argv[]){ int sock, n_read, proto; char buffer[BUFFER_MAX]; char *ethhead, *iphead, *tcphead, *udphead, *icmphead, *p; if((sock = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_IP))) < 0) { fprintf(stdout, "create socket error\n"); exit(0); } while(1) { n_read = recvfrom(sock, buffer, 2048, 0, NULL, NULL); /* 14 6(dest)+6(source)+2(type or length) + 20 ip header + 8 icmp,tcp or udp header = 42 */ if(n_read < 42) { fprintf(stdout, "Incomplete header, packet corrupt\n"); continue; } ethhead = buffer; p = ethhead; int n = 0XFF; printf("MAC: %.2X:%02X:%02X:%02X:%02X:%02X==>" "%.2X:%.2X:%.2X:%.2X:%.2X:%.2X\n", p[6]&n, p[7]&n, p[8]&n, p[9]&n, p[10]&n, p[11]&n, p[0]&n, p[1]&n, p[2]&n, p[3]&n, p[4]&n, p[5]&n); iphead = ethhead + 14; p = iphead + 12; printf("IP: %d.%d.%d.%d => %d.%d.%d.%d\n", p[0]&0XFF, p[1]&0XFF, p[2]&0XFF, p[3]&0XFF, p[4]&0XFF, p[5]&0XFF, p[6]&0XFF, p[7]&0XFF); proto = *(iphead + 9); p = iphead + 20; printf("Protocol: "); switch(proto) { case IPPROTO_ICMP: printf("ICMP\n");break; case IPPROTO_IGMP: printf("IGMP\n");break; case IPPROTO_IPIP: printf("IPIP\n");break; case IPPROTO_TCP : case IPPROTO_UDP : printf("%s,", proto == IPPROTO_TCP ? "TCP": "UDP"); printf("source port: %u,",(p[0]<<8)&0XFF00 | p[1]&0XFF); printf("dest port: %u\n", (p[2]<<8)&0XFF00 | p[3]&0XFF); break; case IPPROTO_RAW : printf("RAW\n");break; default:printf("Unkown, please query in include/linux/in.h\n"); } }}
[解决办法]
那个c程序有些难度哦 我是看不懂的!
要是你和其他人公用路由可能是arp欺骗!你的数据包被其他人恶意的捕获了,也有可能是谁给你的路由进行了流量控制!
[解决办法]
1.进入路由器看看是不是有人更改了自己的上下行速率.
2.打电话给电信最直接的解决方法,他们应该没有做限速吧.
3.确信你们的电脑没毒吧.
4.一般来说,宽带出现速度慢,你首先检测是否有掉包现象,如果有,就可能是线路或路由器出现问题。如果ping 正常,说明是设置问题,建议你检查一下IP获取情况(电脑直接连接宽带而不通过路由器,看是否能正常获取IP)
5.部分路由使用的插头(即稳压器)电压不稳,造成路由工作不正常