大家好,又见面了,我是你们的朋友全栈君。
arping命令是获取同一个网络下面主机的mac地址。这里的同一网络是ip可以互通。linux下面。
可以知道这个ip是否被占用,一个很有用的命令。刚才操作了一下报错。
[root@localhost etc]# arping 10.2.167.27
arping: unknown iface eth0
[root@localhost etc]# arping 10.2.167.177
arping: unknown iface eth0
[root@localhost etc]#
很郁闷怎么报错呢,原来是没有eth0网卡。它默认从网卡0出。
ifconfig看一下。
[root@localhost etc]# ifconfig
eth1 Link encap:Ethernet HWaddr 00:0C:29:D8:3D:17
inet addr:10.2.167.27 Bcast:10.2.167.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fed8:3d17/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:479073 errors:0 dropped:0 overruns:0 frame:0
TX packets:17498 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:73918361 (70.4 MiB) TX bytes:3437224 (3.2 MiB)
Interrupt:19 Base address:0x2024
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:5932 errors:0 dropped:0 overruns:0 frame:0
TX packets:5932 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:372219 (363.4 KiB) TX bytes:372219 (363.4 KiB)
真的没有网卡0.
那么就换个出口。用I可以指定出口网卡。
[root@localhost etc]# arping -I eth1 10.2.167.177
ARPING 10.2.167.177 from 10.2.167.27 eth1
Unicast reply from 10.2.167.177 [54:14:A6:AC:5E:8A] 0.669ms
Unicast reply from 10.2.167.177 [54:14:A6:AC:5E:8A] 0.603ms
Unicast reply from 10.2.167.177 [54:14:A6:AC:5E:8A] 0.611ms
Unicast reply from 10.2.167.177 [54:14:A6:AC:5E:8A] 0.597ms
Unicast reply from 10.2.167.177 [54:14:A6:AC:5E:8A] 0.597ms
Unicast reply from 10.2.167.177 [54:14:A6:AC:5E:8A] 0.593ms
Unicast reply from 10.2.167.177 [54:14:A6:AC:5E:8A] 0.603ms
Unicast reply from 10.2.167.177 [54:14:A6:AC:5E:8A] 0.584ms
ok搞定。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/132700.html原文链接:https://javaforall.cn