2008-08-03

Finding and pinging default gateway in FreeBSD

For IPv4:
netstat -nr -f inet | grep ^default | awk '{print $2}' | xargs ping

For IPv6:
netstat -nr -f inet6 | grep ^default | awk '{print $2}' | xargs ping6

1 comment:

Anonymous said...

Tere, Ketas

Awkiga saab ka ridu valikuliselt töödelda:
awk '/^default/{print $1}'


Tervitades

Eestimaa