How can I determine the IP of my router/gateway in Java?

前端 未结 16 2236
无人及你
无人及你 2020-11-27 06:43

How can I determine the IP of my router/gateway in Java? I can get my IP easily enough. I can get my internet IP using a service on a website. But how can I determine my gat

16条回答
  •  盖世英雄少女心
    2020-11-27 07:08

    output of netstat -rn is locale specific. on my system (locale=de) the output looks like: ... Standardgateway: 10.22.0.1

    so there is no line starting with 'default'.

    so using netstat might be no good idea.

提交回复
热议问题