Nice! A network tool I've always wanted is one that automates the investigation you have to do manually if you are experienceing "internet issues". I mean, the check list is quite straightforward but still a pretty manual process, stuff like: - Do I have the expected IP? - Is there large packet loss or latency issues hinting at connectivity issues? - Can I ping the local gateway? - Can I ping to outside network? - Is…
#!/bin/zsh ip addr | grep $localNetworkPrefix ping $localGateway ping 1.1.1.1 ping $DNS01 ping $DNS02 open -a Safari https://downdetector.com/status/%1 Do `chmod +x ./scriptname.sh` to make executable and run with argument (e.g. net.sh facebook) to check a particular service. Edit: Thanks @Shared404
You can use the following:
netstat -rn -f inet | grep default | head -n 1 | awk '{ print $2 }'
To get the default gateway that is the preferred one on macOS, so you don't need to hard code it. scutil --dns
Will display the DNS servers/split DNS configuration as well.