Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The client is not respecting the IPv6/IPv4 priority from gai.conf #7716

Open
naoliv opened this issue Mar 24, 2021 · 6 comments
Open

The client is not respecting the IPv6/IPv4 priority from gai.conf #7716

naoliv opened this issue Mar 24, 2021 · 6 comments

Comments

@naoliv
Copy link

naoliv commented Mar 24, 2021

Your system information

  • Steam client version (build number or date): Mar 23 2021, at 20:11:07
  • Distribution (e.g. Ubuntu): Debian unstable
  • Opted into Steam client beta?: No
  • Have you checked for system updates?: Yes

Please describe your issue in as much detail as possible:

It seems that the steam client is not respecting the IPv6/IPv4 priority from gai.conf

I have precedence ::ffff:0:0/96 100 in gai.conf but it seems that the client is still preferring IPv6 connections.
For example, right now that I am downloading a game (from netstat):

tcp6       0      0 2804:c30:c21c:dd0:54537 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:39871 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0    292 2804:c30:c21c:dd0:36333 2602:801:f005:100:::443 ESTABLISHED 529939/steam        
tcp6       0    292 2804:c30:c21c:dd0:41539 2602:801:f005:100:::443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:50991 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0    292 2804:c30:c21c:dd0:38121 2602:801:f005:100:::443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:47815 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:36023 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:57385 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:54169 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:42121 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:41529 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0    292 2804:c30:c21c:dd0:48531 2602:801:f005:100:::443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:40959 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:42887 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:33387 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:38343 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:41091 2602:801:f005:100:::443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:46143 2602:801:f005:100:::443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:47353 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0    286 2804:c30:c21c:dd0:59439 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0      0 2804:c30:c21c:dd0:34959 2001:4de0:ac19::1:b:443 ESTABLISHED 529939/steam        
tcp6       0    292 2804:c30:c21c:dd0:34783 2602:801:f005:100:::443 ESTABLISHED 529939/steam        
tcp6       0    292 2804:c30:c21c:dd0:35041 2602:801:f005:100:::443 ESTABLISHED 529939/steam   

Steps for reproducing this issue:

  1. Set precedence ::ffff:0:0/96 100 in gai.conf
  2. Download something
  3. See that steam is only using IPv6
@booth-f
Copy link

booth-f commented Nov 1, 2021

I think your precedence setting is misconfigured.
::ffff:0:0/96 matches for IPv6 transition mechanisms like NAT64/DNS64, not the entire IPv6 address space. It looks like you have working IPv6 so this precedence isn't being applied to it because it is not included in that range.

I think setting the following should set Steam to prefer IPv4 over IPv6.
precedence ::/0 100

Give that a try and let me know if that helps!

Edit: This should set IPv4 to be the preferred protocol for ALL communications on your server, not just to steam. Keep that in mind.

@naoliv
Copy link
Author

naoliv commented Nov 1, 2021

At section 10.3, RFC 3484 says:

The default policy table gives IPv6 addresses higher precedence than
IPv4 addresses. This means that applications will use IPv6 in
preference to IPv4 when the two are equally suitable. An
administrator can change the policy table to prefer IPv4 addresses by
giving the ::ffff:0.0.0.0/96 prefix a higher precedence

This is also what is commented in /etc/gai.conf:

#    For sites which prefer IPv4 connections change the last line to
#
#precedence ::ffff:0:0/96  100

@krzee
Copy link

krzee commented Jan 4, 2023

i dont use steam but i do confirm that only uncommenting:
precedence ::ffff:0:0/96 100
makes my machines prefer ip4 over ip6 for all of the internet, and i also have working ipv6 natively.

@dakrk
Copy link

dakrk commented Jul 19, 2023

Can confirm this still happens. This is a problem for me as I use an IPv6-only VPN for access to IPv6 services, and the speed of downloads on Steam through it are incredibly slow compared to my IPv4 connection. I shouldn't have to disconnect from it just to update a game, as that will interrupt other things I have running that access services on IPv6.
This would be an even bigger problem for people using tunnels that actually limit bandwidth and data transferred.

@christianweinz
Copy link

I'm also experiencing that the steam client does not respect the preference for IPv4 in gai.conf as reported by others before. Steam should respect the settings of the operating system, so I consider this a bug.

There is a workaround to force steam to use IPv4 by starting steam in a network namespace that only has IPv4.

  • First, we add a new network namespace
    sudo ip netns add ipv4_only
  • We create a bridged virtual interface
    sudo ip link add macvlan0 link $network_interface type macvlan mode bridge
  • We add it to the created namespace
    sudo ip link set macvlan0 netns ipv4_only
  • We start the loop interface in the namespace
    sudo ip netns exec ipv4_only ip link set lo up
  • We get a new IPv4 address via DHCP in the namespace
    sudo ip netns exec ipv4_only dhclient
  • We disable IPv6 in the namespace
    sudo ip netns exec ipv4_only sysctl set net.ipv6.conf.macvlan0.disable_ipv6=1
  • We start steam in the namespace
    sudo ip netns exec ipv4_only sudo -u $user /usr/games/steam

Maybe I'll find time to automate this with systemd or some custom launcher for steam. Any ideas how to achieve that are appreciated.

@kaitlynkittyy
Copy link

I don't have anything else to add besides what was originally said, but I want to say that this issue is present for me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants