Professional Documents
Culture Documents
Two or more devices connected for the purpose of sharing data can form a network. Putting together a network is often more complicated than simply plugging cable into a hub. A LAN may need to cover more distance than its media can handle effectively. Or the number of stations may be too great for efficient delivery or management of the network, and the network may need to be subdivided. Networking and internetworking devices are divided into four categories: repeaters, bridges, routers, and gateways as shown in figure below: Connecting Devices
Networking Devices
Internetworking Devices
Repeaters
Bridges
Routers
Gateways
1- Repeaters:
A repeater (or regenerator) is an electronic device that operates on only the physical layer of the OSI model as shown in figure below:
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
Repeater
7 6 5 4 3 2
7 6 5 4 3 2
Physical
Signals that carry information within a network can travel a fixed distance before attenuation endangers the integrity of the data. A repeater installed on a link receives the signal before it becomes too weak or corrupted, regenerates the original bit pattern, and puts the refreshed copy back onto the link. A repeater allows us to extend only the physical length of a network. The repeater does not change the functionality of the network in any way. It is tempting to compare a repeater to an amplifier, but the comparison is inaccurate. An amplifier can not discriminate between the intended signal and noise; it amplifies equally every thing fed into it. A repeater does not amplify the signal; it regenerates it. When it receives a weakened or corrupted signal, it creates a copy bit for bit, at the original strength.
2- Bridges:
Bridges operate in both the physical and the data link layers of the OSI model as shown in following figure: 96 Dr.Eng. Ziyad Al-Ta'i
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
Bridge
7 6 5 4 3 2
7 6 5 4 3 2
Physical 1
Bridges can divide a large network into smaller segments as shown in figure below:
B
Bridge
Unlike repeaters, however, bridges contain logic that allows them to keep the traffic for each segment separate. For example, figure below shows two segments joined by a bridge. 97 Dr.Eng. Ziyad Al-Ta'i
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
A to D
Bridge
A packet from station A addressed to station D arrives at the bridge. Station A is on the segment as station D; therefore, the packet is blocked from crossing into the lower segment. In figure below, a packet generated by station A is intended for station G. The bridge allows the packet to cross and relays it to the entire lower segment, where it is received by station G.
A to G
Bridge
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
Types of Bridges:
To select between segments, a bridge must have a look up table that contains the physical address of every station connected to it. The table indicates to which segment each station belongs.
a- Simple Bridge:
Simple bridges are the most primitive and least expensive type of bridge. A simple bridge links two segments and contains a table that lists the address of all the stations included in each of them. What makes it primitive is that these addresses must be entered manually. Before a simple bridge can be used, an operator must sit down and enter the addresses of every station. Whenever a new station is added, the table must be modified. If a station is removed, the newly invalid address must be deleted.
b- Multiport Bridge:
A multiport bridge can be used to connect more than two LANs, as shown in figure below:
LAN1
LAN3
Bridge
LAN2
In this figure, the bridge has three tables, each one holding the physical addresses of stations reachable through the corresponding port.
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
c- Transparent Bridge:
A transparent, or learning, bridge builds its table of station addresses on its own as it performs its bridge functions. When the transparent bridge is first installed, its table is empty. As it encounters each packet, it looks at both the destination and the source addresses. It checks the destination to decide where to send the packet. If it does not yet recognize the destination address, it relays the packet to all of the stations on both segments. It uses the source address to build its table. As it reads the source address, it notes which side the packet came from and associates that address with the segment to which it belong.
3- Routers:
Repeaters and bridges are simple hardware devices capable of executing specific tasks. Routers are more sophisticated. They have access to network layer addresses and contain software that enables them to determine which of several possible paths between those addresses is the best for a particular transmission. Routers operate in the physical, data link, and network layers of the OSI model as shown in figure below:
net wor k Router net wor k
7 6 5 4 3 2 1
7 6 5 4 3 2 1
Routers act like stations on a network. But unlike most stations, which are members of only one network, routers have addresses on, and links to, two or more networks at the same time. In their 100 Dr.Eng. Ziyad Al-Ta'i
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
simplest function, they receive packets from one connected network and pass them to a second connected network.
4- Gateways:
Gateways operate in all seven layers of the OSI model as shown in figure below:
net wor k Gateway net wor k
7 6 5 4 3 2 1
Application Presentation
Application Presentation
7 6 5 4 3 2 1
A gateway is a protocol converter. A router by itself transfers, accepts, and relays packets only across networks using similar protocols. A gateway, on the other hand, can accept a packet formatted for one protocol and convert it to a packet formatted for another protocol before forwarding it. A gateway is generally software installed within a router. The gateway understands the protocols used by each network linked into the router and is therefore able to transfer from one to another. Other Devices:
1- Multiprotocol Routers:
At the network layer, a router by default is a single protocol device. In other words, if two LANs are to be connected through a router, they should use the same protocol at the network layer. However, multiprotocol routers have been designed to route packets belonging to two or more protocols. For example, two 101 Dr.Eng. Ziyad Al-Ta'i
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
protocol routers can handle packets belonging to either of the two protocols, as shown in figure below: IP table
Router
IP table
IPX table
Router
Multiprotocol router
(The router passes only packets using IP or IPX, other packets are discarded)
2- Brouters:
A brouter (bridge/router) is a single protocol or multiprotocol router that sometimes acts as a router and sometimes as a bridge. When a single protocol or multiprotocol brouter receives a packet belonging to one of the protocols for which it is designed, it routes the packet based on the network layer address; otherwise, it acts as a bridge and passes the packet using the data link layer address, as shown in figure below:
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
IP table
Brouter
IP table
IPX table
Brouter
Multiprotocol brouter
(The brouter routes packets using IP or IPX, other packets are passed based on physical address)
3- Switches:
A switch is a device that provides bridging functionality with greater efficiency. A switch may act as a multiport bridge to connect devices or segments in a LAN. The switch normally has a buffer for each link (network) to which is connected. When it receives a packet, it stores the packet in the going link. If the outgoing link is free, the switch sends the packet to that particular link. Switches are made based on two different strategies (called fabrics): store-and-forward and cut-through. A store-and-forward switch stores the packet in the input buffer until the whole packet has arrived. A cut-through switch, on the other hand, forwards the packets to the output buffer as soon as the destination address is received. The following figure shows the concept of a switch:
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
Control unit
Switching table
Buffers
2 Frame in
5 Frame out
A packet arrives at port 2 and is stored in the buffer. The CPU and the control unit, using the information in the packet, consult the switching table to find the output port. The packet is then sent to port 5 for transmission. A new generation of switches that are a combination of a router and a bridge has recently appeared on the market. These routing switches use the network layer destination address to find the output link to which the packet should be forwarded. The process is faster because the network layer software in a regular router finds only the network address of the next station and then passes this information to the data link layer software to find the output link.
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
Routing
The job of router is to forward packets through a set of networks. But, which path does it choose? The answer is the shortest. In routing the term shortest can mean the combination of many factors including shortest, cheapest, fastest, and most reliable. This is called least cost routing. Routing is classified as:
2- Adaptive Routing:
Other routing protocols employ a technique called adaptive routing, by which a router may select a new route for each packet (even packets belonging to the same transmission) in response to changes in condition and topology of the network.
Routing Algorithms:
Many algorithms are used to calculate shortest path between two routers, one of them is distance vector routing.
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
Net 14
Net 55
A Net 78
Net 92
Net 23 E Net 08 D
Net 66
In this example, the clouds represent LANs. The number inside each cloud is that LAN's network ID. The LANs are connected by routers represented by the boxes labeled A, B, C, D, E, and F. Distance vector routing simplifies the routing process by assuming a cost of one unit for every link; therefore the cost is based on hop count. The following figure shows the first step in the algorithm:
I periodically send my knowledge about the whole network to A,C
Net 14
Net 55
A Net 78
Net 92
Net 23 E
I periodically send my knowledge about the whole network to A,D
Net 66 Net 08 D
I periodically send my knowledge about the whole network to C,E
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
A router sends its knowledge to its neighbors. The neighbors add this knowledge to their own knowledge and send the whole table to their own neighbors. In this way, the first router gets its own information back plus new information about its neighbor's other neighbors. Each of these neighbors adds its knowledge and sends the updated table on to its own neighbors and so on. Eventually, every router knows about every other router in the internetwork. Creating Routing Table: At start up, a router's knowledge of the internetwork is sparse. All it knows is that it is connected to some number of LANs. Because a router is a station on each of those LANs, it also knows the ID of each station. This information is enough for it to construct its original routing table as shown in table below: Network ID .. .. .. .. Cost . .. .. .. Next Hop . . . .
A routing table has columns for at least three types of information: the network ID, the cost, and the ID of the next router (next hop). The network ID is the final destination of the packet. The cost is the number of hops a packet must make to get there. And the next router is the router to which a packet must be delivered on its way to a particular destination. The table tells a router that it costs x to reach network y via router z. The original routing tables for our sample internetwork are shown in figure below:
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i 14 1 55 1 14 1 23 1 78 1
Net 14
78 1 92 1
Net 55
55 1 66 1
A Net 78
Net 92
Net 23
08 1 23 1
23 1 66 1
Net 66
Net 08
At this point, the third column is empty because the only destination networks identified are those attached to the current router. No multiple-hop destinations and therefore no next routers have been identified. These basic tables are sent out to neighbors as shown at figure above.
14 1 55 1
One hop
14 2 B 55 2 B
Received from B
after adjustment
The combined table may contain duplicate data for some network destination. Router A therefore finds and purges any duplications and keep whichever version shows the lowest cost. 108 Dr.Eng. Ziyad Al-Ta'i
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
For example, as figure above shows, router A can send a packet to network 14 in two ways. The first, which uses no next router, costs one hop. The second, via router B, requires two hops ( A to B, then B to 14 ). The first option has the lower cost; it is kept and the second entry is dropped. This selection process is the reason for the cost column: the cost allows the router to differentiate between various routes to the same destination. This process continues for all routers. Every router receives information from neighbors and updates its routing table as explained before with following updating algorithm:
Updating Algorithm:
The updating algorithm requires that the router first add one hop to the hop count field for each advertised route. The router should then apply the following rules to each advertised route: 1- If the advertised destination is not in the routing table, the router should add the advertised information to the table. 2- If the advertised destination is in the routing table, a- If the next hop field is the same, the router should replace the entry in the table with the advertised one. Note that even if the advertised hop count is larger, the advertised entry should replace the entry in the table because the new information invalidates the old. b- If the next hop field is not the same, i- If the advertised hop count is smaller than the one in the table, the router should replace the entry in the table with the new one. ii- If the advertised hop count is not smaller (same or larger), the router should do nothing. If there are no more changes, the final table may look like those in following figure:
Lecture Notes of Computer Communications and Networks Prepared by Dr.Eng. Ziyad Tariq Al-Ta'i
08 14 23 55 66 78 92
2 1 1 2 3 1 2
08 14 23 55 66 78 92
3 1 2 1 2 2 3
A A C A
B
B E F
A
Net 14
08 14 23 55 66 78 92
Net 78
3 2 2 3 4 1 2
A A A A A F
F Net 92
Net 55
08 14 23 55 66 78 92
C
2 2 3 1 1 3 4
D B D
B B
Net 66
D Net 23 Net 08 E
08 14 23 55 66 78 92
1 2 1 3 2 2 3
A A D A A
08 14 23 55 66 78 92
1 3 2 2 1 3 4
E E C E E