LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ip address show (https://www.linuxquestions.org/questions/linux-newbie-8/ip-address-show-4175733780/)

mahesh.riddles 02-12-2024 07:38 AM

ip address show
 
Code:

ip address show
Code:

1: lo    inet 127.0.0.1/8 scope host lo\      valid_lft forever preferred_lft forever
1: lo    inet6 ::1/128 scope host noprefixroute \      valid_lft forever preferred_lft forever
2: enp0s25    inet 192.168.1.102/24 brd 192.168.1.255 scope global dynamic noprefixroute enp0s25\      valid_lft 5531sec preferred_lft 5531sec

on internet, i checked my ip address
IPv4: ? 117.205.235.222

Why is it different?
i think 192.168.x.x is a private ip

How do i find my real/public ip address
i am using fedora

TB0ne 02-12-2024 07:48 AM

Quote:

Originally Posted by mahesh.riddles (Post 6483024)
Code:

ip address show
Code:

1: lo    inet 127.0.0.1/8 scope host lo\      valid_lft forever preferred_lft forever
1: lo    inet6 ::1/128 scope host noprefixroute \      valid_lft forever preferred_lft forever
2: enp0s25    inet 192.168.1.102/24 brd 192.168.1.255 scope global dynamic noprefixroute enp0s25\      valid_lft 5531sec preferred_lft 5531sec

on internet, i checked my ip address IPv4: ? 117.205.235.222

Why is it different? i think 192.168.x.x is a private ip How do i find my real/public ip address i am using fedora

Why do you think it's different??? You have one public-facing IP address from your ISP, and the private 192 address is your local machine on your local network.

jmccue 02-12-2024 08:14 AM

If I understand what you are asking, go here: http://checkip.dyndns.org/

Forgot, this should work also where comcast.net is your Internet provider

Code:

traceroute -m 2 comcast.net

mahesh.riddles 02-12-2024 10:24 AM

From the link you gave me, the public ip address is : "117.205.235.222"

From traceroute

Code:

1  _gateway (192.168.1.1)  0.416 ms  0.452 ms  0.586 ms
 2  117.205.232.1 (117.205.232.1)  1.533 ms  1.713 ms  2.101 ms

I think it is still different.

Why am i not able to see my public ip address from "ip a" command?
Apart from traceroute, is there any command which can give my public ip?

i am not going to do this on my desktop, just asking...
If i edit /etc/hosts and resolv.conf, then will "ip a" show the public ip?

////// 02-12-2024 10:28 AM

Quote:

Originally Posted by mahesh.riddles (Post 6483024)
How do i find my real/public ip address
i am using fedora

Code:

$ curl ifconfig.me/ip
^that way you can get your ip-address via commandline.

frankbell 02-12-2024 07:59 PM

Quote:

Why am i not able to see my public ip address from "ip a" command?
Because your public ip address is in the public-facing side of your router, not on your local machine.

You can find out what it is without logging into your router by going to https://www.whatismyip.com/.

michaelk 02-12-2024 09:07 PM

<internet>-----117.205.232.1<WAN router LAN 192.168.1.1>------<192.168.1.102 PC>

The ip command shows addresses that are assigned to the PC itself.

The router/gateway device has two IP addresses. The WAN or internet side is your public IP address, the LAN side is a private IP address. Your PC address is typically assigned by the router using DHCP which in your case is 192.168.1.102.

The gateway addresses is typically the LAN IP address of your router which in your case is 192.168.1.1

___ 02-13-2024 12:31 AM

https://en.wikipedia.org/wiki/Networ...ss_translation

JJJCR 02-13-2024 03:00 AM

my 2 cents:

Internet or let's say Public network >> needs Public IP

Home or Internal network >> only needs Private IP

However, since Private IP is not able to communicate to Internet and the only acceptable IP on the Internet is Public IP
That's where NAT'ing comes into play, to save IPv4 from running out.

To find your public IP as suggested above you can open Terminal and type:

curl ifconfig.me/ip

curl ipinfo.io/ip

wget -qO- https://api.ipify.org



Quote:

Connecting to the internet: Each device connected to the internet needs a unique identifier to communicate with other devices. A public IP address acts as this unique identifier, allowing information to flow in and out of your network.

mahesh.riddles 02-13-2024 08:26 AM

Thanks a lot friends. I understood the concept and understood how silly my question was now! :-)

JJJCR 02-14-2024 11:53 PM

Quote:

Originally Posted by mahesh.riddles (Post 6483291)
Thanks a lot friends. I understood the concept and understood how silly my question was now! :-)

Don't feel bad, if you will never ask you will never know...At least you got a question others don't even know how to formulate their own questions.


All times are GMT -5. The time now is 08:52 AM.