#IP address of Cellular and Wifi network when wifi is cnnected

1 messages · Page 1 of 1 (latest)

manic vortex
#

Hi all
I am currently doing a project for which I need to get IP address of Cellular and wifi simultaneously.
I was able to get (IP of wifi) and (IP of cellular network when not connected to wifi)

but I am unable to get a cellular IP address when my mobile is connected to Wifi.

I have searched full of my capacity, and I have arrived at the conclusion that it is impossible since only 1 network might remain active.
Is that the right conclusion or is there a hidden ancient knowledge that might help me

twilit wedge
#

just click on Wi-Fi you’re connected to

#

and press the blue i

#

and it shows your ip

manic vortex
#

I should have added more details
I am doing an android project and I want to get the IP addresses of cellular and wifi simultaneously.
Now when wifi is connected only wifi ip is visible and when cellular is connected only mobile ip is visible

#

I want both at the same time

twilit wedge
#

What do you mean tho

#

when mobile is connected to wifi

#

won’t the IP of both be the same

#

and you just need to figure out the subnet mask

#

the router has the public IP static right , not sure not a networking guy

twilit wedge
#

so how are you getting the IP

#

like are you trying to find this out from a Linux program

#

or some phone thing

#

or by checking phone manually

manic vortex
#

if you are on cellular network you get a different IP if you are on a wifi network you get a different IP

twilit wedge
#

so this is mega confusing and I am also not really knowledgeable and experienced about this, so double check this but I will try to share what I know

so your Router typically will have 1 static IP address - provided by the ISP

this might be 192.144.1.0 for example

you can run this to get the info for your router

ifconfig # mac
ip addr show # linux
#

then look for en0

#

for ex

ifconfig | grep en0
netmask 0xffffff00 broadcast 192.144.1.255 

so the 0xffffff00 part is the submask - f is hexadecimal for 8 bits - so that means this is how many bits from the 32 bit the router uses - so 24 bits

#

so that leaves 8 bits to be assigned "dynamically" for your devices like phone or laptop etc. - and the DHCP server assigns this

#

so when u connect ur phone to the wifi - if the wifi static addr is 192.144.1.0 and it has last 8 bits left for dynamic addresses , your phone will have an IP address in the subnet with

between 192.144.1.1 - 192.144.1.255