curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Obtain the real public IP address of mine with curl when using the socks5 proxy to access the corresponding api.

From: Hongyi Zhao via curl-users <curl-users_at_cool.haxx.se>
Date: Mon, 25 Jan 2021 09:03:50 +0800

On Mon, Jan 25, 2021 at 12:54 AM Dan Fandrich via curl-users
<curl-users_at_cool.haxx.se> wrote:
>
> On Sun, Jan 24, 2021 at 11:05:38PM +0800, Hongyi Zhao via curl-users wrote:
> > See the following testings on my Ubuntu 20.10 host:
> >
> > $ curl https://api.ipify.org/
> > 106.9.179.116
> > $ curl -x socks5://127.0.0.1:18888 https://api.ipify.org
> > 103.138.74.44
> >
> > I want to know if I still can obtain my real public IP address with
> > curl even using the socks5 proxy to access the corresponding API. Is
> > this possible?
>
> What do you mean "real" IP address?

I mean the public but dynamic IP address my ISP assigned to me.

> Such external IP address services only have
> access to the IP address used to connect to their servers and that's what they
> return. If a proxy uses another address to contact the server, then that's what
> they return. What address are you interested in?

See my above explanation.

> Your local machine's address?

I'm using the PPPoE dialing on the router and the machine running curl
is located on an intranet behind the router's gateway, so it's not
equivalent to my local machine's address for my case.

> The command "ip address" will give you that.

As described above, this only give me the following private address
instead of the dynamically assigned public IP address by my ISP to my
router:

$ ip a show enp4s0
2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state
UP group default qlen 1000
    link/ether 3c:ec:ef:00:f1:28 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.2/24 brd 192.168.0.255 scope global enp4s0
       valid_lft forever preferred_lft forever
    inet6 240e:340:3f45:9790::1000/128 scope global dynamic noprefixroute
       valid_lft 81994sec preferred_lft 81994sec
    inet6 240e:340:3f45:9790:3eec:efff:fe00:f128/64 scope global
dynamic mngtmpaddr noprefixroute
       valid_lft 86300sec preferred_lft 14300sec
    inet6 fe80::3eec:efff:fe00:f128/64 scope link
       valid_lft forever preferred_lft forever

For my scenario, from one of my intranet machine, I want to do DDNS,
which will update the A record of my domain name on the remote DNS
server using the public dynamic IP address on my router.

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao_at_gmail.com>
Theory and Simulation of Materials
Hebei Polytechnic University of Science and Technology engineering
NO. 552 North Gangtie Road, Xingtai, China
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2021-01-25