Is there some command line function within FreeNAS (FreeBSD) derivative which could return my external address? Since that same address is synchronized with DynDns (via router), in C# I retrieved that via DNS query like this:
var hostEntry = Dns.GetHostEntry("myexternalname.dyndns.org");
foreach (var iAddress in hostEntry.AddressList) {
if (iAddress.AddressFamily == AddressFamily.InterNetwork) {
MessageBox.Show(iAddress);
}
}
Prerequisites
From a command line:
The good:
The bad:
The ugly:
here is my favorite command :
simple. clear. and if you have curl :
I found command that works on FreeNAS.
It returns
From that I just use awk:
and that returns just IP:
P.S. I know that 89.172.197.320 is not real IP address. I wrote it like that in order not to share mine IP address (or IP address from someone else).
P.P.S. Thanks for help to Kronick and Avery Payne since their ideas pushed me in right direction.