Labs · Cyber Security
Lab: Find Your Laptop's Private IP, Your Router's Gateway and Your Public IP, and Explain the Difference
Course: Cyber Security · Chapter 1: IP Addressing: IPv4, Subnets, Public and Private IPs
Chapter 1 explains IPv4, subnets, public and private IPs; this lab finds them on your own laptop.
Chala mitrano! Every device has an address, just like every house has one. Today we find three addresses on our own laptop: the private IP inside the home, the router's address (the gateway) and the public IP the internet sees. No hacking, only looking at our own settings. Ekdum simple aahe.
चला मित्रांनो! प्रत्येक घराला पत्ता असतो तसाच प्रत्येक device ला address असतो. आज आपण आपल्याच laptop वर तीन addresses शोधणार: घरातला private IP, router चा address (gateway) आणि internet ला दिसणारा public IP. Hacking नाही, फक्त आपल्या settings बघायच्या. एकदम simple आहे.
चलो दोस्तों! जैसे हर घर का पता होता है, वैसे ही हर device का address होता है। आज हम अपने ही laptop पर तीन addresses ढूँढेंगे: घर के अंदर का private IP, router का address (gateway) और internet को दिखने वाला public IP। Hacking नहीं, सिर्फ अपनी settings देखना। बिल्कुल simple है।
Suppose we are…
Suppose we have joined the TCS support desk as a trainee. A user calls: "My laptop says connected, but no website opens." The first question every support engineer asks is: "What is your IP address and can you reach your gateway?" Before we can help others, we practise on our own laptop at home.
In this lab we find the private IP (the address the router gives our laptop inside the home), the default gateway (the router's own address, the door from our home network to the internet) and the public IP (the one address the whole home shares on the internet).
Goal of this lab
By the end you will have:
- Your laptop's private IPv4 address, subnet mask and default gateway, written down.
- Your public IP, and a one-line explanation of why it is different from the private one.
- A small drawing of your home network: laptop, phone, router and internet.
What you need (all free)
- Your own Windows, Mac or Linux laptop on home Wi-Fi.
- Command Prompt (Windows) or Terminal (Mac/Linux).
- Any web browser.
- 20–25 minutes.
Safety and ethics
We only look at our own laptop's settings. Do not post your public IP on social media or in screenshots you share; it can reveal your rough location and internet provider.
Part 1 (Windows): private IP and gateway
- Press Windows + R, type
cmdand press Enter. -
Type this command and press Enter:
ipconfigWhat you should see: a block called Wireless LAN adapter Wi-Fi with lines for IPv4 Address, Subnet Mask and Default Gateway.
-
Write down the three values. A typical home looks like
IPv4 Address 192.168.1.7,Subnet Mask 255.255.255.0,Default Gateway 192.168.1.1. -
Check that the gateway answers (replace with your gateway):
ping 192.168.1.1What you should see: four lines starting with
Reply from 192.168.1.1and a time of a few milliseconds.
Part 2 (Mac or Linux): private IP and gateway
-
On a Mac, open Terminal (Cmd + Space, type Terminal) and run:
ipconfig getifaddr en0 route -n get default | grep gatewayWhat you should see: your private IP, for example
192.168.1.9, and a linegateway: 192.168.1.1. -
On Linux (Ubuntu), run
ip -4 addr showandip route | grep default. The gateway is the address afterdefault via.
Part 3: public IP and the difference
-
Open your browser and visit
https://ifconfig.me(or search "what is my IP" on Google). Write down the number shown.What you should see: an address that does not start with
10.,172.16.–172.31.or192.168.. Those three ranges are reserved for private networks. -
Turn on mobile data on your phone, switch off its Wi-Fi, and open the same page on the phone. Then switch the phone back to home Wi-Fi and open it again.
What you should see: on mobile data the phone shows a different public IP; on home Wi-Fi the phone and laptop show the same public IP.
-
Write one line in your notes: "My router uses NAT (Network Address Translation): many private addresses inside the home share one public address outside."
- Draw your network on paper: laptop and phone (private IPs) → router (gateway, private side) → internet (public IP).
Ravindra Bagale's Tip
If ipconfig shows an address starting with 169.254, the laptop did not get an address from the router at all. That is the real reason "Wi-Fi connected but no internet" happens many times. Restart the router or reconnect the Wi-Fi, then check again. Support madhe he roj dista!
Ravindra Bagale's Tip – मराठी
ipconfig मध्ये 169.254 ने सुरू होणारा address दिसला, तर laptop ला router कडून address मिळालाच नाही. "Wi-Fi connected पण internet नाही" याचं हेच खरं कारण बऱ्याच वेळा असतं. Router restart करा किंवा Wi-Fi परत connect करा, मग परत check करा. Support मध्ये हे रोज दिसतं!
Ravindra Bagale's Tip – हिंदी
अगर ipconfig में 169.254 से शुरू होने वाला address दिखे, तो laptop को router से address मिला ही नहीं। "Wi-Fi connected पर internet नहीं" का असली कारण कई बार यही होता है। Router restart करो या Wi-Fi दोबारा connect करो, फिर check करो। Support में ये रोज़ दिखता है!
Common mistakes
| Mistake | What happens | Fix |
|---|---|---|
| Reading the Ethernet or vEthernet block instead of Wi-Fi | You copy an address that is not in use | Use the block of the adapter you are connected with |
Thinking 192.168.1.7 is your internet address |
You give the wrong IP to support | Private IPs work only inside the home; check the public IP in the browser |
| Pinging the public IP of a website to "test the router" | You test the internet, not the router | Ping the gateway first, then a website |
| Sharing a screenshot that shows your public IP | Strangers learn your provider and city | Blur the public IP before sharing |
| Expecting the public IP never to change | Home broadband IPs often change after a router restart | That is normal; many ISPs give a dynamic IP |
Self-check checklist
0 of 6 done
Try-at-home challenge
Your subnet mask is 255.255.255.0 (also written /24). How many addresses can devices in your home use, and what is the first and last usable address if your gateway is 192.168.1.1?
Check your answer
A /24 has 256 addresses. The first (192.168.1.0) is the network address and the last (192.168.1.255) is the broadcast address, so 254 are usable: 192.168.1.1 to 192.168.1.254. The router already uses .1.
Samjla ka? Private inside, public outside, gateway is the door. Aata pudhe jaauya: Chapter 2 opens the doors on each address, the ports.