Get your default gateway from the terminal

If you are inside a Vagrant box and want to SSH to the host machine, you will need to get the default gateway. Or, maybe you just need the default gateway for a completely different reason. Either way, the following command should do it.

netstat -rn | grep "^ " | cut -d " " -f10

This is really useful if you don’t have ifconfig installed.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.