Search code examples
mappingarp

Is there any way to create ARP cache entries programatically in windows using java?


I want to add arp ip to mac mapping to arp cache using programming languages preferably java.


Solution

  • You can simply run the command ARP -s inet_addr eth_adr where inet_addr is the IP address and eth_adr is the hardware address.
    In Java:

     Process child = Runtime.getRuntime().exec("arp -s 220.0.0.161 00-50-04-62-F7-23");
    

    In c#:

     Process process = new Process();
     process.StartInfo.FileName = "arp -s 220.0.0.161 00-50-04-62-F7-23";
     process.StartInfo.CreateNoWindow = true; //Don't show window
     process.Start();