Как я могу добавить активную запись ARP на Win 7
Я не могу найти способ добавить активную / динамическую запись arp.
Все это началось со старой Win32 exe, которая вызывает API SetIpNetEntry для создания динамической / активной записи arp как части процесса настройки IP-адреса на некоторых встроенных аппаратных средствах. API-интерфейс SetIpNetEntry возвращает код успеха, но запись не создается. (Этот код, конечно, отлично работает на Win XP.)
Затем я попытался создать один вручную через
netsh interface ip добавить соседей интерфейс =10 адрес ="IpAddr" сосед ="MacAddr" store= активный
Это создает и запись arp, но созданный тип является постоянным. Кажется, просто игнорировать store=active.
На данный момент я не могу найти путь из командной строки или API для создания активной / динамической записи. Я не хочу постоянную запись, так как, если у программы установки есть проблема, я не хочу, чтобы это назначение оставалось в системе навсегда. Мне просто нужно около 15 секунд, чтобы назначить IP-адрес.
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.
Итак, что-то вроде arp -s 157.55.85.212 00-aa-00-62-c6-09
добавит запись в кеш ARP. Это должно быть сброшено в конце концов, он не переживет перезагрузку.