Thursday, March 29, 2018

linux - Setting IPv4 as preferred protocol over IPv6



I'm using both IPv6 and IPv4 in a LAN network containing Slackware 13.0 boxes. How can I set IPv4 as preferred protocol on the workstations in this network? I want to use IPv6 either explicitly or when there are only AAAA records available. For example, if I try to open http://ipv6.org/ from Firefox, I will always connect via IPv6. The situation is the same with other applications. I tried creating /etc/gai.conf and adding the following to it:



precedence ::ffff:0:0/96  100



This should control the behavior of getaddrinfo(3) at least in Debian, but it didn't help on Slackware.



Any ideas will be appreciated. Thanks in advance!


Answer



According to the man page, inserting a precedence value in gai.conf disables the all the other default rules. Try setting all the rules as listed in RFC 3484 (10.3):



  Prefix        Precedence Label
::1/128 50 0

::/0 40 1
2002::/16 30 2
::/96 20 3
::ffff:0:0/96 100 4

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...