reading IP address given via DHCP
amb-plugg at bradfords.org
Mon Sep 23 21:13:13 MDT 2013
Thus said Gabriel Gunderson on Mon, 23 Sep 2013 15:35:51 -0600:
> In most cases, if you're getting IPs via DHCP, you're likely also
> behind a NAT (at least in most small office / home setups). In which
> case, `curl icanhazip.com` or whatever will work, but it will give you
> the public IP being used at your gateway.
Something that might be a little more simple to parse and which will
work reliably behind NAT or even if your machine has a public IP:
$ tcpclient -T 10 -RHl 0 www.google.com 80 /bin/sh -c 'echo $TCPLOCALIP'
TAI64 timestamp: 4000000052410369
More information about the PLUG