Sunday, August 3, 2008

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:

Andri said...

Tere, Ketas

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


Tervitades

Eestimaa