"Permission denied" using socket with IPv6
Bobby Bissett
bbissett at gmail.com
Mon Jun 1 20:14:07 UTC 2015
Hi all,
Can someone tell me how to diagnose this issue? I can't create a connection
to another node using IPv6 because of the error below -- a short app
demonstrates the problem. Everything I've found online so far is aimed at
using IPv4 instead, but that's not my goal. This is on a Centos 6.6 virtual
machine.
--- begin ---
[root at TWO test]}> java -version
java version "1.7.0_79"
OpenJDK Runtime Environment (rhel-2.5.5.3.el6_6-x86_64 u79-b14)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
[root at TWO test]}>
[root at TWO test]}>
[root at TWO test]}> cat IPv6Test.java
import java.net.InetAddress;
import java.net.Socket;
public class IPv6Test {
public static void main(String[] args) {
try {
InetAddress ia =
InetAddress.getByName("fe80::20c:29ff:fe98:9210");
System.err.println("Opening socket for: " + ia);
Socket socket = new Socket(ia, 7800);
System.err.println("We have: " + socket);
} catch (Exception e) {
e.printStackTrace();
}
}
}
[root at TWO test]}>
[root at TWO test]}> javac IPv6Test.java && java IPv6Test
Opening socket for: /fe80:0:0:0:20c:29ff:fe98:9210
java.net.SocketException: Permission denied
at java.net.PlainSocketImpl.socketConnect(Native Method)
at
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.<init>(Socket.java:425)
at java.net.Socket.<init>(Socket.java:241)
at IPv6Test.main(IPv6Test.java:10)
[root at TWO test]}>
[root at TWO test]}> java -version
java version "1.7.0_79"
OpenJDK Runtime Environment (rhel-2.5.5.3.el6_6-x86_64 u79-b14)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
--- end ---
>From this node, am able to ping6 the address fine:
[root at TWO test]}> ping6 -I eth3 fe80::20c:29ff:fe98:9210
PING fe80::20c:29ff:fe98:9210(fe80::20c:29ff:fe98:9210) from
fe80::20c:29ff:fec6:91a eth3: 56 data bytes
[...]
2 packets transmitted, 2 received, 0% packet loss, time 1023ms
I don't have selinux or a firewall running, not that I think that would
matter since Java can't start to connect anyway from the message above.
Thanks,
Bobby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/net-dev/attachments/20150601/590cb9fc/attachment.html>
More information about the net-dev
mailing list