Get all hostnames and IP Addresses on IPFire

I am thinking about creating a separate HOSTNAME “table” for pmacct. I’d like to match-up IP address to hostnames. It would include all local hostnames, IP addresses, and probably MAC addresses.

I can create a table fairly quick with arp -a. (but I believe that is a deprecated command`).

The output from pmacct should end up similar to this once the hostname is added…

sqlite> SELECT * FROM "addr_byMonth" ORDER BY "totalBytes" DESC limit 10;

ip_addr           hostname              totalBytes            totalGB
----------------  --------------------  --------------------  --------
192.168.50.55     Roku				    89354082450           89.35
192.168.50.160    amazon-a123456		29890216433           29.89
192.168.50.72     amazon-a456789		22545905391           22.55
192.168.50.71     iPhone				17751225249           17.75
192.

I thought I had found something in dhcp leases. But after experimenting I noticed all of the static address were missing. D’oh!! :face_with_hand_over_mouth:

A DB table or a flat file or anything would be great…

So before I do re-create a wheel - is there something similar that already exists on the IPFire device?

Hi @jon

If you have used the Edit Hosts page then all the info will be in the file associated with that,

/var/ipfire/main/hosts

but it means that every time you entered a static IP address that you also then added it to the Edit Hosts page.

If I understand the wiki right this hosts info should be automatically captured from the dhcp page using the first word that is in the remarks box but it is not put into the Edit Hosts table.

Doing that automatically every time a new dhcp fixed lease is created is something I have on my list of things to have a look at but currently I have enough things on my plate.

That is part of what I am looking for. If I added all of the /var/ipfire/main/hosts plus the dhcp entries (with dhcp leases), then I’d have what I am looking for.

I was hoping for an already existing file or table on IPFire.

After digging and experimenting I decided to switch from IP Addresses to MAC address. They are more consistent (except with the iPhones/iPads with Private Address enabled).

So I’ve been experimenting with parsing arp and nslookup and even a little ip neigh.

But I keep running across a devices that all have hostnames and they don’t show up in any DNS lookups. The hostname are alpha numeric only with no other odd characters.

back to experimenting!

1 Like