How to Find Your Closest Anycast DNS Server with Dig

Most ISP deploys Anycast DNS server on their network and bring the closest DNS server to their user for DNS resolver. You may see a DNS server with a single IP Address but there are multiple DNS Servers running on different geographical location.

So which DNS server do you resolve it from? For example we run a query on DNS F Root Server


$ dig @f.root-servers.net hostname.bind  txt ch +short
"lga1a.f.root-servers.org"

On the result, it shows that I am using lga1a.f.root-servers.org as resolver. Some DNS server does reply “chaos” (ch) request but some refuse; for example Google DNS and Open DNS Server. So if your ISP is running Anycast DNS, you can try to lookup where is the DNS server locate.

There is another command perform checking via “id.server” query, it only helpful when the DNS has server-id configured.


dig @k.root-servers.net id.server txt ch +short
"k2.tokyo.k.ripe.net"

How to View Chinese Character with iTerm in Mac OSX

I guess most people use iTerm in Mac OSX, me too :) I do have a lot Chinese character file, or rather MP3 to view in Chinese character.

To enable Chinese character in iTerm, change the encoding to UTF-8


Open your iTerm Terminal
Press Apple Command key + i
Encoding, select UTF-8
Remember to click on Update Default

Exim: Restrict Authenticated Outgoing Email with Sender Domain

Most of the outgoing SMTP server allowed the user to set different sender email address once it is authenticated. But we might be in risk for allowing the user to send outgoing bulk/spam email via authenticated SMTP with different sender email address.

In Exim mail MTA, it can restricts at the SMTP authenticated transport.


accept  authenticated = *
          sender_domains = < the_domain_name_1 > : < the_domain_name_2 >
          control       = submission
          control       = dkim_disable_verify

Usually local_domains is the list of the domain hosted on Exim mail server, it can be configured as below too.


accept  authenticated = *
          sender_domains = +local_domains
          control       = submission
          control       = dkim_disable_verify

Bash: How to Echo Tab and Newline

While printing out result in bash, sometime we need to echo tab or newline for nice, gorgeous, maning looking format. The code below will NOT print tab space and newline


echo "username\t password\n"

In order to print tab and newline, invoke -e in the echo command


ehco -e "username\t\t password\n"

How to Set VI or VIM Tab Space

By default, vi or vim editor tab space is 8 spaces. You can configure preferred space by the value below in .vimrc file


set tabstop=2
set shiftwidth=2