reading IP address given via DHCP

Dan Egli ddavidegli at
Mon Sep 23 03:36:14 MDT 2013

Hey, does anyone know of a way to learn the IP address that was received
from the DHCP server? I'm wondering about this. Piping the output of
ifconfig through grep and then through cut I know would work, but it seems
like a very clumsy method of learning that eth0 was assigned,
for example. Is there a better way? I'd think there would be, but I can't
think of one.

This is only at the shell level, so it's not like I can query the kernel
directly. Now files from /proc or /sys are, of course, acceptable targets.
:) I don't know those directories well enough to even begin to guess where
such a file may be.


More information about the PLUG mailing list