Welcome, Guest. Please login or register.

Author Topic: Direct update MAC to IP address mapping  (Read 2553 times)

ageldenberg

  • Newbie
  • *
  • Posts: 15
    • View Profile
Direct update MAC to IP address mapping
« on: March 11, 2019, 08:02:32 pm »
Hello, NeDi gurus

Is there a way to update IP address of a specific MAC address directly in the database from a command line?

I may be able to use APIs to receive device information from Meraki cloud controller.  I can then use that information to update NeDi database with MAC-to-IP address mappings, if it is possible.

I will greatly appreciate your help.

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2903
    • View Profile
    • NeDi
Re: Direct update MAC to IP address mapping
« Reply #1 on: March 11, 2019, 08:09:22 pm »
You could create a CSV and import it with an SQL command to the nodarp table (or nodnd for IPv6).

You could also look at the ArpWatch function in libmisc.pm and adapt it to read an output file from that cloud controller...
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

ageldenberg

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Direct update MAC to IP address mapping
« Reply #2 on: March 11, 2019, 08:30:30 pm »
Rickli,

Thanks a lot for your comment.  If you can give me a sample of a sql command to update the table you mention, it would be great.

Regards,

Alek Geldenberg

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2903
    • View Profile
    • NeDi
Re: Direct update MAC to IP address mapping
« Reply #3 on: March 11, 2019, 08:36:26 pm »
Here's a generic example you can execute on a mysql prompt (make sure the CSV has the same column order as nodarp):

LOAD DATA INFILE '/tmp/discounts.csv'
INTO TABLE discounts
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS;
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo