Role of Routers in Networking

If you want to send some data within your network you can simply broadcast it to your whole network and find the MAC address of the required host to whom you need to send data. But what if the required host is not within your network? well, that’s where routers come into play.
In simple words router in a box that is designed to connect network ids.Routers filter and forward requests on the base of the IP address. In order to have a router function, it has to have at least two connections.
Now suppose a packet comes from 232.25.201.190 and wants to go to 192.168.15.27. Now how does it knows how to get there. Well, it’s done because of the routing table it has all the information needed and knows where to send the packet because it always updates itself.
Gateway all zero tells you are directly connected to that network. and Address tells where to send the packet. The good thing is this migration is done automatically. The problem is there are not only two network id’s there are a lot of them and we need a mechanism to manage all.
So we have a building thing in every router a default route So we an upstream router provided by our ISP and that IP assigns an IP address to every router connected.
So in our routing table, we had a default route that has the IP address of the upstream router. If we didn’t any IP simply goes to the upstream router. So now if you will look at the updated table it will look like this.
Now in industrial cases, your router can have three connections two connections from ISP and a third one where it’s going towards your network. So, in this case, your routing table will mange three IPs.
So, in this case, you will have two default routes because you have two ISP and you can access the internet using both. So what we do is set one ISP as default every request to go towards that one and if that Internet Service Provider will go down we will send it to others one. So a new option is added in a routing table called metric will tell that it has more options.
The lower the metric value the more preferable options that will be for the router. Always remember routers don’t care from where the packet is coming from it only cares where it’s going.
There are two routes methods that are used to create route tables one is a static route where you manually write the IPs that would not change and this is most suitable for small networks. The other one is a dynamic route in this process every router is putting some smarts inside them so that they can write their own routing tables. In the Rip method, Every router shares his routing table with its neighbor and they fix their routes wrt which is faster.
Then we have a link-state  in which every router sends the hello advertisement to every router and if they detect any difference it will tell every other router that I have this change if you want to do that too.
RIP:  is a distance-vector protocol that uses hop count to determine routes.RIP 1 can be only used with classful addressing while RIP 2 supports CIDR.RIP maximum hop count is 15.
OSPF: Then we have OSPF which is basically link-state they upgraded and added a new method in which every router who got any changes with sending it to its Neighbor. Which makes its coverage faster.
BGP ( Border Gateway Protocol ):  is advanced then OSPF. It is primary protocol of the internet. It breaks down the internet into 20000 autonomous systems (AS is groups of router networks under the control of a single entity. eg Big University ). Now BGP is good at routing data between AS systems by knowing the AS Number eg AS 23. 

Understanding Ports

Every TCP packet has two port numbers one is the source who is sending and the other is a destination where it’s going. Ports number also tell to which application the packet has to go. eg from 80 port number is used for web browsers and 21 is for FTP etc. All well know port numbers are reserved for certain applications and their range is 0-1023.
On the other hand, the client generates ephemeral port numbers range from 1024-65535 and they have generated automatically. every time when a client needs a source port number its generated and given to that client.

NAT ( Network Address Translation )

Every router has a NAT in it by default turned on and ready to work. Now on our network, we use the private IP address which we can not send it to the internet. So the purpose of NAT is to change private IP to our public IP that is assigned to us so that we can access the internet. And when the request comes back it reverses the whole process.
So this thing works for normal PCs but what if we had web servers well then for that scenario we have different versions of NAT eg static NAT where we forward all specific incoming traffic to one fixed static IP address which is one server in our case eg server A. Another way to do this is with dynamic NAT in this case we have to IPs in our router so if from our four servers one of them wants to send something we give one IP to that and if others want to go we give it to other. The problem with this method is we have fixed number IPs only.

Port Forwarding

Normally when you talk to someone outside of your network. Let’s say your browser sents a request to a server and when that request comes back your router sees that you initiated that request it allows that connection.
But when every someone from outside tries to talk to you without your permission your browser will block that request. So to allow such connections we do port forwarding and we have thee things which help us do this task. Port Forwarding, Port Range Triggering, DMZ.
For example, you have a security camera and you want to access it from anywhere in the world now what you will do is go to your router and do port forwarding on a random port eg 8181 with the IP address of your camera. Now once you have done this now you will be able to access that camera from anywhere in the world by typing IP and post.
In Range Forwarding, you simply give a range of ports eg from 8181 to 8189 this is mostly done when you are setting up a gaming server.

Port Triggering

This process is a type of port forwarding but its done for a certain reason. For example, you have an FTP server and we want to download some files Now the unique things about FTP is it has two port 20,21.
21 is used for sending data to the server and 20 for receiving. when we send a request to FTP using post 21 it will respond back on port 20 our router will say that the client has sent a request on port 21 which router will allow only and will block port 20 as its coming from outward.
So to solve this issue we simply enable port triggering on our router and it will allow traffic from both 20 and 20.

DMZ ( Demilitarized Zone )

this option enables all kinds of traffic from the internet to your network. you simply enable it in your router and your allowed IP will be open to the whole internet which is a very bad practice as security purpose. You should do only for testing purposed of a temp host. Make sure when you enable DMZ you are following all the security practices.

Router Settings:

Almost every router has basic settings which are almost the same with some differences. The first thing you should do when you buy a router is to change the default username and password. You will get a manual with your rother which will help you learn all the settings about the router eg MAC filter, firmware update, etc.

Normal Router (SOHO) vs Enterprise Router Difference

The normal router you use at home is a SoHo router and It has a builtin router in it. It also acts as a switch and it has its own DHCP setup in it. Moreover, you can access it using a web interface without any issue.
But in case of Enterprise Router, they only work for one single purpose and if you need to add a switch with it you have to add another hardware for that purpose and you just can not use them on web interfaces you have cmd interface where you do all the settings.

Leave a comment

Your email address will not be published. Required fields are marked *