Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I can't see to find a way to add an active/dynamic arp entry.

This all started with old Win32 exe that calls the SetIpNetEntry API to create a dynamic/active arp entry as part of a process to setup the IP address on some embedded hardware. the SetIpNetEntry api returns a success code but no entry is created. (This code of course works fine on Win XP.)

I then tried to create one by hand via

netsh interface ip add neighbors interface=10 address="IpAddr" neighbor="MacAddr" store=active

This creates and arp entry but the type created is permenent. It seems to just ignore the store=active.

At this point I can't seem to find a way from a command line or API to create a active/dynamic entry. I don't want a permenent entry since if the setup program has a problem I don't want this assignment left on the system forever. I just need it for about 15 seconds to assign an IP address.

share|improve this question

1 Answer 1

C:\>arp

Displays and modifies the IP-to-Physical address translation tables used by
address resolution protocol (ARP).

ARP -s inet_addr eth_addr [if_addr]
ARP -d inet_addr [if_addr]
ARP -a [inet_addr] [-N if_addr]

  -a            Displays current ARP entries by interrogating the current
                protocol data.  If inet_addr is specified, the IP and Physical
                addresses for only the specified computer are displayed.  If
                more than one network interface uses ARP, entries for each ARP
                table are displayed.
  -g            Same as -a.
  inet_addr     Specifies an internet address.
  -N if_addr    Displays the ARP entries for the network interface specified
                by if_addr.
  -d            Deletes the host specified by inet_addr. inet_addr may be
                wildcarded with * to delete all hosts.
  -s            Adds the host and associates the Internet address inet_addr
                with the Physical address eth_addr.  The Physical address is
                given as 6 hexadecimal bytes separated by hyphens. The entry
                is permanent.
  eth_addr      Specifies a physical address.
  if_addr       If present, this specifies the Internet address of the
                interface whose address translation table should be modified.
                If not present, the first applicable interface will be used.
Example:
  > arp -s 157.55.85.212   00-aa-00-62-c6-09  .... Adds a static entry.
  > arp -a                                    .... Displays the arp table.

So, something like arp -s 157.55.85.212 00-aa-00-62-c6-09 will add an entry to the ARP cache. It should be flushed eventually, it won't survive a reboot.

share|improve this answer
    
I'm aware of arp. I'll have to test the reboot part, but it specifically says it adds a static entry that is permanent in the help text you show. –  Kevin Gale Feb 17 '12 at 17:59
    
It does appear they do go away on a reboot. That still doesn't really answer my question. Why isn't there any way to create a dynamic/active entry that goes away on it's own? Why does the netsh command have store=active option if it's not going to use it? –  Kevin Gale Feb 17 '12 at 18:08
    
I up-voted but didn't accept. Knowing the static address will disappear at reboot is helpful since worst case I can use a static and know it will go away eventually. Also I went back to my code and changed the type to static. Now the SetIpNetEntry api works. I still don't understand why it doesn't work for dynamic. Something changed between XP and Win7 and it doesn't even generate a error just a false success. –  Kevin Gale Feb 17 '12 at 18:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.