[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Get the external IP address from a Linux box



Alberto Luaces <aluaces@udc.es> writes:

> Joe writes:
>
>> On the assumption that you are using a router of some kind, your public
>> IP address will be that of the router WAN port (cable, ADSL, etc.) and
>> there will be a method of determining that by connecting to the router
>> as an administrator. That method will depend entirely on the router.
>
> If the router supports upnp and it is activated, you can check the
> external IP in an device-independent way with
>
> upnpc -l | grep ExternalIPAddress

The miniupnpc Debian package even comes with the `external-ip` script
which basically does the above.

I just tried it and it worked (tho only after I installed & enabled
miniupnpd on my OpenWRT router).  Of course, the IP address that my
router gets could itself be an "internal IP" behind a NAT firewall of my
ISP, so even if `external-ip` does give an answer I'm not sure it's
guaranteed to be "the" external IP address.


        Stefan


Reply to: