My router has a WAN PRIVATE IP address which is assigned via DHCP by my ISP. This is different from my public IP address of course.

In my router settings page I can read it:, and gateway IP is

How can I get to know this IP (while connected to my router via LAN) without having to open the router settings page?

I am looking for a shell command to show the IP in red.

scheme of my network

If I perform a tracert it doesn't show:


  1     4 ms    <1 ms    10 ms  dsldevice.lan [] <-- I don't need this one
  2    17 ms    17 ms    19 ms  <-- the actual gateway
  3    22 ms    18 ms    17 ms

etc etc


  1     1 ms     5 ms     3 ms  dsldevice.lan [] <-- This one! but how to get?

tracert dsldevice.lan

  1     1 ms     7 ms    <1 ms  dsldevice.lan []
  • 1
    That may unfortunately be impossible. You should try to scrape the router’s status page.
    – Daniel B
    Dec 19, 2015 at 11:14
  • First you are mentioning which is on the picture too and there is in tracert which you want to get?!? ;)
    – g2mk
    Dec 19, 2015 at 16:57
  • it has changed (it is dynamic) this is the reason why I am looking for a smarter way to get it, anyway, I'll correct it
    – dioporco
    Dec 19, 2015 at 16:59

3 Answers 3


Speak to your ISP. Unless they have a service (like dynamic ip management for internal use you can clip onto) you are out of luck.

Your alternatives are - 1. Scrape the router page (curl could do this) 2. Set up your own dynamic dns system if the router supports it - and the dynamic dns server is in the same network or maps ip based on what router says rather then discovering it. 3. Get rid of the router and configure your box in its place. 4. Bypass the need to know the internal IP by overlaying a vpn.

  • thank you for the answer but.. come on if I tracert it responds! There must be simpler a way!
    – dioporco
    Dec 19, 2015 at 20:24
  • Ofcourse it responds. That doesnt mean its discoverable. The problem us that its bound to the EXTERNAL interface so discovery from lan wont work becausevARP requests dont traverse routers.
    – davidgo
    Dec 19, 2015 at 20:29

Yes! It's very possible. Get a splitter, use the black ports to connect the router to the modem, and then connect your computer to the yellow port. Open up wireshark and you're done.

If you only have one ethernet port and you still want to be connected to the internet, use an Ethernet-to-USB adapter so that you can be connected to the internet on eth0, but still have the WAN private IP available from the terminal by sniffing eth1 (Wireshark has command line options so you can write a shell script to pull the IP easily).


What is model of your router? As far as I understand you dont want to look for this IP-address in router's web-interface. Perhaps you can telnet your router and try to search there. For example I have router Huawei 8245H and I can do it like that:

  1. Telnet my router (telnet
  2. Enter this command:
    WAP>display wan layer all
  3. Then CLI gives me a lot of info, I look at wan1.4 => TABLE_OF_WAN_IPV4_ADDR:
  ##### TABLE_OF_WAN_IPV4_ADDR #####
  WanIndex             0x20104001

There is what you're looking for -
If you have ZTE-router you'll have some kind of BusyBox where you can use usual shell commands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.