Monday, July 9, 2012

[ARP] How to look up arp table (mac/ip mapping) in Linux

First, we can ping hostname(ip_addr) to add mac/ip mapping into arp table
or use arp command to do so:
> arp -s hostname(ip_addr) MAC_addr

Second, look up arp table:
> arp -n   (I recommend to use "-n" for avoiding DNS lookup. It is faster.)
        Address                  HWtype    HWaddress               Flags Mask            Iface
        10.3.207.245             ether      20:aa:4b:a3:4c:b7            C                     eth4

or there is another way:
> ip ne
        10.3.207.245 dev eth4 lladdr 20:aa:4b:a3:4c:b7 REACHABLE



No comments: