{
    "mode": "man",
    "parameter": "gai.conf",
    "section": "5",
    "url": "https://www.chedong.com/phpMan.php/man/gai.conf/5/json",
    "generated": "2026-09-01T18:29:05Z",
    "sections": {
        "NAME": {
            "content": "gai.conf - getaddrinfo(3) configuration file\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "A  call to getaddrinfo(3) might return multiple answers.  According to RFC 3484 these answers\nmust be sorted so that the answer with the highest success rate is first in  the  list.   The\nRFC provides an algorithm for the sorting.  The static rules are not always adequate, though.\nFor this reason, the RFC also requires that system administrators should have the possibility\nto  dynamically  change the sorting.  For the glibc implementation, this can be achieved with\nthe /etc/gai.conf file.\n\nEach line in the configuration file consists of a keyword and its parameters.   White  spaces\nin any place are ignored.  Lines starting with '#' are comments and are ignored.\n\nThe keywords currently recognized are:\n\nlabel netmask precedence\nThe value is added to the label table used in the RFC 3484 sorting.  If any label def‐\ninition  is present in the configuration file, the default table is not used.  All the\nlabel definitions of the default table which are to be maintained have  to  be  dupli‐\ncated.  Following the keyword, the line has to contain a network mask and a precedence\nvalue.\n\nprecedence netmask precedence\nThis keyword is similar to label, but instead the value is added to the precedence ta‐\nble as specified in RFC 3484.  Once again, the presence of a single precedence line in\nthe configuration file causes the default table to not be used.\n\nreload <yes|no>\nThis keyword controls whether a process checks whether the configuration file has been\nchanged  since  the last time it was read.  If the value is \"yes\", the file is reread.\nThis might cause problems in multithreaded applications and is generally a  bad  idea.\nThe default is \"no\".\n\nscopev4 mask value\nAdd  another rule to the RFC 3484 scope table for IPv4 address.  By default, the scope\nIDs described in section 3.2 in RFC 3438 are used.   Changing  these  defaults  should\nhardly ever be necessary.\n",
            "subsections": []
        },
        "FILES": {
            "content": "/etc/gai.conf\n",
            "subsections": []
        },
        "VERSIONS": {
            "content": "The gai.conf file is supported since glibc 2.5.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "The  default  table according to RFC 3484 would be specified with the following configuration\nfile:\n\nlabel  ::1/128       0\nlabel  ::/0          1\nlabel  2002::/16     2\nlabel ::/96          3\nlabel ::ffff:0:0/96  4\nprecedence  ::1/128       50\nprecedence  ::/0          40\nprecedence  2002::/16     30\nprecedence ::/96          20\nprecedence ::ffff:0:0/96  10\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "getaddrinfo(3), RFC 3484\n\nLinux man-pages 6.7                          2023-10-31                                  gai.conf(5)",
            "subsections": []
        }
    },
    "summary": "gai.conf - getaddrinfo(3) configuration file",
    "flags": [],
    "examples": [
        "The  default  table according to RFC 3484 would be specified with the following configuration",
        "file:",
        "label  ::1/128       0",
        "label  ::/0          1",
        "label  2002::/16     2",
        "label ::/96          3",
        "label ::ffff:0:0/96  4",
        "precedence  ::1/128       50",
        "precedence  ::/0          40",
        "precedence  2002::/16     30",
        "precedence ::/96          20",
        "precedence ::ffff:0:0/96  10"
    ],
    "see_also": [
        {
            "name": "getaddrinfo",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/getaddrinfo/3/json"
        }
    ]
}