icmp

实验:主机间跨网络通信

一个人想着一个人 提交于 2019-11-27 18:19:48
实验:主机间跨网络通信 实验拓扑图: 第一步:创建四个虚拟机 第二步:配置vmnet6和vmnet8网段 vmnet6:10.0.0.0/8 vmnet8:192.168.38.0/24 vmnet0:172.18.0.0/24 三、如上图所示,配置好每个虚拟机的网卡类型 四、配置IP 第一个虚拟机 [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE=Ethernet BOOTPROTO=static IPADDR=192.168.38.123 NETMASK=255.255.255.0 GATEWAY=192.168.38.2 NAME=ens33 DEVICE=ens33 ONBOOT=yes [root@localhost ~]# systemctl restart network 第二个虚拟机 [root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33 TYPE=Ethernet BOOTPROTO=static IPADDR=192.168.38.200 NETMASK=255.255.255.0 GATEWAY=192.168.38.2 NAME=ens33 DEVICE=ens33 ONBOOT=yes

【RHEL7/CentOS7防火墙之firewall-cmd命令详解】

橙三吉。 提交于 2019-11-27 16:51:11
目录 Firewalld zone firewall-cmd 开始配置防火墙策略 总结 原文: http://blog.gqylpy.com/gqy/318 "Redhat Enterprise Linux7已默认使用 firewalld 防火墙,其管理工具是 firewall-cmd 。使用方式也发生了很大的改变。 基于 iptables 的防火墙已默认不启动,但仍然可以继续使用。 RHEL7中有这几种防火墙共存: firewalld 、 iptables 、 ip6tables 、 ebtables 。 RHEL7的内核版本是3.10,在此版本的内核里防火墙的包过滤机制是 firewalld ,使用 firewalld 来管理 netfilter ,不过底层调用的命令仍然是 iptables 等。 @ *** RHEL7虽然仍有 iptables ,但不建议使用了,而是使用新的 firewalld 服务。 # 查firewalld软件包是否安装 [root@CentOS7 ~]# rpm -q firewalld firewalld-0.5.5-1.fc28.noarch 由于这几种防火墙的 daemon 是冲突的,所以建议禁用其它几种防火墙。 # 禁用方法一: [root@CentOS7 ~]# systemctl mask {iptables,ip6tables

动态路由 RIP

本秂侑毒 提交于 2019-11-27 15:50:32
不同网段之间进行通信,中间有多个路由器的情况下,我们可以通过配置 RIP 动态路由来实现数据转发。 实验拓扑 如图所示连接,地址规划如下: 名称 接口 IP地址 R1 f0/0 192.168.10.1/24 R1 f0/1 192.168.20.1/30 R2 f0/0 192.168.20.2/30 R2 f0/1 192.168.30.1/30 R3 f0/0 192.168.30.2/30 R3 f0/1 192.168.40.1/24 PC1 e0 192.168.10.2/24 PC2 e0 192.168.40.2/24 配置方法 R1(config)#router rip R1(config-router)#network 192.168.10.0 R1(config-router)#network 192.168.20.0 R1(config-router)#version 2 R1(config-router)#no auto-summary R1(config-router)#ex 配置过程 配置 IP 地址 R1 R1#conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#int f0/0 R1(config-if)#ip add 192.168.10.1

Problem with isReachable in InetAddress class

南笙酒味 提交于 2019-11-27 15:08:36
As an assignment I have to find all the alive computers on a LAN. For which I am using isReachable function of InetAddress class. But problem is that nothing is shown reachable to me. So I tried to have isReachable with Google's IP but still this is unreachable. Here is the code: import java.net.*; public class alive{ public static void main(String args[]){ try{ InetAddress ia = InetAddress.getByAddress(new byte[]{(byte)209, (byte)85, (byte)153, (byte)104}); boolean b = ia.isReachable(10000); if(b){ System.out.println("Reachable"); } else{ System.out.println("Unrachable"); } }catch(Exception e

静态路由

独自空忆成欢 提交于 2019-11-27 13:13:02
实验目的:使用静态路由进行路由选择配置。 预配置 第一步 R1 的配置 R1(config)#interface loopback 0 R1(config-if)#ip address 1.1.1 .1 255.255.255.0 R1(config-if)#exit R1(config)#interface serial1/2 R1(config-if)#no shutdown R1(config-if)#ip address 192.168.0.1 255.255.255.0 R1(config-if)#exit R1(config)#interface serial1/3 R1(config-if)#no shutdown R1(config-if)#ip address 172.16.0.1 255.255.255.0 R1(config-if)#exit 第二步 R2 的配置 R2(config)#interface loopback 0 R2(config-if)#ip address 2.2.2 .2 255.255.255.0 R2(config-if)#exit R2(config)#interface serial2/1 R2(config-if)#no shutdown 00:17:02: %LINK-3-UPDOWN: Interface Serial2/1

ICMP和重定向攻击

痴心易碎 提交于 2019-11-27 10:41:38
目录 ICMP数据报格式 smurf攻击 ICMP重定向攻击 基于libpcap的sniffer raw socket 定义包头 解析数据包 重定向 @ ICMP数据报格式 https://zhuanlan.zhihu.com/p/58662573 头部type,code,checksum ,4字节,扩展字段,4字节 icmp作为数据部分封装到ip数据报中 IPv4中的常用type,ipv6与之不同 0:Echo Reply 回显应答,返回数据 ping 3:Destination Unreachable 不可达 5:Redirect (change route) 重定向 8:Echo Request 回显请求,ping 11:time Exceeded for a Datagram,超时 struct icmp { u_int8_t icmp_type; /* type of message, see below */ u_int8_t icmp_code; /* type sub code */ u_int16_t icmp_cksum; /* ones complement checksum of struct tcp、icmp是全部的校验和,ip的只有头部*/ union { u_char ih_pptr; /* ICMP_PARAMPROB */ struct in

查看网络情况 ping 大包 和 tracert 、 traceroute

亡梦爱人 提交于 2019-11-27 10:38:28
 严禁Ping入侵作为大多数防火墙的一个基本功能提供给用户进行选择。   Linux下Ping包的默认大小为64Byte,次数不限。但有时我们需要尝试Ping大数据包,来测试网络的状况,这时,就要指定Ping包的大小了。   Linux下Ping大数据包的格式:   语 法:Ping [-dfnqrRv][-c<完成次数>][-i<间隔秒数>][-I<网络界面>][-l<前置载入>][-p<范本样式>][-s<数据包大小>][-t<存活数值>][主机名称或IP地址]   例如:   1、指定数据包大小为1500Byte:Ping -s 1500 ip   2、指定次数为4次,数据包大小为32767Byte:Ping -c 4 -s 32767 ip   Windows下默认Ping包次数为4次,Ping包大小为32Byte:   1、指定Ping包大小为1500Byte:Ping -l 1500 ip   2、指定次数为6次,Ping包大小为1500:Ping -n 6 -l 1500 ip    注: 查看使用帮助,输入Ping,回车即可。   Ping大包命令为Ping -l 65500,数据包的有效范围从 0 到 65500。Ping命令还有许多有用的功能,供您参考:   Ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [

网络编程—SOCKET开发

倖福魔咒の 提交于 2019-11-27 10:33:18
一、计算机与网络基础知识   1.1、计算机基础知识     应用软件对硬件的操作必须调用操作系统的接口,由操作系统操控硬件     客户端软件想要基于网络发送一条消息给服务端软件的流程:       1、客户端软件产生数据,存放于客户端软件的内存中,然后调用接口将自己内存中的数据发送或拷贝给操作系统内存。       2、操作系统收到数据后,按照客户端软件指定的规则(协议),调用网卡发送数据。       3、网络传输数据。       4、服务端软件调用系统接口,给操作系统发送将数据从操作系统内存拷贝到自己内存中的指令。       5、服务端操作系统收到 4 的指令后,使用与客户端相同的规则(协议),从网卡接收到数据,拷贝给服务端软件。   1.2、什么是网络     网络 = 物理链接介质 + 互联网协议     互联网协议分为 OSI 七层或 TCP/IP 五层 协议      二、TCP / IP 各层详解   2.1、物理层     功能:基于电器特性发送高低电压(电信号),高电压对应数字 1,低电压对应数字 0。   2.2、数据链路层     功能:单纯的电信号 0 和 1 没有任何意义,因此定义了电信号的分组方式,即以太网协议。     2.1.1、以太网协议( ethernet )       1、规定一组电信号构成一个数据包,叫做 ‘帧’。每一帧包含 ‘报头

Why does ping work without administrator privileges?

折月煮酒 提交于 2019-11-27 09:26:21
as you may know one is unable to create RAW sockets using Windows Sockets without having administrative priviliges. The problem is, that I need to send ICMP messages, thus I need RAW sockets. The Problem: My program needs to run without administrative privileges. That lead me to the question, how does the ping tool send ICMP messages w/o administrative privileges? Although ICMP uses RAW sockets (which require admin rights on Win2K and later), Microsoft circumvents its own security rules to allow its ICMP APIs to get through. As such, don't use RAW sockets directly to send your own ICMP ping

ICMP sockets (linux)

此生再无相见时 提交于 2019-11-27 08:45:20
Is it possible to use ICMP sockets under the IP protocol? Maybe something like: socket(PF_INET, <type>, IPPROTO_ICMP)? What should I put in the < type > 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? 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 also glance into that command's source code,