How do i get the default gateway in LINUX given the destination?

前端 未结 15 2133
清酒与你
清酒与你 2020-12-13 07:02

I\'m trying to get the default gateway, using the destination 0.0.0.0

I used this command: netstat -rn | grep 0.0.0.0

And it return

15条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-13 07:40

    /sbin/route |egrep "^default" |cut -d' ' -f2-12 #and 'cut' to taste...

提交回复
热议问题