How to find to which network i'm actually connected

17,174

You are connected to both. What you are really asking (I think) is which connection am I using to send data. This is shown from the routing table.

For example:

[dave@rclogin ~]$ /sbin/route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
139.222.85.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
0.0.0.0         139.222.85.1    0.0.0.0         UG    0      0        0 eth0

Shows the current routes, in my case everything goes to eth0.

Routing works from top-to-bottom so for example if I had:

139.222.85.0  0.0.0.0  255.255.255.0  U  0  0  0 eth0
139.222.85.0  0.0.0.0  255.255.255.0  U  0  0  0 wlan0

Then it would use eth0 as a route was found before wlan0 was reached.

The reason I think you are getting connectivity problems when disconnecting is perhaps caused by both interfaces sharing the same IP range (which I'm guessing is the case?), so connections to that network are being torn down before being re-established.

Share:
17,174

Related videos on Youtube

Jeevi
Author by

Jeevi

Updated on September 18, 2022

Comments

  • Jeevi
    Jeevi almost 2 years

    In our office we have both LAN and Wi-Fi network. say i have now connected to both LAN and WiFi. now when i give ipconfig. It is showing both LAN IP and also WiFi IP. I want to know, to which network i'm really connected. The 'Network connections icon' on laptop is showing that i'm connected to WiFi, when i have both WiFi and LAN connection. But if i remove LAN connection.. My network is getting interrupted and taking time to connect to WiFi again.

    How to find to which network i'm really connected??

  • Jeevi
    Jeevi over 11 years
    These are my Ips >> LAN - 111.18.60.173 || WIFI - 111.18.160.238
  • Jeevi
    Jeevi over 11 years
    ' so connections to that network are being torn down before being re-established.' can u explain this statement in detail ?
  • Dave
    Dave over 11 years
    I did say "think" at the start of that sentence, I would need to model it properly to be certain. However when you have two interfaces that have exactly the same network/routing information things can easily get confused when routing is being updated (such as a link being removed). You mentioned your Wifi reconnecting - is this actually the case e.g. do you see the wireless interface loose connection and then re-negotiate with the base station, or rather do you just see interruption to data? If just interruption I think the network+default routes are being removed and need re-created.
  • Jeevi
    Jeevi over 11 years
    i can see my Wi-Fi is getting disconnected. (losing connection)