ARP 浅析

By | 05/28/2017

ARP 浅析

ARP(Address Resolution Protocol)

网络层(IP 地址)将数据包发送出去时,需要确定链路层地址(MAC),ARP 正是提供这种转换的协议。

ARP 请求寻址

当主机 A(IP 地址为 IP—A)的主机需要和主机 B(IP 地址为 IP-B)通信时,A 会先查询本机的路由表,决定下一跳发往哪里。

如果 IP-B 和 IP-A 在同一个子网,A 会查本机的 ARP 缓存,得到 IP-B 对应的 mac 地址,并将数据包的目标 mac 改为 IP-B 对应的 mac 地址,从对应网卡发出。如果 A 的 ARP 缓存里没有 IP-B 对应的 mac 地址,A 会先发一个 ARP 广播包(broadcast),B 会发一个 单播包(unicast) 响应这个 ARP 包;A 收到这个单播包后,会更新本地的 ARP 缓存,并将数据包发出。

如果 IP-B 和 IP-A 不在同一个子网,A 会将数据包发到路由表里指向的下一跳地址。同样的,发往下一跳地址的过程中,也需要通过 ARP 缓存或 ARP 广播来确定下一跳的 mac 地址。

  1. ARP 只在同一个二层网中使用。
  2. ARP 寻址过程中,发出的请求是广播包,收到的请求是单播包。
  3. 广播包会发送给除本机外的所有其它主机。所以如果 arping 自己的 IP,没有人会回包。

常用命令

  • 主机上抓 ARP 数据包
tcpdump -i eth0 arp -v
  • 查看本机的 arp 缓存
ip neighbour

arp -an
  • 通知更新 ARP caches
arping -U # 发送 ARP REQUEST,更新 ARP caches.

arping -A # 发送 ARP REPLY

常见问题

Q1: 如何判断一个 LAN 中,IP 地址冲突了?
A: 通过 arping。

root@hostA:~# arping -I eth0 -c 1 172.31.20.64
ARPING 172.31.20.64 from 172.31.20.10 eth0
Unicast reply from 172.31.20.64 [03:54:12:D0:40:AF]  0.861ms
Unicast reply from 172.31.20.64 [03:54:12:D1:3B:AF]  0.792ms
Sent 1 probes (1 broadcast(s))
Received 2 response(s)
root@hostA:~#

如果出现如上结果,即有不同 MAC 的回包,说明 IP 地址冲突了。

参考

1,448 thoughts on “ARP 浅析

  1. sv388aduayam.net

    Thank you for the good writeup. It in reality used to be
    a entertainment account it. Glance complex to more added agreeable from you!
    However, how could we keep up a correspondence?

    Reply
  2. CliftonJef

    information security analytics [url=https://newsmee.ru]https://newsmee.ru[/url] how to send zip files mac

    Reply
  3. 스포츠게임

    Usually I don’t read post on blogs, however I would like to say that this write-up very forced
    me to check out and do so! Your writing taste has been surprised me.
    Thanks, very great post.

    Reply
  4. CharitaPrPl

    essay writing website
    [url=”https://bestsessays.org”]custom essay writing toronto[/url]
    law school essay editing service

    Reply
  5. EOS파워볼

    Otherwise, the prize is forfeited and the dollars remains
    in the lottery’s prize fund to pay future jackpots won by Hoosier
    Lottery players.

    Have a look at my homepage … EOS파워볼

    Reply
  6. leci123

    My brother recommended I might like this blog. He was totally right.
    This post truly made my day. You can not imagine just
    how much time I had spent for this information! Thanks!

    Reply
  7. Mom

    Yes. Before a patient can legally use medical marijuana in Washington, the patient must complete registration and be listed in the medical marijuana database. However, Washington medical marijuana database registration cannot be completed until an applicant obtains a medical marijuana authorization from a healthcare practitioner. Zen Leaf is a medical marijuana dispensary located in Washington, PA. To be a Washington State medical marijuana patient, you must be a resident of the state under the care of a healthcare practitioner for your qualifying medical condition and provided a Medical Marijuana Authorization Form from your healthcare practitioner allowed to authorize marijuana for medical purposes.  We have the following pages describing the steps to becoming a marijuana producer, processor or retailer in Washington: https://nnnpodcast.com/forum/profile/tia617196202663/ He also promised if he is re-elected prime minister that he would increase funding to help the RCMP target marijuana grow-ops and meth labs by 20 per cent. A. The next Conservative leader should be Canada’s leading advocate for an elected Senate. There is a general lesson here. Prohibitions may appeal to the electorate, especially to the supporters of socially conservative political parties. They are emotionally satisfying in their simplicity: “This is bad; it should be banned!” But policy-makers should base their policy decisions on evidence rather than on emotional appeal. If they choose to implement prohibitionist policies, they should monitor the degree to which they are able to effectively enforce the prohibition, and they should be ready to change course if prohibition proves impossible.

    Reply
  8. http://hannahsouthgate.com/

    sw418 Sabong Online (http://hannahsouthgate.com/)
    of course like your web site but you need to test the
    spelling on quite a few of your posts. Several of them are rife with
    spelling problems and I find it very bothersome to inform the reality
    on the other hand I will certainly come again again.

    Reply
  9. Markus

    gaming dashboard (Markus)
    I used to be suggested this blog by my cousin. I’m not certain whether or not this publish is written by him as nobody else recognize such distinct about my problem.
    You are wonderful! Thanks!

    Reply
  10. Twepe

    Live Bitcoin Casinos are basically online gambling sites that offering live casino games hosted by a live dealer. These became extremely popular in recent years as players can get the thrill of online casino games with a dealer, much like traditional physical casinos. Also, Bitcoin live casino games are very often operated by real people and not machines, a factor that makes online gambling much more trustworthy and exciting. Operating since 1991, Wild Casino is a true veteran in the online casino space. Like NetBet, Wild Casino isn’t a dedicated crypto casino, but they do allow crypto betting through a decent range of cryptocurrencies including Bitcoin, Bitcoin Cash, Ethereum, Litecoin, and even Ripple. Electrosteel Castings Limited (ECL) products include Flange Pipe, Ductile Iron Pipes, Ductile Iron Fittings and Restrained Pipe. https://macrohint.com/community/profile/roscoecarmichae/ UPCOMING EVENTS In 4 Simple Steps, I will show you how to use Hard Rock Blackjack & Casino.apk app on your Phone once you are done downloading it: The Seminole Hard Rock Hollywood offers a few mobile apps that can be played on mobile devices. The first two, Hard Rock Pop & Crush and Hard Rock Bubble Shooter, are typical mobile games that do not have gambling aspects apart from the names. Like we mentioned above, the Seminole Hard Rock Hollywood has two live venue options: one for music and the other for comedy. Big names are a regular at the Seminole Hard Rock, including Billy Joel, Frankie Valli, Trevor Noah, and Steve Martin, among many others. Free Bet Blackjack is a variation of the standard game twenty-one. The object of the game is to have or make a hand total that will be closer than the dealer to 21, but not exceed 21. However, if the dealer draws to 22, everyone at the table will tie (push). With a “Push 22” side bet, you can get paid as high as 50 to 1 on a dealer suited 22. Come try your luck with Free Bet Blackjack today!

    Reply
  11. Pneutle

    CYP2C9 inhibition by tamoxifen may also be important for other CYP2C9 substrates with low therapeutic index like acenocoumarol, phenytoin and oral antidiabetics how does clomid work Adjust doses subsequent to the initial dose according to the hematologic response of the patient to the preceding dose

    Reply
  12. mysleno

    It was noted many years ago that IBCs overexpressing certain membrane growth factor receptors EGFR, HER2, and fibroblast growth factor receptor were often ER negative 16 18, suggesting that this subset of tumors selected alternate mechanisms of growth bypassing the classical estrogen induced mitogenic pathway diuretic lasix buy Clin Ther 29 2 230 241

    Reply
  13. tierverry

    Scleraxis is a basic helix loop helix transcription factor that plays a central role in promoting tenocyte proliferation and matrix synthesis during embryonic tendon development doxycycline n 8 mice group

    Reply
  14. DarrylTor

    [url=http://colchicine.sbs/]colchicine 0.5 mg tablet[/url] [url=http://sildenafilgen.online/]where to buy sildenafil online[/url] [url=http://buyacyclovir.life/]how much is zovirax[/url] [url=http://acyclovirtabs.shop/]400 mg acyclovir tablets[/url] [url=http://buypropeciawithoutprescription.com/]propecia cost in canada[/url] [url=http://neurontinv.online/]neurontin 500 mg[/url]

    Reply
  15. Stevenvtla

    plano plastic surgery [url=https://board.radionomy.com/memberlist.php?mode=viewprofile&u=382953]nutrition counselor certification[/url] lakeland community colleg

    Reply
  16. slot gacor

    I loved as much as you’ll receive carried out right here.
    The sketch is tasteful, your authored subject matter stylish.
    nonetheless, you command get bought an impatience over that you
    wish be delivering the following. unwell unquestionably come further formerly again as exactly the same nearly a lot often inside case you shield this increase.

    Reply
  17. sildenafil vs cialis

    pautas what works best cialis or viagra keystrokes cialis 20 mg
    4 tablet knowledge base tadalafil citrate – cialis dosage for maximum effect [url=http://walmart-tadalafil.net/#]cost of cialis[/url] herinnering cialis and alcohol side effects topics

    Reply
  18. Article

    I think the admin of this web page is truly working hard in favor
    of his web page, for the reason that here every stuff is quality based information.

    Reply
  19. fafaslot

    Oh my goodness! Incredible article dude! Thank you, However I am going
    through difficulties with your RSS. I don’t understand why I can’t
    join it. Is there anybody else having the same RSS issues?
    Anybody who knows the answer can you kindly respond? Thanx!!

    Reply
  20. tierverry

    To test this hypothesis, we deleted the proinflammatory gene encoding 12 15 lipoxygenase Alox15 in ОІ cells of non obese diabetic mice at a pre diabetic time point when islet inflammation is a feature doxycycline dogs Serum free sFLT1 is decreased in mice injected with MAB0702 compared to isotype control

    Reply
  21. 안전놀이터

    I’m amazed, I have to admit. Rarely do I encounter a blog that’s both
    educative and engaging, and without a doubt, you have hit the nail
    on the head. The issue is an issue that not enough folks are speaking intelligently about.
    I am very happy I stumbled across this in my hunt for something regarding this.

    Reply
  22. pragmaticplay

    First off I want to say superb blog! I had a quick question which I’d like to ask if you don’t mind.
    I was interested to find out how you center yourself and clear your thoughts before
    writing. I have had a tough time clearing my mind in getting my ideas out.
    I truly do take pleasure in writing but it just seems like the first 10
    to 15 minutes are usually lost just trying to figure out how to begin. Any ideas or hints?
    Thanks!

    Reply
  23. webpage

    I don’t even understand how I stopped up right here, however I assumed this put up used to be great.
    I do not know who you might be but definitely you are
    going to a well-known blogger for those who aren’t already.
    Cheers!

    Reply
  24. baked bar

    Why people still use to read news papers when in this technological globe everything is accessible on web?

    Reply
  25. preargy

    com 20 E2 AD 90 20Viagra 20Magnus 20Masticables 20Envios 20 20Viagra 20Precisa 20De 20Receita 20Mdica 20Portugal viagra magnus masticables envios The article recently published in the Kansas City Star did not include all the facts as to what transpired in a 2012 criminal case 5 mg tamoxifen study

    Reply
  26. 김포홈타이

    Attractive part of content. I just stumbled upon your weblog and in accession capital to assert that
    I acquire in fact loved account your weblog posts.
    Anyway I will be subscribing in your feeds or even I success you get entry to constantly quickly.

    Reply
  27. vivo slot

    What’s up, after reading this amazing article i am as well glad to share
    my experience here with colleagues.

    Reply
  28. deposit dana

    This is a good tip particularly to those new to the blogosphere.
    Short but very precise information… Many thanks for
    sharing this one. A must read article!

    Reply
  29. leci 123

    Awesome! Its genuinely remarkable article, I have got
    much clear idea concerning from this article.

    Reply
  30. meeneCape

    chased down Keselowski in the closing laps, but Keselowski held off his Penske teammate by 0 priligy cvs This is the prime tourist season for the Smokies, when many of the small businesses around the park make most of their money, and I urge Congress to pass this legislation quickly

    Reply
  31. Marystics

    [url=http://azithromycinz.online/]buy zithromax pills[/url] [url=http://familydrugstore.quest/]canadian pharmacy online cialis[/url] [url=http://cymbalta.life/]cymbalta from canada price[/url] [url=http://lasixztab.monster/]where to buy furosemide 80 mg[/url]

    Reply
  32. anaetry

    stromectol 3mg Therefore, minor changes in cholesterol levels in plasma and tissues could impact the production of these ligands and nuclear receptor activity

    Reply
  33. Blogs

    I am extremely impressed with your writing skills as well as with the layout on your blog.
    Is this a paid theme or did you modify it yourself?

    Anyway keep up the nice quality writing, it is rare to see a
    nice blog like this one nowadays.

    Reply
  34. IsidroMaH

    акацуки для девочек гадания мегабанк интернет платежи https://alexanow.ru гомель купить белье для мужчин как отделить аудио от видео mp4

    Reply
  35. Serparm

    Case Discussion Although Kratom s availability and multiple first hand reports by users are readily available on the Internet, there are very few case reports by medical personnel or poison centers stromectol wiki

    Reply
  36. Goldankauf

    I’m gone to say to my little brother, that he should also pay a quick
    visit this web site on regular basis to take updated from hottest
    gossip.

    Reply
  37. ilikecomicsonline.com

    ใครที่อยากเริ่มต้นเข้ามา แทงบอล ง่าย ๆ
    แบบไม่ต้องงทุนมาก สามารถเข้ามา สมัครแทงบอล กับ fafa212 เว็บพนันออนไลน์ครบวงจร ได้ง่าย ๆ ผ่านระบบอัตโนมัติ ที่มีความทันสมัย สะดวกสบาย ตอบโจทย์การใช้งานได้เป็นอย่างดี และยังสามารถเข้ามา

    สมัครผ่านช่องทาง Line @FAFA212BET ได้อีกด้วย มีพนักงานคอยบริการและตอบลูกค้าตลอด 24 ชั่วโมงโดยไม่มีวันหยุด หากมีปัญหาในการสมัคร หรือการเล่น สามารถติดต่อสอบถามได้ตลอด 24
    ชั่วโมง ด้วยการให้บริการที่ดีที่สุด ทำให้ fafa212
    เป็น เว็บแทงบอลออนไลน์ อันดับ 1 ของไทย ไปเลย

    Also visit my blog post แทงบอลออนไลน์
    (ilikecomicsonline.com)

    Reply
  38. Home Care Agency

    It’s hard to come by well-informed people on this topic,
    however, you seem like you know what you’re talking about!
    Thanks

    Reply
  39. poker online idnplay

    Kerap-seringlah untuk membaca gerakan musuh, pada
    tehnik bermain musuh terlebih jika kalian telah ada di satu meja
    adanya sebagian pemain senior jadi perlu kalian lihat dengan jeli apa saja yang akan mereka kerjakan di
    meja perjudian lalu aplikasikan yang memang perlu diterapkan jadi menambah pengetahuan kalian yang mengenai tehnik bermain.

    Reply
  40. Open Content

    Hi! Do yoou know if they make any plugins to assist with SEO?
    I’m trying tto get my blog to rank for some targeted keywords but I’m not seeing very good gains.
    If you know of anny please share. Thank you!

    Reply
  41. pop over here

    You completed some good points there. I did a search on the matter and found the majority of folks will agree with your blog.

    Reply
  42. this website

    I like what you guys are usually up too. This sort of clever work and coverage! Keep up the fantastic works guys I’ve incorporated you guys to blogroll.|

    Reply
  43. plesCrype

    Anadrol as well as a few other steroids can be found in many different preparations, most notably in topical and oral preparations, best type of steroids for muscle gain cialis 20 mg

    Reply
  44. Musiali

    If I had to do it again I would gladly take the tamoxifen and now I would ask my doctor to put me on Femara online cialis Lovastatin inhibits low density lipoprotein oxidation and alters its fluidity and uptake by macrophages in vitro and in vivo studies

    Reply
  45. Dildheelm

    Such a case would require evidence that Zimmerman harbored racial animosity against Martin cialis 5 mg best price usa b By interacting with tumor associated macrophages TAM through Snail a soluble factor product of a Wnt regulated gene which can in turn increase beta catenin activity by IL 1ОІ

    Reply