Category Archives: Tech

Extending WiFi Range using Slave Routers

I think everyone these days ends up with a good broadband provider (like ACT in Bangalore) and have a decent high speed router too (> 100 Mbps support). But the range is always an issue. We have amazing coverage in our hall but as you move towards the bedrooms the signal drops to 1 point and sometimes none (this is the case with 2.4 GHz, the 5 GHz is short range and does not cross the hall). For a long time I was thinking of getting a wireless repeater but technically it can slow down the overall speed as it uses the same band for communicating between your actual router to the machine that is connected to the repeater.

The power network adapters have not taken the market yet by storm, so for now the best option that I could think of was using some old routers to extend the network. I managed to run ethernet cables from the LAN ports of my main router to 2 of my 3 bedrooms that are the farthest. What was remaining was to setup the routers.

I have provided the steps as 2 options. First option is for the advanced users. Second option is in detail and is meant for someone like me who did struggle a bit before gettings things to work.

OPTION 1: Simple Steps (for Advanced users 🙂 )

  • Note down the MAIN router’s IP address, its subnet mask, WiFi SSID, security mode, channel and WiFi password
  • Configure the SLAVE router’s IP address in the same subnet as main router’s, disable its DHCP and NAT, mimic the WiFi SSID, security, channel and password to match the MAIN router’s and you are done

OPTION 2: In Details Steps for Novice users

  • NOTING DETAILS FROM MAIN ROUTER:
    • My main router was a tp-link and behind it there is the IP address printed on it along with username and password. The IP address was 192.168.0.1 and username and password were both admin
    • I was connected to this router by ethernet cable and opened chrome and gave http://192.168.0.1 and provided the username and password and logged in. If there is any tab that says “Advanced” click it
    • There was a section called “Internet” which had details of my ACT username and passsword. Ignore this. We should not disturb this. It could be called as WAN in some routers.
    • Look for section called LAN. Confirm that the IP address is same as above. In my case it was 192.168.0.1. Note the subnet mask. It was 255.255.255.0
    • Next move to section called “Wireless”. Note down the following
      • WiFi SSID – this is the WiFi name that you use to connect
      • WiFi Security – For me it was WPA/WPA2
      • Channel – It it says auto you choose a number, say 4
      • WiFi Password – Same that you use during connect
  • SETTING UP SLAVE ROUTER – PART 1 <LAN>
    • Power it on and Reset the Slave router. For my Dlink, there was a small reset button that I had to keep pushing for some time. It is always a good idea to start from this resetting as we don’t know what it was used for earlier and the old settings might create problems
    • For this operation, disable WiFi on your laptop and use an ethernet cable to attach your laptop to the slave router.
    • Behind the slave router you will find default IP address and username/password details. For me it was 192.168.0.1 and Admin was username and password was empty.
    • Go to browser again and type http://<slave-router-ip. For me it was http://192.168.0.1. I logged in with the credentials.
    • We are not bothered about setting up Internet details on the slave router (only Main router will be used to connect to Internet service provider like ACT). So we will not enter anything in section like “Internet” or “WAN”. Just leave them to whatever details they have. If the router is forcing you to select something, just choose anything here it does not matter
    • Go to section called “LAN”. It could be also called as “Local Network” in some routers. Do the following
      • In IP address enter the next number after your MAIN router’s IP address. For me I entered 192.168.0.2 (My Main router’s IP address was 192.168.0.1.Actually the last number can be anything but what I am trying to do is name them in order like if 192.168.0.1 is MAIN then 2nd is 192.168.0.2 and I setup a third router also at my home where I set the IP Address of the router as 192.168.0.3. Your default IP address of Slave router does not matter.
      • Enter subnet mask same as what you saw in Main router subnet mask. For me it was 255.255.255.0
      • The moment you hit ‘Save’ or ‘Apply Changes’, it will seem to have stopped working. This is because now, your Slave router has moved to the new IP address that you gave (for me it was 192.168.0.2) and so you have to enter that in browser like http://192.168.0.2 and use the same credentials as before. Sometimes you might have to restart your PC (basically remove any cache in browser) for this to work.
      • Find for the DHCP and disable it. It will be mostly under LAN or ‘Local Network’. You have to select ‘Disable DHCP server’ or if there is a dropdown select “None” for DHCP
      • Find NAT and ensure that there are no entries. If it is not there, don’t worry about it. If there is a ‘Gateway’ instead, disable that. If not, fine
  • PHYSICAL CONNECTION
    • Now run an ethernet cable from one of the main router’s LAN port to a LAN port in slave router (LAN not WAN). I got a long bluerigger high quality ethernet cable and ran it through my data only pipe at home (try not to run it along with power cables). You can run it outside on the walls too. Refer the image below courtesy Amit Agarwal from labnol.org
    • At this point, you can test if the interet is working on your laptop connected to the slave router. It should work. Not only that both your routers should be accessible now using their IP addresses (my case 192.168.0.1 and 192.168.0.2)
  • SETTING UP SLAVE ROUTER – PART 2 <WiFi>
    • Login to your slave router using its IP address (that you gave. I gave 192.168.0.2).
    • Go to ‘Wireless’ section. If there is advanced option click it
    • You can decide to use this as a separate SSID (separate WiFi name) compared to your main router’s WiFi name
    • In my case I wanted them to give the same name. Advantage is that your devices will switch automatically from one router to another as you move around your house, like in a hotel or office. Disadvantage is that you won’t know which router you are connected to (Why do you want to know anyway?)
    • If you want to use same name like me that you have to do the following
      • In SSID give identical SSID that you noted down from Main router
      • In Security, select the same type of security as the main router setting. I put this as WPA/WPA2
      • Select the same channel as main router. For me I put it as 4
      • Select the same password also
      • Click ‘Save’ or ‘Apply Changes’ and you are done.
  • SETTING UP A THIRD ROUTER
    • In fact I setup a third router also (a good way to use the old routers as you move from service providers or upgrade to better ones)
    • For the third router, I used a tenda. I reset it and used its IP address written on back 192.168.1.1 and admin/admin as login. I changed its LAN to 192.168.0.3. For some reason it ran into issues when I did this and I had to reset and use it default WiFi to connect instead of LAN ethernet. I used an iPad this time (laptop was being used) and it went through this time. No idea why
    • After subnet and WiFi details it worked flawlessly.
    • My challenge was in running another ethernet from my main router to this bedroom too.

Overall this was good fun. Sometimes frustrating but as good computer engineers, you stick to it till the end, bear the snide comments from family members and their sarcastic looks when things don’t work, knowing that they still love you a lot and you should be through 🙂

P, NP, NP Complete, NP Hard – OMG

OK, so you want to learn about this no matter the price you have to pay 🙂
Then have some patience and read through the text. It could take some time to understand but it will happen. Let’s say this field is a marriage between classic mathematics and theoritical computer science.

What is it and Why is it requried?
While trying to find solutions for problems using algorithms (steps) we often encounter problems that are seemingly very difficult to solve.
We often end up racking our brain for some time to try and find out a simple solution. Now what if a solution might not exist and we spend our valuable time in attempting it. Why not spend that time instead to come up with an approximate solution, for example. So classifying problems might help us to know in which class our problem falls and how to go about it

Optimization Problem Vs Decision Problem
Before starting with various complexity classes let us first figure out what is an optimzation problem. Optimization problems are those where we try to maximize or minimize some value, say finding the shortest path in a graph for example. Contrast to this, Decision problems are those which have only one of the two possible answers – “yes” or “no”.
Simple decision problem: Given 10 numbers is there any number greater than 25
Another example: Given a graph, is there a cycle?

Now, let’s see few more definitions

Polynomial time:
Given an input n, polynomial time would be any polynomial based on n, like n2 or n3 or even n1000 etc. However n! , 2n are all non polynomial time. We can say any algorithm that runs in polynomial time is a tractable, simple or solvable problem.

CLASS P
All decision problems which have a solution working in polynomial time fall in this class Simple example: Sum of n numbers O(n) or sorting O(nlogn) or O(n2)

CLASS NP
These are actually superset of P. However unlike P they don’t have (as yet) solution in polynomial time. However if we give an instance of the input and say that for this input the decision problem returns “yes”, we can verify the same in polynomial time. Non Polynomial time solution and polynomial time verification. P is a subset because its solutions can also be verified in polynomial time and solution runs in polynomial time also.
Let’s explain with an example: If there are 100 houses and each house has to be painted in a different color compared to all their friend’s house, it is not an easy problem to solve. However, the verification is trivial. If I already paint them in different colors and ask you to check if the painting has been done as per the above constraints, it is rather easy to verify the same. Go one by one for each house, see its color, check that it does not match with the color of friend’s house. Done ! Polynomial time verification !!

Till now, we can quickly make out that P are ‘easy’ problems and NP or ‘not so easy’ problems since we do not have a solution that can work in reasonable time

One more definition before proceeding further

Polynomial time reduction:
We say that decision problem P reduces to decision problem Q in polynomial time if we can make a function f(x) to convert all inputs of P to Q such that if f(x) is given to Q and we get “yes” we will get “yes” if we give x to P. Basically what we are doing is converting one problem to another. It might seem funny to computer science graduates. Imagine if I were to tell that to sort n numbers we can actually convert it into a problem of graph theory and solve it. But that is what Polynomial reduction is and it is significant here.

CLASS NP-COMPLETE
How about the problems which are in NP and are the hardest to solve among them. Such problems are called NP-Complete.
So, if we arrange in order the problems based on how easy it is solve, from easiest to hardest, it would be P — NP — NP Complete.
We can also call the NP-Complete problems as “Hard” problems that are in NP. Mathematically if all problems ‘x’ in NP can reduce in polynomial time to another problem ‘y’ in NP, we call the problem ‘y’ as NP complete
Please note: All NP-Complete problems have to reduce to each other because of the above definition. Example: “TSP: Is there a solution not exceeding cost k”

Class NP-HARD
Now what is this. We already saw that ‘hard’ problems in NP are called NP-Complete. What about the problems that are not in NP or for that matter not even decision problems. So there is a class for them. If a problem is as hard as every other problem in NP (like NP-Complete problems) but need not be in NP (unlike NP Complete problems which have to be in NP), such problems are called NP-hard. Example: Every NP-Complete problem is also NP-hard. Optimization problem – “TSP: Find least cost” : This is optimization problem and hence not in NP
Decision Problem but not in NP: “Halting problem” – Given a program and its input, will the program halt? Even though it is a decision problem, it is not in NP because even the verification of its solution cannot be done in polynomial time

Finally
Please look at the figure below for a brief on what we have learned

np

  • You can see the ‘P’ problems as green dots as subset of NP. They are the easy ones with polynomial time solution available
  • The ‘NP’ can be seen as blue dots. They don’t have a known polynomial time solution but their solution is verifiable in polynomial time
  • The ‘NP-Complete’ happens to be red dots. They can reduce all NP problems to themselves and additionally they sit inside NP itself
  • The ‘NP-Hard’ are similar that they can reduce all NP-Complete (thereby NP) to themselves but they don’t have to be part of NP
  • Additional Information
    • Though everyone is sure that P is a subset of NP, they don’t know if P=NP or P != NP. That is a million dollar prize question in clay university of mathematics. Since you are now armed with this learning why not attempt to crack the question and become a millionaire 🙂

My Tech BEAST – The Dell Inspiron 5548

Dell has been a faithful brand, serving us with 10+ Years between our two laptops. The first was a Inspiron 1525 with Core 2 Duo + 2 GB RAM (2009) and the next was a sexier Inspiron N4010 Core i3 + 4 GB RAM (2011). I am using the 1525 and was feeling it aging gracefully. My daughter and brother-in-law seem to have taken a liking to it and I was wondering if I should get a new laptop.

In comes Inspiron again

After being such a loyal Inspiron guy, no other laptop (other than the new Mac Book) could pull me towards it. Only the Mac will restrict me from all my extra curricular endeavors.

On the lookout for a laptop I wanted to get the best config. Let’s see where I am

Processor: Core i7Broadwell – 2.7 GHz (upto 3 GHz)

RAM: 16 GB DDR3 1600MHz

Display: Touch, Full HD, IPS, 15.6 inches

Graphics: AMD Radeon with 4 GB DDR3 Cache

Hard Disk: 1 TB, Hybrid (8 GB Cache)

Keyboard: Backlit

Rest: HD webcam, Bluetooth 4, Latest WiFi, USB 3.0 and stuff

Looking forward to meeting and having a long time relationship with this beast. The model was not available locally at all (no 16 GB version – only 8 GB possible). Dell had only one model 87000 upwards here. Thanks to my colleagues who travel to US this month, I am getting my hand on one of this. Two more have bought this laptop on my recommendation. Here is hoping that they get to use it to its full potential 🙂

Cost (bought in US): 56000