Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a WiFi router, connected by Ethernet cable to my Ubuntu desktop and Android mobile. I have sshd set up.

The telephone-line-in cable to the router was cut. But both devices were still connected to it, but unable to access the Internet.

So, just to test, I tried to establish an SSH connection from my mobile to the desktop (using the ConnectBot Android app). To my utter astonishment, I got a successful SSH session.

Why were the two devices able to connect through SSH?

share|improve this question
    
Was the mobile connected on the same network (via your router) as the desktop? – dadexix86 Mar 20 at 17:43
    
Yes, they were connected to the same router. – Bharadwaj Raju Mar 20 at 17:44
31  
Then it just went through the router, without the needing to go outside of it :) – dadexix86 Mar 20 at 17:44
38  
As an analogy: the only highway in and out of your town is blocked by a landslide and nobody can drive in or out. You can still go to your next door neighbor's house because the roads inside your town work fine. Similarly, the internet connection to the outside world is disabled by the cable being cut, but the devices inside your network can still talk to each other. – Zach Lipton Mar 20 at 23:56
    
Did you think everything has to connect to "the cloud" in order to function? – Matti Virkkunen Mar 22 at 3:46
up vote 42 down vote accepted

Your router is only a Gateway to another WAN network; the router in itself is just another node on the local network. As your other nodes have the same network settings, they should be able to connect just fine. Since they are indeed connected, you have a valid local area network (LAN).

However, if you try to connect to a WAN, you wont be able to do so.

Here is the definition of SSH.

Secure Shell, or SSH, is a cryptographic (encrypted) network protocol operating at layer 7 of the OSI Model to allow remote login and other network services to operate securely over an unsecured network

An internet connection is not required to SSH into your device, unless you are trying to do it through the internet!

share|improve this answer
    
Fixed spelling and grammar. If this doesn't suit, feel free to roll back. Further suggestions: clarify what we mean here with the different uses of "connect"/"connected"; remove the bit about the router just being another node (not meaningful in normal use, as the router typically serves DHCP and DNS to the LAN, as well as acting as a wireless access point, switch, gateway, and DHCP/PPPoE client); and, especially, add that it's because the LAN is operating fine (regardless of the status of the Internet connection) that devices on the LAN can talk to each other. – Mathieu K. Mar 21 at 22:22

Your mobile (WiFi) and your desktop (Ethernet) are in the same local network. There is no magic at all.

share|improve this answer

I've heard this question many times and its hard to explain to someone with little networking experience. This is how I explain it, via a simple diagram.

Gets Both LAN and WAN, because all lines are intact.

     ISP (internet)
          |
          |
          |
     Modem/Router/Switch
      /    |    \
     /     |     \
Mobile  Desktop  Laptop

Gets Only LAN but Does Not get WAN, because the lines to the router are still intact. Doesn't get WAN (internet) because line to ISP is cut.

     ISP (internet)
          |
          x
          |
     Modem/Router/Switch
      /    |    \
     /     |     \
Mobile  Desktop  Laptop

Good luck!

share|improve this answer

Your "WiFi" router actually incorporates several functions into one device. In the past these functions would have required separate devices in separate boxes

  • broadband modem - communicates with ADSL or similar long-haul service.
  • router - connects internal network(s) to wider world
  • ethernet switch or hub - connects locally wired ethernet computers together
  • wireless access point (WAP) - connects local wireless devices together
  • DHCP server - assigns IP-addresses (etc) to local devices
  • DNS server - allows local devices to locate each other and locate Internet servers
  • NTP server - provides time to local devices.
  • etc (print server, USB NAS, ...)

When your broadband cable is disconnected, only the broadband modem function is put out of service, the router function then has little to do. The switch and WAP functions (etc) can continue to work, enabling local devices to talk to each other.

In short, the local area network (LAN) is autonomous and can mostly function without the wide area network (WAN).

share|improve this answer

Devices have IP address and Hardware address(MAC). Router has a table which has MAC address and IP address mapped . Your mobile has an IP address as well as a MAC address. When mobile app tries to find the computer Router's datalink layer makes use of a protocol called ARP(address resolution protocol) to find MAC address of Computer and sends a broadcast in a subnet.when your PC's NIC gets the request it replies to request and sends its IP of your computer from the filter table.Router saves the information in its records and maps MAC to IP.Since PC and Mobile are in same network there is no need to go out of the network (public network such as internet).Everytime router will rout the data packets to the right place when mobile tries to connect the to it.Even if the IP address changes it will again make use of ARP.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.