计算机网络 arp

arp


TCP/IP:
			协议								数据
应用层		http、telnet、ftp、smtp等		数据

传输层		tcp、udp						数据段

网络层		ICMP、ip、IGMP					报文分组
数据链路层	arp、rarp						帧
物理层										比特
 任务:

arp

 过程:
 1.arp(Address Resolution Protocol,地址解析协议),我的记法:地址解析P
 2.arp目的:根据 ip得到mac
 3.源主机想与目标主机通讯,这个时候arp列表有这个ip就通讯,没有就向本地网段发arp广播,查目标主机的mac地址
 4.查到了然后呢,记下来呗,记下来做啥,就是不用高德地图了,不用吧全部路都走一遍?恩,应该是,然后按照记的路走就完事儿了啊
  1. 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) 

  1. 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
可以删除

完事 … …

实验系统
arp

发布了84 篇原创文章 · 获赞 9 · 访问量 9158

猜你喜欢

转载自blog.csdn.net/qq_42344456/article/details/103502640