I would like to obtain ARP tables from a switch to a syslog server(Ubuntu 12.04 LTS). I have done some research on how to do it and i decided to use SNMP. I have done some research and i know that my server will be the manager whereas the switch will act as an agent.My problem is, i am not quite sure of the process of getting the arp tables and having them directed to the mysql database in my server.
There are a number of software solutions that can poll network devices via SNMP and store their MAC address tables in a SQL database. Generally, their functionality includes a great deal more than what you are asking for in your question.
Before installing the software on a server, it is important to note that you should have administrative access to the network devices, or at the very least, permission to query the devices in question. Either you, or your IT support folks, will need to configure the switches with permit SNMP string as well as permit SNMP queries from the server IP/subnet that it resides on. How these device are configured is vendor dependant and beyond the apparent scope of your question.
One example of such a tool available for Ubuntu is Netdisco.
Per their website, Netdisco is a software package that maintains "Configuration information and connection data for network devices [that is] ... retrieved via SNMP. Data is stored using a SQL database for scalability and speed. Layer-2 topology protocols such as CDP and LLDP provide automatic discovery of the network topology."
While there is a package available for install from the Ubuntu repositories(see
Another example would be IPPlan which focuses on IP Address Management(IPAM), DNS and circuit management. IPPLAN polls via the ucd-snmp package and NMAP and can map IP addresses to MAC addresses in a variety of SQL databases.
Also, you may want to take a look at Switchmap.
While it does not store its data in SQL, it creates CSV files which can then be poured into a SQL database, if desired.
There are a number of other solutions out there(both commercial and free). I only mention these as I have had direct experience installing, configuring, and managing these software packages.
MAC addresses are stored in the MIB
So, you can do something like this:
You will get a dump with these numbers followed by the six words of the MAC address in integer form. So, it is up to you to get the last 6 integers, convert them to hex and finally, store them on your database.
The response will tell you too in which port the switch "sees" the MAC address. Example:
Means the MAC address 18.104.22.168.36.11 (convert it to hex if you want) is reachable through the port 25 of that switch.
We use a tool called NetDB on Ubuntu that scrapes all of our routers and switches and puts them in a MySQL database. It runs find on 12.04 LTS: