icmp

Regarding ICMP “Fragmentation needed, DF bit set” or ICMP packet too big message

南笙酒味 提交于 2020-01-13 05:35:08
问题 I'm injecting ICMP "Fragmentation needed, DF bit set" into the server and ideally server should start sending packets with the size mentioned in the field 'next-hop MTU' in ICMP. But this is not working. Here is the server code: #!/usr/bin/env python import socket # Import socket module import time import os range= [1,2,3,4,5,6,7,8,9] s = socket.socket() # Create a socket object host = '192.168.0.17' # Get local machine name port = 12349 # Reserve a port for your service. s.setsockopt(socket

DDoS攻击工具

£可爱£侵袭症+ 提交于 2020-01-12 09:31:01
DDoS攻击工具 综合性工具 综合性工具除了可以进行DDoS攻击外,还可用于其他的用途,例如:端口扫描、安全审计、防火墙等。实际上,大部分综合性工具开发的原始目的并不是用于DDoS,而是“网络检查或测试工具” Hping ​ Hping是一个编码和解码TCP/IP协议的命令行开发工具,常用于测试网络及主机的安全,同时也可以做安全审计、防火墙测试等工具的标配工具;Hping的命令行就像常用的ping命令,不同的是,它不仅能发送ICMP请求,而且支持TCP、UDP、RAW-IP等协议;Hping的特色在于能够定制数据包的各个部分。 ​ Hping常常别用做网络攻击工具,使用Hping可以方便的额构造DoS攻击,如:ICMP洪水攻击、UDP洪水攻击、SYN洪水攻击等。 ​ Hping的常用功能包括网络压力测试、防火墙测试、端口扫描等。 使用手册: https://www.hi-linux.com/posts/57862.html -H——帮助显示此帮助 -V—版本显示版本 -C——发送数据包的数据项目 -i——间隔发送数据包的间隔时间(u即微秒)(u x表示x微秒,例如-i u1000) ---i u10000的快速别名(每秒10个数据包) ---i u1000的更快别名(每秒100个数据包) --Flood快速发送数据包,不显示返回 -n——数字化输出 -Q——安静安静模式 -i—

Linux网络管理之多网卡绑定

做~自己de王妃 提交于 2020-01-11 02:41:36
  一、bonding介绍   在企业Linux服务器管理里中,服务器的可靠性、可用性以及I/O速度都非常重要,保持服务器的高可用和安全性是生产环境的重要指标,其中最重要的一点是服务器网络连接的高可用性。通常我们会把重要的服务器做主备,其目的在于当主服务器宕机,备份服务器马上接管其主服务器的工作,从而实现服务的连续,不至于服务的停用。还有一种情况,我们会给服务器做负载均衡,当一个服务器对外提供服务,接收到用户请求太多,会导致服务器宕机,这个时候我们用主备显得力不从心,怎么办呢,这个时候我们就需要考虑把原来访问一台服务器的流量,分别用很多台服务器来分担,这样一来把原来一台服务器承受的压力分别用很多台服务器来承担。我们知道一张物理网卡的网络吞吐量是有限的,当服务器上的网卡吞吐量达到上限,这个时候就算性能再好的服务器我们访问它都会感觉慢,这时我们就需要考虑增大网卡的网络吞吐量。一张网卡不够用,我们用两张,三张,很多张。虽然很多张网卡同时对外提供服务是可以解决吞吐量的问题,但是新的问题又产生了,用户怎么知道我们其他网卡上的ip呢?通常情况我们的都是以一个ip对外服务,(当然也有多个ip对外服务,一个域名对外服务,后台可能是多个IP),用户只知道一个ip或者域名,那我们虽然装了很多张网卡,但直接使用好像是达不到我们理想的效果。有没有一种技术将很多张网卡虚拟成一个大的网卡

ping丢包故障处理方法

天大地大妈咪最大 提交于 2020-01-10 18:26:54
ping丢包故障处理方法 1. Ping丢包故障定位思路故障分析 Ping丢包是指Ping报文在网络中传输,由于各种原因(如线路过长、网络拥塞等)而产生部分Ping报文丢弃的现象。在使用Ping命令,出现Ping丢包的现象时,第一步需要确定Ping丢包的网络位置,其次是确定Ping丢包的故障原因,然后依据定位的故障原因再进行解决。 确认Ping丢包的网络位置时一般采用逐段Ping的方法,可以将Ping丢包故障最终确定在直连网段之间。 确认Ping丢包的故障原因一般采用流量统计的方法,通过流量统计可以知道丢弃报文的具体位置、判断故障原因。 导致Ping丢包的原因非常多,也非常复杂,实际故障定位中需要综合考虑各种因素。本文档针对常见Ping丢包故障分析,总结出以下几种常见故障: 物理环境故障;网络环路;ARP问题;ICMP问题。 需要注意并不是Ping丢包就一定表示网络质量差,某些情况下虽然Ping丢包,但是业务是正常的。分析Ping丢包时注意以下两点: 当设备对报文进行硬件转发,速度非常快,就不会丢包。例如,Ping设备端口下挂的电脑。当报文需要CPU进行处理时,CPU繁忙就会丢包。例如:Ping设备上的IP地址。 为了防止网络×××对设备造成影响,设备具有CPU保护功能,对于超过CPCAR(Control Plane Committed Access Rate)值的ARP

iptables常用命令

蹲街弑〆低调 提交于 2020-01-10 18:07:37
# Flush all policy iptables -F iptables -X iptables -Z iptables -t nat -F iptables -t nat -X iptables -t nat -Z iptables -S INPUT #查看链策略,默认是filter表 # Enable ip forward echo "1" > /proc/sys/net/ipv4/ip_forward # module modprobe ip_conntrack_ftp modprobe ip_conntrack_tftp modprobe ip_nat_ftp modprobe ip_nat_tftp # # Default policy iptables -P INPUT DROP iptables -P OUTPUT DROP iptables -P FORWARD ACCEPT # Enable lo interface iptables -A INPUT -i lo -j ACCEPT iptables -A OUTPUT -o lo -j ACCEPT # DNS lookup iptables -A OUTPUT -o eth0 -p udp --dport 53 -j ACCEPT iptables -A INPUT -i eth0 -p udp -

Why is the echo ping not reaching the destination?

给你一囗甜甜゛ 提交于 2020-01-05 10:13:14
问题 I'm trying to implement an ICMP echo ping packet myself using Raw Socket. When taking tcpdump on my Linux machine, I'm finding that the Echo ping request has been successfully sent but when I'm observing the incoming packets in my Windows machine using Wireshark, no incoming ICMP requests are observed. I've written the following code to implement the ICMP echo request and reply. #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h>

C# Raw socket Receiving packets

落花浮王杯 提交于 2020-01-05 07:30:15
问题 Currently trying to implement a simple ping program to teach myself about network programming in C# and .NET. I have managed to initialize a raw socket and correctly build an ICMP echo request packet. When running my program, Wireshark confirms that I am sending an Echo Request to the desired destination, however the remote machine will never send back an echo reply. I have tried sending to multiple machines all with the same result (and each of these machines can be pinged using the Windows

Linux就该这么学08学习笔记

梦想的初衷 提交于 2020-01-04 01:59:20
参考链接: https://www.linuxprobe.com/chapter-08.html 防火墙管理工具 众所周知,相较于企业内网,外部的公网环境更加恶劣,罪恶丛生。在公网与企业内网之间充当保护屏障的防火墙虽然有软件或硬件之分,但主要功能都是依据策略对穿越防火墙自身的流量进行过滤。防火墙策略可以基于流量的源目地址、端口号、协议、应用等信息来定制,然后防火墙使用预先定制的策略规则监控出入的流量,若流量与某一条策略规则相匹配,则执行相应的处理,反之则丢弃。这样一来,就可以保证仅有合法的流量在企业内网和外部公网之间流动了。 在RHEL 7系统中,firewalld防火墙取代了iptables防火墙。 iptables与firewalld都不是真正的防火墙,它们都只是用来定义防火墙策略的防火墙管理工具而已,或者说,它们只是一种服务。iptables服务会把配置好的防火墙策略交由内核层面的netfilter网络过滤器来处理,而firewalld服务则是把配置好的防火墙策略交由内核层面的nftables包过滤框架来处理。 iptables 策略与规则链 防火墙会从上至下的顺序来读取配置的策略规则,在找到匹配项后就立即结束匹配工作并去执行匹配项中定义的行为(即放行或阻止)。如果在读取完所有的策略规则之后没有匹配项,就去执行默认的策略。一般而言,防火墙策略规则的设置有两种:一种是“通”

收发ICMP封包,实现ping

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 03:42:15
1 #include "stdafx.h" 2 3 #include <WINSOCK2.H> 4 #pragma comment(lib, "Ws2_32.lib") 5 6 #define ECHO_REPLY 0 //回应 7 #define ECHO_REQUEST 8 //请求回应 8 9 struct ip_hdr 10 { 11 unsigned char h_len:4; //length of header 12 unsigned char version:4; //Version of IP 13 unsigned char tos; //Type of service 14 unsigned short total_len; //total length of the packet 15 16 unsigned short ident; //unique identifier 17 unsigned short frag_and_flags; //flags 18 19 unsigned char ttl; //ttl 20 unsigned char proto; //protocol(TCP ,UDP etc) 21 unsigned short checksum; //IP checksum 22 23 unsigned int sourceIP; 24

ping 实现设计---ICMP

江枫思渺然 提交于 2020-01-01 03:42:00
发送ICMP报文时,必须程序自己计算校验和,将它填入ICMP头部对应的域中。 校验和的计算方法:   将数据以字为单位累加到一个双字中,如果数据长度为奇数,最后一个字节将被扩展到字,累加的结果是一个双字,最后将这个双字的高16位,低16位相加后取反,便得到了校验和。 下面是checksum的计算校验和的代码: USHORT checksum(USHORT* buff, int size) { unsigned long cksum = 0; while(size>1) { cksum += *buff++; size -= sizeof(USHORT); } // 是奇数 if(size) { cksum += *(UCHAR*)buff; } // 将32位的chsum高16位和低16位相加,然后取反 cksum = (cksum >> 16) + (cksum & 0xffff); cksum += (cksum >> 16); return (USHORT)(~cksum); } Ping程序实例: Ping用来检查主机是否存在,是否可达。 下面是Ping的执行步骤: 1 创建协议类型为IPPROTO_ICMP的原始套接字 2 创建并初始化ICMP封包 3 调用sendto函数向远程主机发送ICMP请求 4 调用recvfrom函数接收ICMP响应 完整代码如下: /////