ALL
How DNS lookup works
When accessing a website, a domain name would be needed normally. To get to the actual web server, the domain name must be mapped to an actual IP address and the IP address will be used to reach the web server. The process of finding the IP address from a domain name is called DNS lookup. How does DNS lookup work? There are tons of domain name and IP address around the world, there must be some well-designed architecture to support fast lookup. This post will explain how this works.DNS ServerThe mapping between domain name and IP address is stored in DNS servers. When typing a domain name...
1,372 0 DNS DNS LOOKUP
Handle NXDomain error when resolving IP address in Ruby DNS resolver
In another post, we covered how to resolve SystemStackError when resolving IP address in Ruby. In this post, we would cover another common issue where a NXDomain error is returned when resolving an IP address. The NXDomain error means that the queried domain name does not exist in the DNS.In Ruby, DNS resolver library will use /etc/resolv.conf by default get the name servers to resolve the domain name. There are multiple DNS name servers can be specified in /etc/resolv.conf with below format.nameserver nameserver nameserver ...By default, only the top MAXNS name servers(3 in Linux by...
4,534 0 RUBY RUBY ON RAILS NETWORK DNS NXDOMAIN
Configure static IP for Linux
When a Linux server is running, it has to have an IP so that other machines can talk to it. It is often desired that the server would own a static IP so that every time other machines want to connect to it, the same IP address would be used. This is extremely useful when there are virtual machines installed on a host machine where the virtual machine would start and stop now and then. To configure static IP address for a Linux server, the /etc/network/interfaces needs to be updated. Assuming there is a host only network is created for a network interface named eth1. The configuration woul...
gethostbyname vs getaddrinfo
getaddrinfo is slower than ping when resolving domain names. I think ping uses gethostbyname to resolve a domain name. The question becomes whether getaddrinfo is slower than gethostbyname. After testing with both functions, we find that getaddrinfo is really slow compared to gethostbyname. By strace tracking, we find getaddrinfo will communicate with DNS server 10 times and gethostbyname will communicate with DNS server communication twice.gethostbyname is an old way to resolve domain name, The disadvantage of it is that it does not support IPV6, so there is a gethostbyname2 which repla...