Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #196029 > unrolled thread

Get the external IP address from a Linux box

Started byAndré Rodier <andre@rodier.me>
First post2018-05-24 08:40 +0200
Last post2018-05-27 16:20 +0200
Articles 20 on this page of 42 — 21 participants

Back to article view | Back to linux.debian.user


Contents

  Get the external IP address from a Linux box André Rodier <andre@rodier.me> - 2018-05-24 08:40 +0200
    Re: Get the external IP address from a Linux box conover@rahul.net (John Conover) - 2018-05-24 08:50 +0200
      Re: Get the external IP address from a Linux box likcoras <likcoras@riseup.net> - 2018-05-24 09:00 +0200
        Re: Get the external IP address from a Linux box conover@rahul.net (John Conover) - 2018-05-24 09:30 +0200
          Re: Get the external IP address from a Linux box André Rodier <andre@rodier.me> - 2018-05-24 10:00 +0200
    Re: Get the external IP address from a Linux box <tomas@tuxteam.de> - 2018-05-24 09:00 +0200
    Re: Get the external IP address from a Linux box Joe <joe@jretrading.com> - 2018-05-24 09:10 +0200
      Re: Get the external IP address from a Linux box Alberto Luaces <aluaces@udc.es> - 2018-05-24 09:10 +0200
        Re: Get the external IP address from a Linux box André Rodier <andre@rodier.me> - 2018-05-24 09:20 +0200
          Re: Get the external IP address from a Linux box <tomas@tuxteam.de> - 2018-05-24 09:40 +0200
          Re: Get the external IP address from a Linux box Joe <joe@jretrading.com> - 2018-05-24 11:30 +0200
            Re: Get the external IP address from a Linux box Joel Rees <joel.rees@gmail.com> - 2018-05-31 02:10 +0200
        Re: Get the external IP address from a Linux box Stefan Monnier <monnier@iro.umontreal.ca> - 2018-05-24 22:20 +0200
          Get the external IP address from a Linux box Erwan David <erwan@rail.eu.org> - 2018-05-24 22:40 +0200
            Re: Get the external IP address from a Linux box Miles Fidelman <mfidelman@meetinghouse.net> - 2018-05-24 23:30 +0200
      Re: Get the external IP address from a Linux box Richard Hector <richard@walnut.gen.nz> - 2018-05-26 08:20 +0200
    Re: Get the external IP address from a Linux box Abdullah Ramazanoğlu <ar018@yahoo.com> - 2018-05-24 09:40 +0200
      Re: Get the external IP address from a Linux box <tomas@tuxteam.de> - 2018-05-24 09:50 +0200
      Re: Get the external IP address from a Linux box Dan Purgert <dan@djph.net> - 2018-05-24 13:20 +0200
        Re: Get the external IP address from a Linux box Abdullah Ramazanoğlu <ar018@yahoo.com> - 2018-05-25 03:30 +0200
          Re: Get the external IP address from a Linux box Dan Purgert <dan@djph.net> - 2018-05-25 20:40 +0200
    Re: Get the external IP address from a Linux box Peter Ludikovsky <peter@ludikovsky.name> - 2018-05-24 13:20 +0200
    Re: Get the external IP address from a Linux box Greg Wooledge <wooledg@eeg.ccf.org> - 2018-05-24 14:10 +0200
      Re: Get the external IP address from a Linux box Dan Purgert <dan@djph.net> - 2018-05-24 15:00 +0200
    Re: Get the external IP address from a Linux box Alan Greenberger <alanjg@ptd.net> - 2018-05-25 03:10 +0200
      Re: Get the external IP address from a Linux box Pascal Hambourg <pascal@plouf.fr.eu.org> - 2018-05-26 13:20 +0200
        Re: Get the external IP address from a Linux box Alan Greenberger <alanjg@ptd.net> - 2018-05-28 14:10 +0200
          Re: Get the external IP address from a Linux box David Wright <deblis@lionunicorn.co.uk> - 2018-05-28 19:50 +0200
            Re: Get the external IP address from a Linux box Alan Greenberger <alanjg@ptd.net> - 2018-05-29 14:10 +0200
              Re: Get the external IP address from a Linux box David Wright <deblis@lionunicorn.co.uk> - 2018-06-02 16:40 +0200
          Re: Get the external IP address from a Linux box Pascal Hambourg <pascal@plouf.fr.eu.org> - 2018-05-28 23:20 +0200
            Re: Get the external IP address from a Linux box Pascal Hambourg <pascal@plouf.fr.eu.org> - 2018-05-29 15:00 +0200
              Re: Get the external IP address from a Linux box David Wright <deblis@lionunicorn.co.uk> - 2018-06-02 16:50 +0200
    Re: Get the external IP address from a Linux box Michael Stone <mstone@debian.org> - 2018-05-26 03:10 +0200
      Re: Get the external IP address from a Linux box Kenneth Parker <sea7kenp@gmail.com> - 2018-05-26 03:20 +0200
        Re: Get the external IP address from a Linux box Greg Wooledge <wooledg@eeg.ccf.org> - 2018-05-29 15:10 +0200
    Re: Get the external IP address from a Linux box Kenneth Parker <sea7kenp@gmail.com> - 2018-05-26 03:10 +0200
    Re: Get the external IP address from a Linux box André Rodier <andre@rodier.me> - 2018-05-26 13:00 +0200
      Get the external IP address from a Linux box Andrew McGlashan <andrew.mcglashan@affinityvision.com.au> - 2018-05-27 13:20 +0200
        Re: Get the external IP address from a Linux box André Rodier <andre@rodier.me> - 2018-05-27 14:20 +0200
          Re: Get the external IP address from a Linux box Andrew McGlashan <andrew.mcglashan@affinityvision.com.au> - 2018-05-27 15:50 +0200
            Re: Get the external IP address from a Linux box André Rodier <andre@rodier.me> - 2018-05-27 16:20 +0200

Page 1 of 3  [1] 2 3  Next page →


#196029 — Get the external IP address from a Linux box

FromAndré Rodier <andre@rodier.me>
Date2018-05-24 08:40 +0200
SubjectGet the external IP address from a Linux box
Message-ID<vSS4N-5l7-3@gated-at.bofh.it>
Hello,

I am looking for a native package on Debian, that can give me the
external IP address of the machine.

So far, I used internet sites, but I am sure there is a package that do
that properly, especially if one site is unreachable.

Something I can run from the command line, and that would return the
external IP address.

Thanks.

-- 
André Rodier
Homebox: https://github.com/progmaticltd/homebox

[toc] | [next] | [standalone]


#196030

Fromconover@rahul.net (John Conover)
Date2018-05-24 08:50 +0200
Message-ID<vSSet-5ot-5@gated-at.bofh.it>
In reply to#196029
=?ISO-8859-1?Q?Andr=E9?= Rodier writes:
> 
> I am looking for a native package on Debian, that can give me the
> external IP address of the machine.
>

Hi Andre.

Type "ifconfig" without the quotes. The record you are looking for is
inet addr: for IPV4. Its about the second line from the top.

    John

-- 

John Conover, conover@rahul.net, http://www.johncon.com/

[toc] | [prev] | [next] | [standalone]


#196032

Fromlikcoras <likcoras@riseup.net>
Date2018-05-24 09:00 +0200
Message-ID<vSSo9-5rP-13@gated-at.bofh.it>
In reply to#196030
On 05/24/2018 03:48 PM, John Conover wrote:
> =?ISO-8859-1?Q?Andr=E9?= Rodier writes:
>>
>> I am looking for a native package on Debian, that can give me the
>> external IP address of the machine.
>>
> 
> Hi Andre.
> 
> Type "ifconfig" without the quotes. The record you are looking for is
> inet addr: for IPV4. Its about the second line from the top.
> 
>     John
> 

ifconfig would only work if you are directly assigned the public,
external IP. If you are behind eg. a router that does NAT, you would
only see the private IP internal to the local network.

I am not aware of any packages in the repos that has this kind of
functionality, but you could always just write a simple script around
the various sites that report your external ip.

It can be as simple as `curl ipinfo.io` (or your preferred site), you
could even try to have a script to try a few backups in case your
primary site happens to be unreachable.

[toc] | [prev] | [next] | [standalone]


#196036

Fromconover@rahul.net (John Conover)
Date2018-05-24 09:30 +0200
Message-ID<vSSRc-5Rm-7@gated-at.bofh.it>
In reply to#196032
likcoras writes:
> >>
> >> I am looking for a native package on Debian, that can give me the
> >> external IP address of the machine.
> >>
> > 
> > Hi Andre.
> > 
> > Type "ifconfig" without the quotes. The record you are looking for is
> > inet addr: for IPV4. Its about the second line from the top.
> > 
> 
> ifconfig would only work if you are directly assigned the public,
> external IP. If you are behind eg. a router that does NAT, you would
> only see the private IP internal to the local network.
>

Then:

    dig TXT +short o-o.myaddr.l.google.com @ns1.google.com

    John

-- 

John Conover, conover@rahul.net, http://www.johncon.com/

[toc] | [prev] | [next] | [standalone]


#196040

FromAndré Rodier <andre@rodier.me>
Date2018-05-24 10:00 +0200
Message-ID<vSTkh-6aF-65@gated-at.bofh.it>
In reply to#196036
On Thu, 2018-05-24 at 00:19 -0700, John Conover wrote:
> likcoras writes:
> > > > 
> > > > I am looking for a native package on Debian, that can give me
> > > > the
> > > > external IP address of the machine.
> > > > 
> > > 
> > > Hi Andre.
> > > 
> > > Type "ifconfig" without the quotes. The record you are looking
> > > for is
> > > inet addr: for IPV4. Its about the second line from the top.
> > > 
> > 
> > ifconfig would only work if you are directly assigned the public,
> > external IP. If you are behind eg. a router that does NAT, you
> > would
> > only see the private IP internal to the local network.
> > 
> 
> Then:
> 
>     dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
> 
>     John
> 

Thank you, John.

This solution works.

I doubt google would be offline, but perhaps I will add this solution
as part of a script, with other servers as well.

Kind regards,
André.

[toc] | [prev] | [next] | [standalone]


#196031

From<tomas@tuxteam.de>
Date2018-05-24 09:00 +0200
Message-ID<vSSo9-5rP-7@gated-at.bofh.it>
In reply to#196029
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, May 24, 2018 at 07:22:56AM +0100, André Rodier wrote:
> Hello,
> 
> I am looking for a native package on Debian, that can give me the
> external IP address of the machine.

Before embarking in such a task, you might want to consider what
"the external IP address of your machine" actually means, just to
understand where the limitations and pitfalls of such a concept are.

> So far, I used internet sites, but I am sure there is a package that do
> that properly, especially if one site is unreachable.

Judging from that, I guess you mean "your machine as seen from the
Internet". Well, that will (in most cases)  the IP address your provider
assigns to your DSL modem (or your cable modem, or whatever device
you're using to connect to the Internet). Behind that, there's (again:
most probably, but not necessarily) an NAT ("network address translation",
so your machine's IP address looks different.

> Something I can run from the command line, and that would return the
> external IP address.

For that you'll always need the cooperation of some site located in what
you consider to be "out there".

Cheers
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlsGYf8ACgkQBcgs9XrR2kbWWACfdIGAWCqm1fEM6hZTJ3o52aJr
XWAAnjumSCL0It21S5aawrReSodJKyXF
=4bN5
-----END PGP SIGNATURE-----

[toc] | [prev] | [next] | [standalone]


#196033

FromJoe <joe@jretrading.com>
Date2018-05-24 09:10 +0200
Message-ID<vSSxP-5Kp-3@gated-at.bofh.it>
In reply to#196029
On Thu, 24 May 2018 07:22:56 +0100
André Rodier <andre@rodier.me> wrote:

> Hello,
> 
> I am looking for a native package on Debian, that can give me the
> external IP address of the machine.
> 
> So far, I used internet sites, but I am sure there is a package that
> do that properly, especially if one site is unreachable.
> 
> Something I can run from the command line, and that would return the
> external IP address.
> 

To begin with, try:

ip addr show

and look for the block of information with a label beginning 'eth' or
'en'. That will contain the Ethernet adaptor IP address. From your
question, I assume your computer contains only one.

The address returned by Internet sites will be your public IP address,
and unless you have a very unusual setup, that will not be the same as
the IP address of your computer. But you have told us nothing at all
about how your computer connects to the Internet, so I am just guessing.

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.

-- 
Joe

[toc] | [prev] | [next] | [standalone]


#196034

FromAlberto Luaces <aluaces@udc.es>
Date2018-05-24 09:10 +0200
Message-ID<vSSxP-5Kp-9@gated-at.bofh.it>
In reply to#196033
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

-- 
Alberto

[toc] | [prev] | [next] | [standalone]


#196035

FromAndré Rodier <andre@rodier.me>
Date2018-05-24 09:20 +0200
Message-ID<vSSHv-5NC-1@gated-at.bofh.it>
In reply to#196034
On Thu, 2018-05-24 at 09:07 +0200, Alberto Luaces wrote:
> 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
> 

Thank you, finally an answer that make sense and is not pedantic.

I tried this, but it is not 100% reliable. For instance, with the
firewall / router I use, upnp id not activated. I suppose I will have
to write a custom python script.

Kind regards,
André

[toc] | [prev] | [next] | [standalone]


#196037

From<tomas@tuxteam.de>
Date2018-05-24 09:40 +0200
Message-ID<vST0R-5UC-3@gated-at.bofh.it>
In reply to#196035
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, May 24, 2018 at 08:13:54AM +0100, André Rodier wrote:

[...]

> Thank you, finally an answer that make sense and is not pedantic.

Thank *you* for the "pedantic" ;-)

And to return the favour, here's why you don't really want to have
UPnP on your border device:

  https://www.reddit.com/r/sysadmin/comments/4gpiez/upnp_on_pfsense_security_risks_and_alternatives/

(the short: every random javascript your browser sucks in from
the Intratubes and a small slip in your browser's security can
instruct your border device to open arbitrary holes in the
firewall).

Enjoy
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlsGaeAACgkQBcgs9XrR2kb7EACeIXbTMCst2jHQafuTNjXNX/1A
j6sAnjWusTwHMXzKAjtJQFNZkMBNRPYV
=M+M2
-----END PGP SIGNATURE-----

[toc] | [prev] | [next] | [standalone]


#196041

FromJoe <joe@jretrading.com>
Date2018-05-24 11:30 +0200
Message-ID<vSUJj-7i3-9@gated-at.bofh.it>
In reply to#196035
On Thu, 24 May 2018 08:13:54 +0100
André Rodier <andre@rodier.me> wrote:

> On Thu, 2018-05-24 at 09:07 +0200, Alberto Luaces wrote:
> > 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
> >   
> 
> Thank you, finally an answer that make sense and is not pedantic.
> 
How is it possible to avoid being pedantic? You told us nothing about
your Internet connection, or Debian version, so we had to guess at what
information you actually wanted and which device to ask.

> I tried this, but it is not 100% reliable. For instance, with the
> firewall / router I use, upnp id not activated. I suppose I will have
> to write a custom python script.

So presumably it isn't your computer's external address that you want,
but that of your router. I was a bit surprised to see upnp mentioned, I
thought it was only game-players who were willing to run that, and
Debian would not be their OS of choice.

From (not recent) experience of talking to routers, you may have telnet
or ssh available, otherwise it's an http admin login, followed by one or
two router-specific commands. You might be lucky, and the default
router status page without login may contain the WAN address.

A couple of lines of bash should do it: use curl, and you'll probably
have to provide the admin password, so the script should probably be
stored in /root. My routers in years gone by used to need an occasional
reboot, so I had a script running every ten minutes to check multiple
websites for connectivity, and if none were found, to issue a reboot
command.

-- 
Joe

[toc] | [prev] | [next] | [standalone]


#196275

FromJoel Rees <joel.rees@gmail.com>
Date2018-05-31 02:10 +0200
Message-ID<vVjkd-6AH-1@gated-at.bofh.it>
In reply to#196041
(Erk. Sorry, Joe.)

On Thu, May 24, 2018 at 6:29 PM, Joe <joe@jretrading.com> wrote:
> On Thu, 24 May 2018 08:13:54 +0100
> André Rodier <andre@rodier.me> wrote:
>
>> On Thu, 2018-05-24 at 09:07 +0200, Alberto Luaces wrote:
>> > 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
>> >
>>
>> Thank you, finally an answer that make sense and is not pedantic.

Two people have already tried to point out that UPNP is vulnerable by design.

If you have any interest in your local security, your router to the
outside should simply not respond to UPNP at all.

Block/ignore UPNP at every interface, internal and external, on your
external router, at bare minimum.

This is not pedantry, this is trying to save you from being attacked
from your inside.

> How is it possible to avoid being pedantic? You told us nothing about
> your Internet connection, or Debian version, so we had to guess at what
> information you actually wanted and which device to ask.
>
>> I tried this, but it is not 100% reliable. For instance, with the
>> firewall / router I use, upnp id not activated. I suppose I will have
>> to write a custom python script.
>
> So presumably it isn't your computer's external address that you want,
> but that of your router. I was a bit surprised to see upnp mentioned, I
> thought it was only game-players who were willing to run that, and
> Debian would not be their OS of choice.
>
> From (not recent) experience of talking to routers, you may have telnet
> or ssh available, otherwise it's an http admin login, followed by one or
> two router-specific commands. You might be lucky, and the default
> router status page without login may contain the WAN address.
>
> A couple of lines of bash should do it: use curl, and you'll probably
> have to provide the admin password, so the script should probably be
> stored in /root. My routers in years gone by used to need an occasional
> reboot, so I had a script running every ten minutes to check multiple
> websites for connectivity, and if none were found, to issue a reboot
> command.

What Joe says here.

I had ten or twenty lines of moderately careful code in a two
hundred-line perl script I used to update my dyndns.com domain name
back before dyn.com decided they had to kick all the freeloaders like
me off.

Resolution to *some* domain name really ought to be part of an ISP's
basic package, but the Internet got taken over by the poachers.


--
Joel Rees

http://reiisi.blogspot.jp/p/novels-i-am-writing.html

[toc] | [prev] | [next] | [standalone]


#196052

FromStefan Monnier <monnier@iro.umontreal.ca>
Date2018-05-24 22:20 +0200
Message-ID<vT4Sl-5k0-1@gated-at.bofh.it>
In reply to#196034
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

[toc] | [prev] | [next] | [standalone]


#196053

FromErwan David <erwan@rail.eu.org>
Date2018-05-24 22:40 +0200
Message-ID<vT5bI-5rU-13@gated-at.bofh.it>
In reply to#196052
Le 05/24/18 à 22:17, Stefan Monnier a écrit :
> 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
>
>
You could also be natted to one pool, so get different addresses for
different connections, or even have different services natted to
different pools (eg because there is a transparent proxy for outgoing
HTTP connections)

[toc] | [prev] | [next] | [standalone]


#196054

FromMiles Fidelman <mfidelman@meetinghouse.net>
Date2018-05-24 23:30 +0200
Message-ID<vT5Y5-6dp-13@gated-at.bofh.it>
In reply to#196053
On 5/24/18 4:22 PM, Erwan David wrote:

> Le 05/24/18 à 22:17, Stefan Monnier a écrit :
>> 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
>>
>>
> You could also be natted to one pool, so get different addresses for
> different connections, or even have different services natted to
> different pools (eg because there is a transparent proxy for outgoing
> HTTP connections)

On the assumption that you're connected to a NAT router - the easiest 
way is to log into the admin port on the router - usually there's a 
management interface that will tell you your external IP address.

Miles Fidelman

-- 
In theory, there is no difference between theory and practice.
In practice, there is.  .... Yogi Berra

[toc] | [prev] | [next] | [standalone]


#196084

FromRichard Hector <richard@walnut.gen.nz>
Date2018-05-26 08:20 +0200
Message-ID<vTAIx-84y-5@gated-at.bofh.it>
In reply to#196033

[Multipart message — attachments visible in raw view] — view raw

On 24/05/18 18:59, Joe wrote:

> To begin with, try:
> 
> ip addr show
> 
> and look for the block of information with a label beginning 'eth' or
> 'en'. That will contain the Ethernet adaptor IP address. From your
> question, I assume your computer contains only one.
> 
> The address returned by Internet sites will be your public IP address,
> and unless you have a very unusual setup, that will not be the same as
> the IP address of your computer. But you have told us nothing at all
> about how your computer connects to the Internet, so I am just guessing.
> 
> 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.
> 

Until recently, I would have agreed with you - and when I tried the
nifty google dns lookup mentioned in another post, that's what I was
expecting.

Now, however, I get an IPv6 address, and it is the one on my desktop PC.
I can get the router's external IPv4 address by using dig -4.

I suspect my experience is becoming less unusual these days.

Richard

[toc] | [prev] | [next] | [standalone]


#196038

FromAbdullah Ramazanoğlu <ar018@yahoo.com>
Date2018-05-24 09:40 +0200
Message-ID<vST0R-5UC-5@gated-at.bofh.it>
In reply to#196029
On Thu, 24 May 2018 07:22:56 +0100 André Rodier said:

> I am looking for a native package on Debian, that can give me the
> external IP address of the machine.
> 
> So far, I used internet sites, but I am sure there is a package that do
> that properly, especially if one site is unreachable.
> 
> Something I can run from the command line, and that would return the
> external IP address.

Unless you have a dedicated IP address, then even if you directly connect to
your ISP (no routers, no NAT) you will likely get a local pool address and from
there routed to the internet by your ISP. In that case your link will have 2
*local* addresses (e.g. 192.168.. or 10...) : one for your side, one for ISP
side. You first enter ISP's local IP pool, and from there exit to the internet
over a real address from ISP's address block.

It can be visualized as a local cloud of ISP. One side of the cloud faces
customers (local reserved IP range), the other side faces the internet (real IP
address pool). E.g. I am connected through 3G modem and my IP and my address
starts with 10.x.x.x - an A class reserved block address.

The only reliable way (AFAIK) is going through some sort of "loop-back"
mechanism to see your external address. External sites are one way of achieving
this.

John Conover's (dig) and likcoras' (script) solutions look promising in that
regard.

Regards
-- 
Abdullah Ramazanoğlu

[toc] | [prev] | [next] | [standalone]


#196039

From<tomas@tuxteam.de>
Date2018-05-24 09:50 +0200
Message-ID<vSTaD-60Z-139@gated-at.bofh.it>
In reply to#196038
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, May 24, 2018 at 10:37:44AM +0300, Abdullah Ramazanoğlu wrote:

[...]

> Unless you have a dedicated IP address, then even if you directly connect to
> your ISP (no routers, no NAT) you will likely get a local pool address and from
> there routed to the internet by your ISP. In that case your link will have 2
> *local* addresses (e.g. 192.168.. or 10...) : one for your side, one for ISP
> side. You first enter ISP's local IP pool, and from there exit to the internet
> over a real address from ISP's address block.

In that case, the NAT will be at your provider's side. At the end, it'll
be NAT too (NAT == "your external IP isn't what it seems to be").

Cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlsGbbQACgkQBcgs9XrR2ka9cACeNyvIhBUgdYL4DJ374mxFHY9v
yycAnRvwpiCuJyrSsXApAF4DsewYUk7W
=pNsg
-----END PGP SIGNATURE-----

[toc] | [prev] | [next] | [standalone]


#196044

FromDan Purgert <dan@djph.net>
Date2018-05-24 13:20 +0200
Message-ID<vSWrN-8ot-21@gated-at.bofh.it>
In reply to#196038
Abdullah Ramazanoğlu wrote:
> On Thu, 24 May 2018 07:22:56 +0100 André Rodier said:
>
>> I am looking for a native package on Debian, that can give me the
>> external IP address of the machine.
>> 
>> So far, I used internet sites, but I am sure there is a package that do
>> that properly, especially if one site is unreachable.
>> 
>> Something I can run from the command line, and that would return the
>> external IP address.
>
> Unless you have a dedicated IP address, then even if you directly
> connect to your ISP (no routers, no NAT) you will likely get a local
> pool address and from there routed to the internet by your ISP. In
> that case your link will have 2 *local* addresses (e.g. 192.168.. or
> 10...) : one for your side, one for ISP side. You first enter ISP's
> local IP pool, and from there exit to the internet over a real address
> from ISP's address block.
>

Ew, CGNAT. :(

If you have a particularly poor ISP, they may even NAT you somewhere
insane outside of RFC1918 (10.0.0.0 - 10.255.255.255 / 172.16.0.0 -
172.31.255.255 / 192.168.0.0 - 192.168.255.255) or RFC6598 (100.64.0.0 -
100.127.255.255) space.

I've seen some of these jokers use space in some of the "old /8" space -
stuff owned by the likes of the US DOD, AT&T, HP, etc. who got in back
in the early days.  So even if it looks like you have a "public" IP
address on your router, it's always a good idea to verify from the
outside.

-- 
|_|O|_| Registered Linux user #585947
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5  4AEE 8E11 DDF3 1279 A281

[toc] | [prev] | [next] | [standalone]


#196061

FromAbdullah Ramazanoğlu <ar018@yahoo.com>
Date2018-05-25 03:30 +0200
Message-ID<vT9Il-8vx-5@gated-at.bofh.it>
In reply to#196044
On Thu, 24 May 2018 11:04:51 -0000 (UTC) Dan Purgert said:

> Ew, CGNAT. :(
> 
> If you have a particularly poor ISP, they may even NAT you somewhere
> insane outside of RFC1918 (10.0.0.0 - 10.255.255.255 / 172.16.0.0 -
> 172.31.255.255 / 192.168.0.0 - 192.168.255.255) or RFC6598 (100.64.0.0 -
> 100.127.255.255) space.

Since RFC1918 and RFC6598 reserved addresses you mentioned are free (as in
lunch) to use, an ISP violating them in their internal cloud must be really
poor of clues, rather than of finances.

Regards
-- 
Abdullah Ramazanoğlu

[toc] | [prev] | [next] | [standalone]


Page 1 of 3  [1] 2 3  Next page →

Back to top | Article view | linux.debian.user


csiph-web