Search code examples
pycharmipv6remote-debugging

How to add remote interpreter via ipv6 in Pycharm?


My server has only an ipv6 address, and my computer can directly ssh to it via this address. But when I tried to add the remote interpreter on this server in Pycharm, it tells me SFTP host is invalid when it sees the ipv6 address.

How can I make it work? Thank you!

enter image description here

Update: adding brackets [2001:da8:...] helped pass the host syntax check. But now upon clicking "Ok", Pycharm tells me "java.net.SocketException: Protocol family unavailable". How to pass this?


Solution

  • Finally I got that to work.

    First, a valid IPV6 SFTP address must be wrapped in brackets. That is, instead of 2001:da8:201:1146:226:b9ff:...., you should write [2001:da8:201:1146:226:b9ff:....].

    Second, if you do so you will find Pycharm telling you "java.net.SocketException: Protocol family unavailable" and refuse to connect. This is an issue of Pycharm running under JDK 1.7 (yes, Pycharm is based on Java). To solve this:

    1. Open Help | Edit Custom VM Options
    2. Add -Djava.net.preferIPv6Addresses=true in it. You may also want to delete -Djava.net.preferIPv4Addresses=true but I'm not sure whether it matters.
    3. Restart Pycharm.

    See here for more information:https://intellij-support.jetbrains.com/hc/en-us/articles/207241215-Network-connectivity-issues-when-running-under-Java-1-7