Prioritize IPv4 over IPv6 on a Windows server

With the new Evoxt implementation, where all new VM deployments will be assigned an IPv6 address, we have received reports from customers due to websites and servers not supporting IPv6 and causing problems.
 

All Windows servers will prefer IPv6 over IPv4 if IPv6 is enabled. Disabling IPv6, which is the new internet protocol, will cause your server to be not future-proof. So this guide will help you configure your Windows server network connection to prefer IPv4 over IPv6.
 

Change IPv4 priority on Microsoft's Network Shell

To do that, you will need to do so from CMD
 

1) Head to CMD, Windows Search > CMD. Alternatively, you can access it through WIN + R, then type in cmd.exe and press ok.
 

2) On CMD, copy these lines and paste them into CMD. This will move the priority of the IPv4 mapped address to the top, making Windows use IPv4 as the default internet protocol. ::ffff:0:0/96 is an IPv4 mapped address range, equivalent to IPv4. Created to aid in IPv4 to IPv6 transition.
 

netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 50 4
netsh interface ipv6 set prefixpolicy ::1/128 40 0
netsh interface ipv6 set prefixpolicy ::/0 30 1
netsh interface ipv6 set prefixpolicy 2002::/16 20 2
netsh interface ipv6 set prefixpolicy 2001::/32 5 5
netsh interface ipv6 set prefixpolicy fc00::/7 3 13
netsh interface ipv6 set prefixpolicy fec0::/10 1 11
netsh interface ipv6 set prefixpolicy 3ffe::/16 1 12
netsh interface ipv6 set prefixpolicy ::/96 1 3

Now try to ping google again. Ping should default to IPv4.

Bonus:
To change IPv6 back to the default internet protocol used, use the command below and do a restart.

netsh interface ipv6 reset




 

Change IPv4 preference through Registry

1) Head to Registry, Windows Search > Regedit. Alternatively, you can access it through WIN + R, then type in regedit.exe and press ok.

2) Go to HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Services > Tcpip6 > Parameters (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\)



3) On the folder, right-click and create a Dword (32-bit).


4) Then, rename the entry to DisabledComponents


5) Right-click on the entry and click on modify


6) Enter 0x20 in the value data field as shown in the screenshots below, then click Ok



7) Once this is done, do a server restart.

Now try to ping google again. Ping should default to IPv4.

Bonus:
To change IPv6 back to the default internet protocol used, delete the entry (DisabledComponents) and do a server restart.
 

Source: Configure IPv6 for advanced users - Windows Server | Microsoft Learn




 

If these are too complicated, you can also choose to just disable IPv6 networking entirely. However, this will disable the dual stack status and cause your server to be not future-proof.

Take a look at this guide here

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值