CentOS7優先選擇使用IPv4

CentOS7優先選擇使用IPv4

現在大多數情況下IPv6是不能關掉的,很多程序比如grpc等等都是強依賴IPv6的,並且現在好多APP也需要支持IPv6,但是很多服務器IPv6網絡是不通的。

就會出現如下的情況

[root@ipcpu-xops ~]# yum search zabbix
Loaded plugins: fastestmirror
http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed to connect to 2604:a880:1:20::b82:1001: Network is unreachable"
Trying other mirror.
http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed to connect to 2604:a880:1:20::b82:1001: Network is unreachable"
Trying other mirror.

如何讓這些程序優先走IPv4呢?

其實有個配置文件 /etc/gai.conf,這個文件默認不存在的,需要自己創建。

內容如下

precedence ::ffff:0:0/96  100

默認的幫助文件在這裏:
/usr/share/doc/glibc-common-2.17/gai.conf

參考資料
https://4thsight.xyz/695

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章