2

I have a dante socks server which is configured to listen in an ipv4 IP and to have an ipv6 external IP.
I am trying to figure out how to verify if that really works.
I tried to use curl but if I type:

curl http://google.com --socs5 1.2.3.4:9000

I will get an error on date socks side because google.com resolves to an ipv4 address and dante says that it can't route IPv4 because it has no IPv4 address configured as an external one. Which is pretty much expected.

Then I found -6 parameter for curl. It now resolves google.com to an IPv6 address but also now tries to resolve 1.2.3.4 to an IPv6 address which is wrong.

If I try to use explicitly IPv6 as an URL for curl I get an error:

curl 'http://[2a00:1450:400c:c03:0:0:0:8b]/' --socks5 1.2.3.4:9000

Also I tried to use proxychains with the telnet, but it seems that if i specify an IPv4 address as a proxy in proxychains:

socks5 1.2.3.4

It siply ignores that proxy and does a direct request if use IPv6 with telnet:

proxychains telnet 2a00:1450:400c:c03:0:0:0:8b 25

So how do I telnet to something with IPv6 address via a socks proxy on an IPv4 address?

2
  • How exactly did you configure dante? Feb 15, 2015 at 4:58
  • @MichaelHampton Something like: internal: 1.2.3.4 port=1080 external.protocol: ipv6 external: aaa:bbb:ccc:...
    – Glueon
    Feb 15, 2015 at 10:58

1 Answer 1

3

What you are seeing is one of numerous reasons why it is almost always better to send a hostname over SOCKS and let the SOCKS server resolve it to an IP address rather than resolving the IP address on the SOCKS client.

In the curl man page, I find mention of two different SOCKS5 options depending on which side you want to resolve the hostname. --socks5 will resolve the hostname on the client, --socks5-hostname will resolve the hostname on the server. I recommend using the later. Other SOCKS clients may also need to be configured to do hostname resolution on the SOCKS server. For example I have found that Firefox will resolve hostnames on the client side by default, but it does have a configuration option to do it on the server instead.

Also the man page suggestions using --proxy rather than --socks* options. From my reading the correct syntax for your case would be --proxy socks5h://192.0.2.4:9000/

4
  • Sorry, misread your answer. Yes, now I have a problem with dante which it seems does not want to resolve domain to Ipv6.
    – Glueon
    Feb 15, 2015 at 21:14
  • @Glueon Which version of curl are you using? When I tested it on Ubuntu 14.04, the -4 and -6 arguments did not affect URLs which already used an IP address. They won't affect the actual URL to be requested either, since the lookup takes place on the SOCKS server. So the only case where -4 or -6 would make a difference is if the proxy URL happen to be specified using a hostname, in which case you only specify -4 or -6 if you want to force a specific protocol to be used between curl and SOCKS server.
    – kasperd
    Feb 15, 2015 at 21:24
  • @Glueon I didn't test dante. In my tests I used curl as the SOCKS client and openssh as the SOCKS server. The SOCKS server in openssh can resolve hostnames as both IPv4 and IPv6.
    – kasperd
    Feb 15, 2015 at 22:46
  • Sorry. That was my fault. I messed up SNAT rules that's why it didn't work. Your solution works. Thank you.
    – Glueon
    Feb 15, 2015 at 23:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .