BenV's notes

Minor annoyance about linux

by on Aug.31, 2009, under Morons, Software

So I’m working on a little info script (check out Infoscreen) so I can have a nice overview
of my server when I look at console number one without having to log in etc.

Simple question:
“Where in /proc can I find a list of IP addresses with corresponding interfaces?”

Simple answer:
Try /proc/net/if_inet6!

wouter@wouter-laptop:~:0>cat /proc/net/if_inet6
00000000000000000000000000000001 01 80 10 80 lo
20010888148d0000022100fffe221352 04 40 00 00 wlan1
fe80000000000000022100fffe221352 04 40 20 80 wlan1

… that’s great…. but I really wanted the IPv4 addresses as well.
“/proc/net/if_inet4” or “/proc/net/if_inet”? Noooooo….

Conclusion: KANKER LINUX!

Obviously I can get the address by calling ‘ip addr show‘, ‘ifconfig‘ or a heap of other solution involving calling ioctl on sockets or using the netlink interface… but seriously, blegh.

The most retarded thing is that pretty much every other statistic about my network devices is there… including active connections and whatnot, but ipv4 addresses? Nooooo….. *RAAH*




:, , , ,

Leave a Reply

You must be logged in to post a comment.