Tech Support Guy banner
Status
Not open for further replies.

Trying to understand routers vs switch and subnet mask.

906 views 3 replies 2 participants last post by  zx10guy 
#1 ·
I know routers give out out IP addresses ,forward the packets and can block the packets . Well a switch just forward the packets. My questions is how does one router know how to talk to other router? I read that the routing table control this and how it is hooked up . But I'm confused here.

What is subnet mask? Is subnet mask just a way of having other networks? Having two or move routers with same IP address of the connecting computer will lead to major problems ? Only way to have the same IP address on the connecting computers is to use other subnet mask?
 
#2 ·
Not all routers are setup to act as a DHCP server to give out IP addresses. And some layer 2 switches have a DHCP server to give out IP addresses.

A switch actually forwards frames not packets. This is a common mistake in terminology which even seasoned network professionals make. It's common enough where when someone talks about packets and switches, its already an implied reference to frames.

A router is a layer 3 device which forwards packets on to another destination when it receives a packet to process. How the router knows how to forward a packet is through its route table. The route table is either self configured through known IP addresses from local interfaces on the router, through manual configuration called static routes in the router's configuration, or through learning of routes with what's called dynamic routing protocols (RIP, OSPF, EIGRP, and BGP).

In the first scenario where the networks are known through the local interfaces, this is what the route table would look like when we have a simple two interface router where Int1 has an IP of 192.168.0.1 and Int2 has an IP of 172.16.0.1. So the router knows that if it receives a packet from a host on the 192.168.0.0 network destined for a host with an IP of 172.16.0.10 on Int1. The router knows that the packet needs to be forwarded to Int2 as it has an interface on the 172.16.0.0 network. The same thing would happen in the reverse direction. But if a packet originating on the 192.168.0.x network has a destination of 10.0.0.10 received on Int1, the router will not know where to send the packet and drops it as there is no entry in the route table telling it where to forward it.

Now take the above scenario and add in a manual configuration of routes through static routes. The network admin puts in a statement that the 10.0.0.0 is reachable by a gateway (router) at the IP address of 172.16.0.254. So now this router knows to forward the packet which it dropped previously due to no route information to the router on 172.16.0.254 which will then know how to forward the packet.

With a small simple routed network, doing static routes isn't too cumbersome But when you have a large network or something on that operates on the Internet, having someone (or a team of people) having to constantly manage/update route tables on routers with static entries is not only extremely cumbersome, it probably isn't even possible. Bring in the last scenario....routing protocols. Routing protocols allow routers to share route table information. So with the example I've been using, the router we've been focusing on will now know where to send the 10.0.0.10 packet if this router is exchanging route table information with the router at 172.16.0.254; where it will know that the router at 172.16.0.254 knows how to route the packet destined for 10.0.0.10. Routers have to be configured to participate in the various protocols. They will not just exchange route table information on their own. With the various routing protocols, they specialize in the ability to do things like adjust for links/interfaces along the routed path which fail out and run algorithms to map out the optimal path the packet should travel based on things like network congestion or speed of a particular interface. So with routing protocols you get network performance and redundancy due to the ability for the routers to make decisions on where to send a particular packet and you get better management of route tables along with scaleability.

A subnet mask is a way to do bit math by a particular device to figure out if a particular IP address is on the local network or is outside of the local network which would require a layer 3 device/router to move the network packet. You cannot have two devices with the same IP address regardless of what subnet mask is used if there is an operating network path between the two devices. You can use NAT to preserve IP addresses already assigned where they overlap. The caveat is the two overlapping locations will need to be segregated by at least a layer 3 device.
 
#3 ·
This is what I'm confused about. I'm not fully understanding function of how a router talks to other routers , understanding the routing table and subnet mask.

That simply this for home use and you can tell me what I'm not understanding.That say there are three computers IP address 192.168.0.2 ,192.168.0.3 , 192.168.0.4 and the IP address of the router or also know as gateway address of the router is 192.168.0.1.The router must know the gateway address of the ISP . So the router will forward it to the gateway address of the ISP.


Now bit more complex . Say there is three computers down stars IP address 192.168.0.2 ,192.168.0.3 , 192.168.0.4 and the IP address of the router 192.168.0.1. Well up stars ( three more computers ) IP address of 192.168.1.2 ,192.168.1.3, 192.168.1.4 and the IP address of the second router 192.168.1.1. So the second router must know the IP address of the first router and the first router must know the IP address of the ISP gateway to send data out. Well incoming data the first router must know the IP address of the second router.

This is what I thought how it works.Not sure how subnet mask ties in with this. I thought subnet mask was just telling router the data does not belong on its network but other network.So the first router would say no its not on my connecting computes but on the second router. And also you cannot have two computers using the same IP address but with subnet mask you can.That how I thought how it worked.
 
Status
Not open for further replies.
You have insufficient privileges to reply here.
Top