深入理解iputils网络工具-第5篇 arping:地址解析程序

接收arp请求并发送回应的实例 本文简单介绍了arp协议,用一个实例查看收到的ARP请求,并对该请求发出ARP回应,实例有完整的源代码,使用C语言在Linux下实现,代码中有详细的注释 阅读详情

5.1       引言

    ARP协议是“Address Resolution Protocol”(地址解析协议)的缩写。在同一以太网中,通过地址解析协议,源主机可以通过目的主机的IP地址获得目的主机的MAC地址。arping程序就是完成上述过程的程序。

    ARP协议可以参看RFC 826。

5.2       arping程序的使用

    敲入命令:

lixi@lixi-desktop:~/temp/iputils/iputils-s20071127$ arping 210.45.74.29 -c 1 -D
ARPING 210.45.74.29 from 0.0.0.0 eth0
Unicast reply from 210.45.74.29 [00:40:D0:59:CD:D3]  0.684ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)

    在本地主机的局域网内有一台IP地址为210.45.74.29的主机,所以会接到一个回复。

lixi@lixi-desktop:~$ arping 210.45.74.28 -c 1 -D
ARPING 210.45.74.28 from 0.0.0.0 eth0
Sent 1 probes (1 broadcast(s))
Received 0 response(s)

    向一个不存在的IP发送报文不会接受到回复。

root@lixi-desktop:~# arping 210.45.74.25 –U
root@lixi-desktop:~# tcpdump arp -n | grep 210.45.74.25

    得到输出结果如下:

11:03:13.848653 arp who-has 210.45.74.25 (ff:ff:ff:ff:ff:ff) tell 210.45.74.25

    这里就是一个免费ARP的例子。

    -A

        与-U选项类似,但是发送的是ARP 回复报文,而不是ARP请求报文。

    -b

        只发送MAC级别的广播。一般的arping开始时发送广播,在接受到回复后开始发送单播。

    -c <count>

        在发送count个ARP请求后就退出。在和deadline选项一起使用时,arping程序一直等到收到count个ARP回复报文或者时间消耗完毕时才退出。

   -D    

        重

arping命令详解:IP转MAC与网络故障排查实战 在以太网调试与网络运维中,IP地址与MAC地址的对应关系是定位故障的基础。ARP(地址解析协议)负责将逻辑IP映射为物理MAC地址,而arping命令正是基于这一原理,直接在二层网络发起ARP请求并等待响应,从而快速获取目标主机的MAC地址。与常见的ping不同,arping工作在数据链路层,即使目标主机未配置IP或三层网络不通,只要网卡存活就能响应,因此在设备上线、IP冲突检测、交换机端口定位、虚拟机网卡漂移等场景中更具实用价值。本文从ARP协议工作原理出发,系统讲解arping的常见用法、参数细节、整网 阅读详情

相关推荐

llama.cpp部署大模型

llama.cpp如何部署大模型

Eddy的博客 977

麒麟银河操作系统V10部署ffmpeg(也能用于Linux系统)

部署ffmpeg用来处理视频的各种操作,如编码解码,格式转换,剪辑,处理实时视频流,音频流,加滤镜等

zhouwenxing666的博客 9041

Miniforge3部署教程,完美替代Anaconda3

大背景不介绍了,哎!直接上教程!

zzy_ucas的博客 1万+

海康VisionMaster全局通信实战:从数据接收到流程触发

本文详细解析了海康VisionMaster全局通信的实战应用,重点阐述了如何通过配置通信模块与编写全局脚本,实现从外部设备(如PLC)接收数据并触发内部视觉流程。文章以TCP/IP通信为例,深入讲解了数据接收、解析、全局变量设置及流程触发的核心代码与调试技巧,帮助用户打通自动化项目中的设备联动关键环节。

weixin_29295541的博客 569

【二.图像处理核心技术】【5.形态学操作:腐蚀/膨胀/开闭运算】

想象一下,你拍了一张布满雪花点的老照片,或者扫描了字迹断裂的文档,这时候形态学操作就是你的像素整形师!它们能让模糊的边界变清晰,把断裂的笔画连起来,甚至从X光片里揪出癌细胞。今天我们要聊的,是计算机视觉界的"广场舞双雄"——腐蚀和膨胀。这俩操作就像给像素点们请了个健身教练,要么集体减肥(腐蚀),要么组团增肌(膨胀)。下次当你用美颜相机时,不妨会心一笑——这看似魔法的背后,正是形态学在默默耕耘。腐蚀的规则很简单:如果一个像素点周围的邻居不全白,它就"狗带"(变黑)。:先用砂纸打磨(腐蚀),再喷漆填补(膨胀)

商务合作|问题讨论|交流学习 请联系作者微信,加微信请务必注明来意,博客主页有联系方式 426

RK3588 Android12 添加HDMI和喇叭声音通道切换选项

rk3588 android12系统默认接hdmi out时,声音会切换到hdmi out输出,主板声卡喇叭输出会没有声音输出。现在添加一个选项设置hdmi out时,声音可以保持主板声卡喇叭输出。

Android系统开发笔记 4163

新政下的绿电直连项目经济性分析:模式创新与价值重构

随着全球气候治理与低碳转型进程不断加速,绿电直连作为新能源就近消纳的创新模式,正成为破解新能源消纳瓶颈、规避碳关税壁垒的核心路径。2025年9月,国家发展改革委、国家能源局发布《关于完善价格机制促进新能源发电就近消纳的通知》(1192号文),为绿电直连项目的经济性分析与效益测算提供了明确的政策依据。本文将基于新政框架,深入解析绿电直连项目的经济性影响因素、盈利模式与优化路径,并结合案例与量化模型,为项目投资决策提供系统参考。

getusushu的博客 140

AI Agent开发大全第一课-AI是什么以及如何使用AI

近年来,人工智能的迅猛发展引发了广泛的关注,尤其是“大模型”这一概念越来越深入人心。大模型,顾名思义,通常指的是那些拥有大量参数、能够处理复杂任务的机器学习模型。与传统小模型相比,大模型在数据处理、信息理解和生成等方面表现更加出色。为了理解为什么现在的AI被称为大模型,我们需要深入探讨几个关键因素。立角色是指在提示词中清晰地界定交互双方的身份。明确用户希望模型扮演的角色,可以帮助模型更准确地理解上下文和用户需求。

打造全国最全的AI Agent开发知识领域的博客 1406

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

上一篇: 深入理解iputils网络工具-第4篇 tracepath:路由追踪程序
下一篇: 深入理解iputils网络工具-第6篇 rarpd:逆地址解析程序
存储李希
博客等级 码龄15年 418粉丝 69原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值