Finding router Private WAN IP through bash

I am new to networking and I don't have knowledge in this field. As far as I know there are three types IP addresses.

  1. Local addresses like 192.168.x.x used in LANs.
  2. A WAN address
  3. A private address like 10.x.x.x which some routers show on configuration or system information tab..

Below is the screenshot of system information of my home router

Now,

  1. I can get the first type of address by ifconfig.
  2. I can get the second type by using either host or dig or any other website.
  3. I can get the third type by logging into the router's admin panel.

So my question is how can I get the third type of addresses (the red en-rectangled one) without logging into the admin panel i.e, through bash or something ?

enter image description here

4

1 Answer

as far as I know, that WAN IP Address is the local IP your router is getting from your ISP router/OTU/Modem in their network (I suppose you have 2 routers? ISP and personal?)

Think about it like this: you have your personal router, which creates its own network, the router IP is something like 192.168.1.1, and your devices connected to that router could get local IPs like 192.168.1.2, 192.168.1.3 and so on. And it's the same thing with your ISP router, it has its own IP, lets say something like 10.1.100.1 (this is the information presented in the Default Gateway field in your screenshot), so your ISP router has its own network, and devices connected to it (like your personal router) would get local IP's like 10.1.100.2 just like it happens in your personal router's network.

So basically saying, that red marked IP in the screenshot is just the local IP your personal router is getting from your ISP router.

So if you have a computer A connected to your personal router, I'm not sure but I think you can not find the IP's of the devices connected to your ISPs router from that computer A.

But if you had a computer A connected directly to your ISPs router (cable or wifi), then you could run the command nmap -sn 10.1.100.0/24 (of course you have to adapt that to your router network address and the fourth and last group of digits from the IP should be set to 0 check this guide for more info) to check the devices connected to that same network (in this case computer A and your personal router).

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like