LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-10-2013, 01:14 AM   #1
nec207
Member
 
Registered: Apr 2011
Posts: 109

Rep: Reputation: 6
Question Trying to understand how routers know how to talk to other router?


Trying to understand how routers know how to talk to other router?

Can some one explain this better. This is really hard to understand.

Quote:
Quote 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. Quote
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 network? 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?
 
Old 10-10-2013, 03:51 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,910

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
the IP address consists of 4 bytes, 4 times 8 bits. The mask, the subnet mask will mask out higher bits, and will allow only lower bits. It means FF.FF.FF.00
will lock out 3 bytes and allow only the fourth to be changed. The subnet itself is defined by the ip address and the mask. the locked bits must remain the same (192.168.0 or 172.16.0 ). So every ip will belong to a subnet defined by the ip and the mask. There should be a router in the subnet to reach other ip addresses. The routing table will tell the host how to reach hosts outside the subnet, usually it will direct the request to the router. Router should now the next step, will redirect the request to the next router (as long as the last router will know the ip and will access that given host because it is available on that local subnet.

I know this is not a scientifical but a highly simplified explanation, but I hope it helps.
https://en.wikipedia.org/wiki/Subnetwork
 
Old 10-10-2013, 04:00 AM   #3
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Hmm .. you have a couple of questions there, I'll try for some short answers and maybe we can expand on them later:

- routers know how to talk to other networks they are not attached to because they are told by us which router to forward traffic the to or because they learn it from other routers automatically
- a subnet mask defines which part of an IP address is the host and which part is the network that the host is attached to

Are you interested in the us telling them part or the automatic part ?
 
Old 10-10-2013, 01:48 PM   #4
nec207
Member
 
Registered: Apr 2011
Posts: 109

Original Poster
Rep: Reputation: 6
Quote:
The routing table will tell the host how to reach hosts outside the subne
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.
 
Old 10-10-2013, 04:57 PM   #5
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
So I think your network looks like this (correct me if I'm wrong):

Code:
[home_internet_router]
       |
[======192.168.0.0/24 network======]
 |       |      |           |
[pc1]  [pc2]  [pc3]  [upstairs_router]
                            |
              [======192.168.1.0/24 network======]
                 |           |          |
               [pc4]       [pc5]      [pc6]
I'm assuming you want to know how to make them all talk to each other, these following steps should achieve that:

- [upstairs_router] has it's external interface physically plugged into [home_internet_router]
- [upstairs_router] has it's external interface statically configured to 192.168.0.254 with the default gateway set to 192.168.0.1
- [home_internet_router] has a static route added: 192.168.1.0/24 via 192.168.0.254
 
Old 10-10-2013, 11:43 PM   #6
nec207
Member
 
Registered: Apr 2011
Posts: 109

Original Poster
Rep: Reputation: 6
Quote:
Originally Posted by kbp View Post
So I think your network looks like this (correct me if I'm wrong):

Code:
[home_internet_router]
       |
[======192.168.0.0/24 network======]
 |       |      |           |
[pc1]  [pc2]  [pc3]  [upstairs_router]
                            |
              [======192.168.1.0/24 network======]
                 |           |          |
               [pc4]       [pc5]      [pc6]
I'm assuming you want to know how to make them all talk to each other, these following steps should achieve that:

- [upstairs_router] has it's external interface physically plugged into [home_internet_router]
- [upstairs_router] has it's external interface statically configured to 192.168.0.254 with the default gateway set to 192.168.0.1
- [home_internet_router] has a static route added: 192.168.1.0/24 via 192.168.0.254

I was just making this up because it is easier to understand.
 
Old 10-11-2013, 01:26 AM   #7
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,157

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Quote:
What is subnet mask?
Check out this blog about subnet mask: http://quickbytesstuff.blogspot.sg/s...bel/Subnetting

A subnet mask, is used to determine the host IP Address and the network IP Address. But there is more to it, it's just a nutshell phrase.

Quote:
How a router works?
This quite a long story, but in a nutshell. Routers uses protocols and those protocols are the language of the routers that they use to talk to each other.

The internet will not be as popular as of today if not of the protocols. BGP (border gateway protocol) is one of the protocol used by routers on the internet.


Basic config for a network is:

Computer --> Switch --> Modem or Router --> ISP Connection --> Cloud connection or the internet

To get in depth on how this thing works, will be a lot of hard work. You can take a Cisco Cert and IMHO, as long as you do it by heart to study you will learn all this basic principle of networking.


 
Old 10-11-2013, 01:58 AM   #8
nec207
Member
 
Registered: Apr 2011
Posts: 109

Original Poster
Rep: Reputation: 6
Quote:
Originally Posted by JJJCR View Post
Check out this blog about subnet mask: http://quickbytesstuff.blogspot.sg/s...bel/Subnetting

A subnet mask, is used to determine the host IP Address and the network IP Address. But there is more to it, it's just a nutshell phrase.



This quite a long story, but in a nutshell. Routers uses protocols and those protocols are the language of the routers that they use to talk to each other.

The internet will not be as popular as of today if not of the protocols. BGP (border gateway protocol) is one of the protocol used by routers on the internet.


Basic config for a network is:

Computer --> Switch --> Modem or Router --> ISP Connection --> Cloud connection or the internet

To get in depth on how this thing works, will be a lot of hard work. You can take a Cisco Cert and IMHO, as long as you do it by heart to study you will learn all this basic principle of networking.



sorry that me rephrase it .The part I'm having hard time understanding is how routers talk to other routers and know how to forward the data.
 
Old 10-11-2013, 02:17 AM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,910

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
router does not talk to other routers that way, but they have a routing table (that should be configured before usage). The routing table will define always the route (next hop) to find any ip. local ips (belong to the current subnet) are directly available, packages sent to all the others will be redirected based on that routing table.
 
Old 10-11-2013, 02:55 AM   #10
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Quote:
how routers talk to other routers and know how to forward the data
Routers can distribute route updates between themselves if they run a routing protocol. There are two types of routing protocols - IGP's (running within an Autonomous System)) and EGP's (running between Autonomous Sysytems). On the Internet you will commonly find BGP (Border Gateway Protocol) whereas within corporate networks you'll find various IGP's such as OSPF and EIGRP.

These are only a few of the routing protocols available and they all use different mechanisms and architectures, you'll need to do some research to find the information for the specific routing protocol you're interested in. I haven't checked recently but Cisco had some of the best documentation of any network vendor, maybe start there.

good luck
 
Old 10-11-2013, 08:09 AM   #11
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Rep: Reputation: 72
Quote:
Originally Posted by nec207 View Post
sorry that me rephrase it .The part I'm having hard time understanding is how routers talk to other routers and know how to forward the data.
Standards. Router manufacturers 'implement' standards which were created by governing bodies (such as IETF). Think of it as something like 'some regulators created a language and if other people want to speak that language, they have to consult the documentation made by these regulators. These people would then be able to communicate with one another'.

Take IPv4 for example. RFC791 describes how IPv4 works. So, a new router manufacturer would consult this RFC to understand how they should implement IPv4. Another router manufacturer would consult the same RFC. Both would consult all other RFC's. This way, the routers made by both of them would be able to communicate with each other.

I hope this is the one you're looking for.
 
Old 10-11-2013, 08:13 AM   #12
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Rep: Reputation: 72
Or, are you thinking of something like, how a router would send data across to the other router? If so, then you should read on Layer 1 and Layer 2 of the OSI model.
 
Old 10-11-2013, 03:37 PM   #13
nec207
Member
 
Registered: Apr 2011
Posts: 109

Original Poster
Rep: Reputation: 6
Quote:
Originally Posted by pan64 View Post
router does not talk to other routers that way, but they have a routing table (that should be configured before usage). The routing table will define always the route (next hop) to find any ip. local ips (belong to the current subnet) are directly available, packages sent to all the others will be redirected based on that routing table.
That the confusion I'm having here. [QUOTE]I thought 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.[/QUOTE]


The first router A must know the IP address of the second router and gateway .Well the second router B must only know the IP address of the first router A. But from what I read it does not work that way.

Where routers don't work that way .

Routers have two addresses,

uplink for output leaving the subnet
Lan ports belonging to the router ( part of the subnet)


Where routers only know devices attached to it on the LAN , and any IP target address not part of the subnet will be past to output leaving WAN ( gateway address) So in other words router A would not see router B because it is not part of its subnet.


So for router A to see every thing and forward the data to all devices , must be on the same subnet and DHCP turn off on the router B so there no duplication of IP addresses or other subet. And router B used has switch.

I thought some how routers talk to each other by the routers IP address . But from what I understand that not how it works.The router only knows devices attached to it on the LAN and part of its subnet .If its on other subnet it past to gateway.So the router A would not see router B.

Last edited by nec207; 10-11-2013 at 03:40 PM.
 
Old 10-11-2013, 07:12 PM   #14
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 2,157

Rep: Reputation: 449Reputation: 449Reputation: 449Reputation: 449Reputation: 449
Quote:
Routers have two addresses,

uplink for output leaving the subnet
Lan ports belonging to the router ( part of the subnet)
IP Address used by routers on the Internet are called Public IP

IP Addresses used by the local LAN are called Private IP

In order for Private IP to go out to the external world, router will perform NAT/PAT translation.
 
Old 10-11-2013, 07:24 PM   #15
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Quote:
The first router A must know the IP address of the second router and gateway .Well the second router B must only know the IP address of the first router A. But from what I read it does not work that way.
It does work this way because the 192.168.1.0/24 network is a stub, it only has one egress point and that is Router B

Quote:
Where routers don't work that way .
Yes they do.

Quote:
Routers have two addresses,

uplink for output leaving the subnet
Lan ports belonging to the router ( part of the subnet)
Partially correct, the definition of a router is that it has at least 2 interfaces - when you say LAN ports I believe you're talking about a home internet router with a built in switch, a router does not have to include LAN ports.

Quote:
Where routers only know devices attached to it on the LAN , and any IP target address not part of the subnet will be past to output leaving WAN ( gateway address) So in other words router A would not see router B because it is not part of its subnet.
Routers don't know about devices, switches do. Routers only know about networks. RouterA would see traffic from RouterB if RouterB had an interface attached to the 192.168.0.0/24 network (from your example)

Quote:
So for router A to see every thing and forward the data to all devices , must be on the same subnet and DHCP turn off on the router B so there no duplication of IP addresses or other subet. And router B used has switch.
No, RouterA only needs to know how to get to the 192.168.1.0/24 network, you can achieve this by adding a static route as I mentioned in a previous reply:

Quote:
- [home_internet_router] has a static route added: 192.168.1.0/24 via 192.168.0.254
* replace home_internet_router with RouterA

Quote:
I thought some how routers talk to each other by the routers IP address . But from what I understand that not how it works.The router only knows devices attached to it on the LAN and part of its subnet .If its on other subnet it past to gateway.So the router A would not see router B.
They can be configured to do so with a routing protocol but this would be overkill in this instance as a static route would suffice. RouterA would see traffic forwarded from RouterB but without a route for 192.168.1.0/24 it would send replies to it's default gateway which would be on the Internet. As 192.168.x.x is a private network range it would be silently dropped by the Internet router.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Get a firewall/gateway in between a modem and router to reach the routers LAN. Oxagast Linux - Networking 1 08-15-2013 12:39 PM
Problems getting NIC to talk to my router Draylath Ubuntu 18 06-28-2007 04:45 PM
ADSL Routers Setup- Microsom Deskporte router 100 and Planet ADSL modem router mabonline Linux - Hardware 1 02-27-2004 05:36 PM
Linksys router won't talk to me. Travis86 Linux - Networking 10 12-17-2003 11:23 PM
Newbie needs to know how to talk to router logikos Linux - Networking 4 08-25-2002 10:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration