arp
TCP/IP:
協議 數據
應用層 http、telnet、ftp、smtp等 數據
傳輸層 tcp、udp 數據段
網絡層 ICMP、ip、IGMP 報文分組
數據鏈路層 arp、rarp 幀
物理層 比特
任務:
過程:
1.arp(Address Resolution Protocol,地址解析協議),我的記法:地址解析P
2.arp目的:根據 ip得到mac
3.源主機想與目標主機通訊,這個時候arp列表有這個ip就通訊,沒有就向本地網段發arp廣播,查目標主機的mac地址
4.查到了然後呢,記下來唄,記下來做啥,就是不用高德地圖了,不用吧全部路都走一遍?恩,應該是,然後按照記的路走就完事兒了啊
- linux下不知道arp命令
arp -help
#使用查看幫助
hkzck@hkzck-PC:~$ arp -help
Usage:
arp [-vn] [<HW>] [-i <if>] [-a] [<hostname>] <-Display ARP cache
arp [-v] [-i <if>] -d <host> [pub] <-Delete ARP entry
arp [-vnD] [<HW>] [-i <if>] -f [<filename>] <-Add entry from file
arp [-v] [<HW>] [-i <if>] -s <host> <hwaddr> [temp] <-Add entry
arp [-v] [<HW>] [-i <if>] -Ds <host> <if> [netmask <nm>] pub <-''-
-a display (all) hosts in alternative (BSD) style
-e display (all) hosts in default (Linux) style
-s, --set set a new ARP entry
-d, --delete delete a specified entry
-v, --verbose be verbose
-n, --numeric don't resolve names
-i, --device specify network interface (e.g. eth0)
-D, --use-device read <hwaddr> from given device
-A, -p, --protocol specify protocol family
-f, --file read new entries from file or from /etc/ethers
<HW>=Use '-H <hw>' to specify hardware address type. Default: ether
List of possible hardware types (which support ARP):
ash (Ash) ether (Ethernet) ax25 (AMPR AX.25)
netrom (AMPR NET/ROM) rose (AMPR ROSE) arcnet (ARCnet)
dlci (Frame Relay DLCI) fddi (Fiber Distributed Data Interface) hippi (HIPPI)
irda (IrLAP) x25 (generic X.25) eui64 (Generic EUI-64)
- woc看着-a 和 -e像啊,那就都看看
arp -a
hkzck@hkzck-PC:~$ arp -a
? (10.10.255.254) at ac:61:75:d0:20:ad [ether] on enp2s0
顯示的什麼玩意兒又是ip又是mac的
查一下
ip:10.10.255.254
mac:61:75:d0:20:ad
ether:10M標準以太網
enp2s0:接口名字???百度查了說是新的網卡命名...不是現在重點,放着..
arp -e
hkzck@hkzck-PC:~$ arp -e
Address HWtype HWaddress Flags Mask Iface
10.10.255.254 ether ac:61:75:d0:20:ad C enp2s0
address(ip地址):10.10.255.251(十進制)
HWtype(Hard Work type硬件類型):ether(10M以太網)
HWaddress(硬件地址): ac:61:75:d0:20:ad(十六進制)
Flags Mask(標誌掩碼):C(C類網絡,也就是子網掩碼是255.255.255.0)
哦,幹得漂亮,-e顯示的明明白白,再看看-e作用
-e display (all) hosts in default (Linux) style
顯示所有主機在缺省linux風格,-a -e風格不同而已恩!幹得漂亮
-a display (all) hosts in alternative (BSD) style
這個是(BSD) style????風格?!溜了…
3.ping 10.10.255.145
可以加入
4.arp -d 10.10.255.145
可以刪除
完事 … …
實驗系統