arp translates ip address to mac addresses.
Announcement
You can find all my latest posts on medium.The arp command let’s you see which one of your interfaces has access to the default gateway, and therefore can access the internet.
the following shows which interface has access to the the default gateway:
$ arp Address HWtype HWaddress Flags Mask Iface 172.28.128.2 ether 08:00:27:88:f1:e5 C enp0s10 172.28.128.1 ether 0a:00:27:00:00:04 C enp0s10 gateway ether 52:54:00:12:35:02 C enp0s3 192.168.56.100 ether 08:00:27:8a:11:d7 C enp0s8 192.168.56.100 ether 08:00:27:8a:11:d7 C enp0s9
This command shows the default gateway’s ip address:
$ arp -n Address HWtype HWaddress Flags Mask Iface 172.28.128.2 ether 08:00:27:88:f1:e5 C enp0s10 172.28.128.1 ether 0a:00:27:00:00:04 C enp0s10 10.0.2.2 ether 52:54:00:12:35:02 C enp0s3 192.168.56.100 ether 08:00:27:8a:11:d7 C enp0s8 192.168.56.100 ether 08:00:27:8a:11:d7 C enp0s9
This matches up with the information provided in the routing tables:
$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 10.0.2.2 0.0.0.0 UG 100 0 0 enp0s3 10.0.2.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s3 172.28.128.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s10 192.168.56.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s9 192.168.56.0 0.0.0.0 255.255.255.0 U 101 0 0 enp0s8 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
$ netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 10.0.2.2 0.0.0.0 UG 0 0 0 enp0s3 10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s3 172.28.128.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s10 192.168.56.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s9 192.168.56.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s8 192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
or:
[root@localhost ~]# ip route list default via 10.0.2.2 dev enp0s3 proto static metric 100 10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15 metric 100 172.28.128.0/24 dev enp0s10 proto kernel scope link src 172.28.128.4 metric 100 192.168.56.0/24 dev enp0s9 proto kernel scope link src 192.168.56.104 metric 100 192.168.56.0/24 dev enp0s8 proto kernel scope link src 192.168.56.103 metric 101 192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1