On 8/18/07, Brandorr <[EMAIL PROTECTED]> wrote:
> Ah, then it is unclear that the command is $ host `hostname`
>
> "Host" is a command that was relatively recently added op Solaris that
> will return an IP if given a hostname. (and a hostname if given an IP
> address.) It's a bit like nslookup in it's functionality.
Since /usr/sbin is not in the default path, I would suggest updating
the command to include it.
However, what happens when the hostname doesn't match something in
DNS? I would expect that this is quite likely in most DHCP scenarios.
This command, while not for the faint of heart, gets a bit closer. :)
# netstat -rn \
| nawk '$1 == "default" { print $2 }' \
| xargs -n 1 route get \
| nawk '$1 == "interface:" { print $2 }' \
| xargs ifconfig \
| nawk '$1 == "inet" { print $2 }'
Oh, and /usr/sbin should be in $PATH. IPv6 compatibility is left as
an exercise for the reader.
Mike
--
Mike Gerdts
http://mgerdts.blogspot.com/
_______________________________________________
networking-discuss mailing list
[email protected]