Get IP address
ifconfig | grep inet
Get gateway
route -n get default | grep gateway
Get DNS
cat /etc/resolv.conf
grep "nameserver" /etc/resolv.conf
How to find out which DNS answering the DNS query
dig server_name
scutil --dns
Write to file – stackexchange
man scutil | col -b > scutil