Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
10-10-2013, 02:14 AM
|
#1
|
Member
Registered: Apr 2011
Posts: 109
Rep:
|
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?
|
|
|
10-10-2013, 04:51 AM
|
#2
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,649
|
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
|
|
|
10-10-2013, 05:00 AM
|
#3
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
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 ?
|
|
|
10-10-2013, 02:48 PM
|
#4
|
Member
Registered: Apr 2011
Posts: 109
Original Poster
Rep:
|
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.
|
|
|
10-10-2013, 05:57 PM
|
#5
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
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
|
|
|
10-11-2013, 12:43 AM
|
#6
|
Member
Registered: Apr 2011
Posts: 109
Original Poster
Rep:
|
Quote:
Originally Posted by kbp
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.
|
|
|
10-11-2013, 02:26 AM
|
#7
|
Senior Member
Registered: Apr 2010
Posts: 2,285
|
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.

|
|
|
10-11-2013, 02:58 AM
|
#8
|
Member
Registered: Apr 2011
Posts: 109
Original Poster
Rep:
|
Quote:
Originally Posted by JJJCR
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.
|
|
|
10-11-2013, 03:17 AM
|
#9
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 23,649
|
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.
|
|
|
10-11-2013, 03:55 AM
|
#10
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
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
|
|
|
10-11-2013, 09:09 AM
|
#11
|
Member
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587
Rep:
|
Quote:
Originally Posted by nec207
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.
|
|
|
10-11-2013, 09:13 AM
|
#12
|
Member
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587
Rep:
|
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.
|
|
|
10-11-2013, 04:37 PM
|
#13
|
Member
Registered: Apr 2011
Posts: 109
Original Poster
Rep:
|
Quote:
Originally Posted by pan64
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 04:40 PM.
|
|
|
10-11-2013, 08:12 PM
|
#14
|
Senior Member
Registered: Apr 2010
Posts: 2,285
|
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.
|
|
|
10-11-2013, 08:24 PM
|
#15
|
Senior Member
Registered: Aug 2009
Posts: 3,790
|
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.
|
All times are GMT -5. The time now is 04:29 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|