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.



Don't have time to check my blog? Get a weekly email with all the new posts. This is my personal blog, so obviously it is 100% spam free.


Tags: , , ,

This entry was posted on Wednesday, June 22nd, 2016 at 5:26 pm and is filed under Tech. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.