-
Notifications
You must be signed in to change notification settings - Fork 91
/
6. Routing
111 lines (89 loc) · 8.05 KB
/
6. Routing
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
* Basic Routing Concepts
-------------------------
-> Router - A network device that forwards traffic depending on the destination address of that traffic, it has to be connected to atleast two network interfaces to complete the job;
-> Basic Routing
1. Router receives a data packet;
2. Examines rthe destination IP address;
3. Looks up IP destination network in the routing table;
4. Forwards traffic to the destination;
-> Example - 2 Networks
-----------------------------
1. Consider a router connected two networks, it has an interface on each network;
- Network A - Address Space - 192.168.1.0/24 - router network interface - 192.168.1.1;
- Network B - Address Space - 10.0.0.0/24 - router network interface - 10.0.0.254;
- A computer on network a with IP address - 192.168.1.100 sends a packet to the address on network B - 10.0.0.10;
2. The computer in Network A knows that 10.0.0.10 is not on its local subnet;
So it sends the packet to the MAC address of its gateway router;
3. The routers interface at Network A receives the packet, since the destination MAC address belongs to it.
4. The router then trips away the Data Link Layer encapsulation, leaving the network layer content (IP datagram);
5. The router now examines and inspects the IP datagram header for the destination IP field - it finds the destination IP of 10.0.0.10;
6. The router looks at its routing table and sees that Network B is the correct network for the destination IP;
7. It also sees this network is just one hop away, since it is directly connected, the router even has the MAC address for this IP in its ARP table;
8. The router now needs to form a new packet to forward it along to network B.
9. It takes all the data from the IP datagram and duplicates it, decrements the TTl field by 1 and calculates a new checksum;
10. The router then encapsulates the new IP datagram inside a new Ethernet frame - by setting its own MAC address of the interface on network B as the source MAc address and since it has the MAC address of 10.0.0.10 in its ARP table it sets it as the destination MAC address;
11. Lastly, the packet is sent out of its network interface on Network B and the data gets delivered to the node at 10.0.0.10;
-> Example - 3 Networks
---------------------------
1. - Network A - Address Space - 192.168.1.0/24 - router network interface - 192.168.1.1;
- Network B - Address Space - 10.0.0.0/24 - router network interface - 10.0.0.254;
- Network C - Address Space - 172.16.1.0/23 - router network inteface - 172.16.11;
N/w A - R1 - N/w B - R2 - N/W c;
2. Computer at 192.168.1.100 needs to send a packet to 172.16.1.100;
Sends it through N/w B -> A -> B -> C;
* In order to protect against breakages, core Internet routers are connected in a Mesh, there might be many different paths for a packet to take;
----------------------------------------------------------------------------------------------------------------------------------------
* Routing Tables
----------------------
-> Most basic and common - 4 columns :
a. Destination Address - a row for each network the router knows; - Network Ip and net Mack - 192.168.1.1 | 255.255.255.0 -> CIDR - 192.168.1.1/24
Catchall entry - that matches any IP address that does not have an explicit network listing;
b. Next Hop - The IP address of the next router that should receive data intended for the destination;
c. Total Hops - Keeps track of how far away the destination currently is;
d. Interface - To know which interface matches the destination network;
* Core routers on the Internet can have million entries;
----------------------------------------------------------------------------------------------------------------------------------------
* Interior Gateway Protocols
-----------------------------
-> Routing Protocols - Special protocols that routers use to communicate with each other to share information;
-> Routing Protocols fall into 2 main categories
a. Interior Gateway Protocols - split into 2 - Link state routing protocols, and distance-vector protocols;
b. Exterior Gateway Protocols;
-> Interior Gateway Protocols - Used by routers to share information within a single autonomous system;
-> Autonomous System - A collection of networks that all fall under the control of a single network operator;
1. Distance-Vector Protocol - older standard, any router employing distance vector protocol - takes the routing table and sends the list/vector to every neighbouring router;, the routers are updates and the optimum path is choosen to transfer the tranfic;
- The routers don't know must about the state of the autonomous system, hence can be slow to adapt to changes in the network far from it;
2. Link state protocol - Each router advertises the state of the link to the network interfaces; Requires more memory to hold all the data and more processing power - calculate using sophisticated algorithms;
---------------------------------------------------------------------------------------------------------------------------------------
* Exterior Gateway Protocols
-----------------------------
- It is used between routers representing the edges of an autonomous system;
- Internet Assigned Numbers Authority (IANA) - A non-profit organization that helps manage IP address allocation and ASN (Autonomous System Number) allocation;
- ASN - Numbers assigned to individual autonoumous systems - 32 bit numbers - single decimal number;
- It never need to change in order to represent networks or hosts, only core internet routing tables need to be updated;
- It is hardly referred to by humans; (Example - AS19604 = IBM);
-----------------------------
* Interior Gateway Protocols
-----------------------------
The most common distance vector protocols are
1. RIP, or Routing Information Protocol - employs the hop count as a routing metric.
2. EIGRP, or Enhanced Interior Gateway Routing Protocol - used on a computer network for automating routing decisions and configuration.
The most common link state protocol is
1. OSPF, or Open Shortest Path First - Is a routing protocol for Internet Protocol (IP) networks. It uses a link state routing (LSR) algorithm and falls into the group of interior gateway protocols (IGPs), operating within a single autonomous system (AS).
------------------------------
* Exterior Gateway Protocols
-----------------------------
In terms of exterior gateway protocols, there is only one in use today. The entire Internet needs to agree on how to exchange this sort of information, so a single standard has emerged. This standard is known as BGP, or Border Gateway Protocol.
BGP - Standardized exterior gateway protocol designed to exchange routing and reachability information among autonomous systems (AS) on the Internet.The Border Gateway Protocol makes routing decisions based on paths, network policies, or rule-sets configured by a network administrator and is involved in making core routing decisions.
----------------------------------------------------------------------------------------------------------------------------------------
* Non-Routable Address Space
-----------------------------
-> RFC - Request for Comments;
-> RFC 1918 - outlined a number of networks that would be defined as non-routable address space;
-> Non-Routable Address Space - range of IPs set aside for use by anyone that cannot be routed to - They allows nodes on such a network to communicate with each other but no gateway router will attempt to forward traffic to this type of network;
-> NAT - Network Address Translation - Allows non-routable address space to communicate with other devices on the Internet;
-> RFC 1918 defined 3 ranges of IP addresses that will never be routed anywhere by co-routers - means that they belong to no one and anybody can use them;
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
* These ranges are free for anyone to use for their internal networks - interior gateway protocols will route these address spaces within an autonomous system by exterior gateway protocols will not;