icmp

Limiting ICMP echo replies when creating a PING program

送分小仙女□ 提交于 2019-12-03 17:07:39
I was writing a multithreaded ping program. I created rawsockets on each thread (for each IP) and sent ICMP Echo Request to each using sendto() and then I did recvfrom() in each thread. I am getting messages from IPs in various sockets(like if I had used socket S1 for sendto for IP1, I get echo-replies from IP1 to S1, S2 etc). Do I need to do a bind? Also another problem is that even though I send only 1 ICMP request I get back many echo replies from target. Is there any way I can limit this? This is causing me to miss some of the other ICMP packets. Is there a way for my program to ask the

【转】Ping、Traceroute 工作原理

限于喜欢 提交于 2019-12-03 14:24:36
转自: https://www.jishuwen.com/d/2eEA 在工作开发过程中,我们经常会使用到ping和traceroute。在这里,我们将细述其工作原理,让你在会用的基础之上理解其内部工作过程。 Ping工作原理 Ping 是 ICMP 的一个重要应用,主要用来测试两台主机之间的连通性。Ping 的原理是通过向目的主机发送 ICMP Echo 请求报文,目的主机收到之后会发送 Echo 回答报文。Ping 会根据时间和成功响应的次数估算出数据包往返时间以及丢包率。 Ping的完整工作流程: Ping本质上是ICMP数据包,所以其工作流程就是ICMP数据包的发送与解析流程。大致流程如下: 构造ICMP数据包-->构造IP数据包-->构造以太网数据帧----物理传输到目标主机---->获取以太网数据帧-->解析出IP数据包-->解析出ICMP数据包-->发送回送应答报文 本地主机处理流程: 在本地,ping命令会构建一个ICMP数据包(构造回送请求报文) 将该ICMP数据包和目标IP地址给IP协议,IP协议将本地地址作为源地址,与目的地址等构造IP数据包 根据本地ARP缓存查找目的地址IP对应的MAC地址,如果缓存中没有则通过ARP协议找到对应IP的MAC地址。将MAC地址交给数据链路层以构造数据帧 经物理层发送给目的主机 目的主机处理流程: 目的主机接收到数据包

what would cause ICMPsendEcho to fail when ping.exe succeeds

我的梦境 提交于 2019-12-03 12:43:01
I have an interesting situation on my hands, and I'm not quite sure how to go about troubleshooting it. I did a few searches for something similar to my situation, but nothing quite matches it. If the answer already exists somewhere here, I would appreciate anyone that could point me in the right direction. Ok, to the point. I'm writing a watchdog application for monitoring internet connectivity. Its designed to ping a set of domains at a set interval, and when any of them respond to the ping, the status timer is reset. If the status timer ever goes beyond a set threshold, several stages of

Linux防火墙firewalld安全设置

99封情书 提交于 2019-12-03 08:59:28
背景描述 防火墙是具有很好的保护作用。***者必须首先穿越防火墙的安全防线,才能接触目标计算机。在公司里数据安全是最重要的,要求安全部门进行全公司进行服务器防火墙安全搭建,在原有的基础上进行安全的防火墙设置,有效避免安全隐患等问题,建议大家还是花个十多分钟好好看一下防火墙的理论,这样便于后期问题排查,最后一小节有常用命令操作。 主要内容 1 详细了解防火墙相关配置; 2 详细解读相关安全配置方法; 3 详细解读firewalld防火墙的基础知识; 4 了解firewalld防火墙的配置; 5 了解firewalld防火墙相关命令的使用。 1.Linux防火墙概述 防火墙是指设置在不同网络或网络安全域之间的一系列部件的组合,它能增强机构内部网络的安全性。它通过访问控制机制,确定哪些内部服务允许外部访问,以及允许哪些外部请求可以访问内部服务。它可以根据网络传输的类型决定IP包是否可以传进或传出内部网。 防火墙通过审查经过的每一个数据包,判断它是否有相匹配的过滤规则,根据规则的先后顺序进行一一比较,直到满足其中的一条规则为止,然后依据控制机制做出相应的动作。如果都不满足,则将数据包丢弃,从而保护网络的安全。 Linux系统的防火墙功能是由内核实现的。在2.4 版及以后的内核中,包过滤机制是netfilter.CentOS 6管理工具是iptables,CentOS

ICMP sockets (linux)

匿名 (未验证) 提交于 2019-12-03 08:59:04
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is it possible to use ICMP sockets under the IP protocol? Maybe something like: socket(PF_INET, , IPPROTO_ICMP)? What should I put in the field? I saw some examples using SOCK_RAW, but won't that prevent the OS from doing his job handling the IP protocol? And another thing. How can the OS know to which process he should send the ICMP datagrams, since there are no ports involved with the protocol? 回答1: Yes it is possible, since the ping command does ICMP. To find out the syscalls involved, you can strace that command (under root). You could

Android: ping: icmp open socket: Operation not permitted

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is it possible to execute ping on Android 4.3 without root access? Some people suggest to sudo chmod u+s /system/bin/ping or set the permissions to 777 Is this possible on Android without root? 文章来源: Android: ping: icmp open socket: Operation not permitted

ICMP Ping in WinRT - Is it possible? [duplicate]

匿名 (未验证) 提交于 2019-12-03 08:57:35
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: This question already has an answer here: Is it possible to write a Ping class in C# that will run within Windows 8 Metro environment? 1 answer How to do an ICMP ping in a WinRT Modern UI application? Ping is not implemented in WinRT currently (see related question here ) and the previous strategies in Silverlight being: Use a WCF Service Call Javascript which then calls an ActiveX component Give up ( here ) Vasily here uses http to 'ping' a webserver on a specific port using StreamSocket which supports network communication using

sending ICMP packets in scapy and choosing the correct interface

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can we use the srp() function for a Layer 3 ICMP packet? I see that when we craft an ICMP echo-request packet and use the sr() to send/receive, we do NOT see it getting sent out of the interface , hence no response from the destination. But the same packet if we use the srp() function we see the response. When should we use sr() and when srp()? In the documentation it states sr() is to be used for L3 packet and srp() to be used for L2? But in my case I am not sure why sr() is not working for an ICMP packet? Can some experts please help me

第四次实验报告:使用Packet Tracer理解RIP路由协议

给你一囗甜甜゛ 提交于 2019-12-03 08:39:32
姓名:陈泽镭 学号:201821121121 班级:计算1814 目录 1 实验目的 2 实验内容 3. 实验报告 3.1 建立网络拓扑结构 3.2 配置参数 3.3 测试网络连通性 3.4 理解RIP路由表建立和更新 4. 理解RIP消息传得慢 5. 拓展 1 实验目的 理解RIP路由表的建立与更新 感受RIP坏消息传得慢 2 实验内容 使用Packet Tracer,正确配置网络参数,使用命令查看和分析RIP路由信息。 建立网络拓扑结构 配置参数 分析RIP路由信息 3. 实验报告 3.1 建立网络拓扑结构 网络拓扑图如下图所示: 3.2 配置参数 客户端PC0的IP地址为 192.168.1.121 客户端PC1的IP地址为 192.168.3.122 (1)配置并激活路由器 Router0 接口: 检查: 配置路由器协议: (2) 配置并激活路由器 Router1 接口: 检查: 配置路由器协议: 3.3 测试网络连通性 在PC1,PING PC2,测试整条链路的连通性,给出截图: (第一次连接接收到3个,失去1个) (第二次连接接收到4个,失去0个) 抓到的报文: 3.4 理解RIP路由表建立和更新 查看路由过程的信息 show ip protocols      routering protocols is "rip" 路由协议为rip协议   Sending

第四次实验报告:使用 Packet Tracer理解RIP路由协议

北城以北 提交于 2019-12-03 08:17:54
姓名:曾冠洪 学号:201821121108 班级:计算1814 1 实验目的 理解RIP路由表的建立与更新 感受RIP坏消息传得慢 2 实验内容 使用Packet Tracer,正确配置网络参数,使用命令查看和分析RIP路由信息。 建立网络拓扑结构 配置参数 分析RIP路由信息 3. 实验报告 3.1 建立网络拓扑结构 网络拓扑图如下图所示: 3.2 配置参数 PC0 ip address:192.168.1.108 Route0 Fa0/0 ip address:192.168.1.109 Route0 Fa0/1 ip address:192.168.2.108 Route1 Fa0/0 ip address:192.168.2.109 Route1 Fa0/1 ip address:192.168.3.108 PC1 ip address:192.168.3.110 路由器Route0配置,包括接口的配置和RIP配置   配置并激活端口      • Router>enable # 进入特权执行模式   • Router#configure terminal # 进入全局配置模式   • Router(config)#hostname R # 将路由器名称配置为R   配置G0/0/0接口   • R(config)#interface G0/0/1   • R