LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   loopback address problem in Fedora (https://www.linuxquestions.org/questions/linux-networking-3/loopback-address-problem-in-fedora-915060/)

getin 11-23-2011 04:41 AM

loopback address problem in Fedora
 
Hi,

I'm using Fedora 14 (I encountered same problem in the other versions). I'm trying to do socket programming for IPv6. But I always get the same error: "bind error". I coded all program to IPv6 (AF_INET6, sockaddr_in6, sin6_family, ..etc). I think that bind use the Ipv6 lo address ::1. I ping to ::1 address and I access that. But I don't understand that bind don't access that.

thank in advance

Skaperen 11-23-2011 09:43 PM

The default for Linux is that an attempt to bind with "::" as the local address ALSO binds "0.0.0.0" over in the IPv4 space. If you already have a separate socket bound to "0.0.0.0" for the same port number, then doing this with IPv6 will collide. There are two ways around this:

1. Only bind to the IPv6 and it let it also handle the IPv4 connections on this one socket.

2. Change the behavior system wide with: sysctl -w net.ipv6.bindv6only=1

If you choose method #2 it will affect all programs, where others might need to be reconfigured to specifically listen on 2 sockets to listen to both IPv4 and IPv6. Also, if you want this to be persistent across reboots, you need to configure an init/rc script to do that command (again).


All times are GMT -5. The time now is 06:22 PM.