How To Choose a Specific IP Address From a DNS Result?

Photo by Jordan Harrison on Unsplash,,,,,
scopev4 ::ffff: 3
scopev4 ::ffff: 2
scopev4 ::ffff: 1

Second column is the IP subnet, third column is the priority. The lower number has high priority.

getaddrinfo will decide which IP address/subnet is going to be used. It is going to be calculated through the 3rd column.

1) Call getaddrinfo
2) Get IP address of
3) Check if there is a rule for these IP addresses in the gai.conf file
4) Get the one that has high priority. If an IP address of is not listed in gai.conf and getaddrinfo would return that IP.
root@adil:~# systemd-resolve --flush-caches && ping -c1PING ( 56(84) bytes of data.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store