Reputation: 60004
How do I find out the IP address of the gateway using unix bash command line?
While usually it will be 192.168.1.1
, it might occasionally be 192.168.0.1
or something else depending on what router I connect to.
Upvotes: 1
Views: 3055
Reputation: 60004
ip
on macbrew install iproute2mac
ip route show | grep default | cut -d' ' -f 3
for h in $(ip route show|grep default|cut -d' ' -f 3) google.com; do
echo
echo ===$h===
ping -c 5 $h || break
done
Upvotes: 2