Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Is one of your requirements to build this from scratch or is it acceptable to use existing software solutions? – Kevin Bowen Aug 21 '13 at 7:00
@maggotbrain, i can use existing software solutions – sosytee Aug 21 '13 at 7:07
up vote 1 down vote accepted

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 netdiso-common, netdisco-backend, and netdisco-frontend) it is somewhat outdated. A more recent version can be installed from source on their site.

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.

share|improve this answer

MAC addresses are stored in the MIB .

So, you can do something like this:

$ snmpwalk -v2c -c <community> <SwitchIP> .

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:

iso. = INTEGER: 25

Means the MAC address (convert it to hex if you want) is reachable through the port 25 of that switch.

share|improve this answer
The correct syntax for snmpwalk is snmpwalk -v 2c -c InsertCommunityStringHere . – Kevin Bowen Aug 21 '13 at 7:03
@jap1968 I am not sure if i asked my question correctly. I will need to receive the arp tables for a switch on a remote server. I`m sure i have to run snmpget command using crontab but i am stuck in that i do not know 1)How to connect the server and switch to make the server the manager and the switch the agent and 2)where in the server to place the sntpget – sosytee Aug 21 '13 at 7:05

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:

share|improve this answer

Your Answer


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.