dns - Why can I not ping addresses with leading or trailing underscores on linux -
on windows:
- accessing
_.github.com
in browser works nslookup _.github.com
worksping _.github.com
works
on linux (tested on 2 separate networks):
- accessing
_.github.com
in browser works host _.github.com
worksping _.github.com
does notpython -c "import requests; requests.get('_.github.com')"
does not
what going on here?
because linux (more specifically, component of such libresolv or ping itself) honoring rfcs. underscores not allowed in hostnames, , hostname looking when using ping. (underscores allowed in other types of dns records, example srv records, txt records such used dkim...)
see rfc 1123 section 2.1, , rfc 952. here other links discussion of topic:
stack overflow - can (hostname) subdomains have underscore “_” in it?
domainkey - underscores in dns
quora - why underscores not allowed in dns host names?
update: couple of people pointed out in comments, linux ping happy a_a.github.com
. doing few more tests (centos 7 in case):
ping: unknown host _.github.com ping: unknown host a_.github.com ping: unknown host _a.github.com $ ping a_a.github.com ping github.map.fastly.net (23.235.40.133) 56(84) bytes of data. 64 bytes 23.235.40.133: icmp_seq=1 ttl=59 time=29.7 ms
so seems linux ping not reject underscore completely, appear disallows being first or last character (or, consequence, character) in atom of hostname.
Comments
Post a Comment