Computer Network Design lecture notes

how to design network architecture and how to design network for small business pdf free download
MarthaKelly Profile Pic
MarthaKelly,Mexico,Researcher
Published Date:12-07-2017
Your Website URL(Optional)
Comment
3 Network Design Before purchasing equipment or deciding on a hardware platform, you should have a clear idea of the nature of your communications problem. Most likely, you are reading this book because you need to connect computer networks together in order to share resources and ultimately reach the larger global Internet. The network design you choose to implement should fit the commu- nications problem you are trying to solve. Do you need to connect a remote site to an Internet connection in the center of your campus? Will your network likely grow to include several remote sites? Will most of your network com- ponents be installed in fixed locations, or will your network expand to include hundreds of roaming laptops and other devices? In this chapter, we will begin with a review of the networking concepts that define TCP/IP, the primary family of networking protocols currently used on the Internet. We will then see examples of how other people have built wire- less networks to solve their communication problems, including diagrams of the essential network structure. Finally, we will present several common methods for getting your information to flow efficiently through your network and on to the rest of the world. Networking 101 TCP/IP refers to the suite of protocols that allow conversations to happen on the global Internet. By understanding TCP/IP, you can build networks that will scale to virtually any size, and will ultimately become part of the global Internet. If you are already comfortable with the essentials of TCP/IP networking (in- cluding addressing, routing, switches, firewalls, and routers), you may want 2728 Chapter 3: Network Design to skip ahead to Designing the Physical Network on Page 51. We will now review the basics of Internet networking. Introduction Venice, Italy is a fantastic city to get lost in. The roads are mere foot paths that cross water in hundreds of places, and never go in a simple straight line. Postal carriers in Venice are some of the most highly trained in the world, specializing in delivery to only one or two of the six sestieri (districts) of Ven- ice. This is necessary due to the intricate layout of that ancient city. Many people find that knowing the location of the water and the sun is far more useful than trying to find a street name on a map. Figure 3.1: Another kind of network mask. Imagine a tourist who happens to find papier-mâché mask as a souvenir, and wants to have it shipped from the studio in S. Polo, Venezia to an office in Seattle, USA. This may sound like an ordinary (or even trivial) task, but let's look at what actually happens. The artist first packs the mask into a shipping box and addresses it to the office in Seattle, USA. They then hand this off to a postal employee, who at- taches some official forms and sends it to a central package processing hub for international destinations. After several days, the package clears Italian customs and finds its way onto a transatlantic flight, arriving at a central im- port processing location in the U.S. Once it clears through U.S. customs, the package is sent to the regional distribution point for the northwest U.S., then on to the Seattle postal processing center. The package eventually makes its way onto a delivery van which has a route that brings it to the proper ad- dress, on the proper street, in the proper neighborhood. A clerk at the office  Chapter 3: Network Design 29 accepts the package and puts it in the proper incoming mail box. Once it ar- rives, the package is retrieved and the mask itself is finally received. The clerk at the office in Seattle neither knows nor cares about how to get to the sestiere of S. Polo, Venezia. His job is simply to accept packages as they arrive, and deliver them to the proper person. Similarly, the postal carrier in Venice has no need to worry about how to get to the correct neighborhood in Seattle. His job is to pick up packages from his local neighborhood and for- ward them to the next closest hub in the delivery chain. Internet Router Router Image.jpg Image.jpg Part 1 of 10 Part 10 of 10 Computer Server Figure 3.2: Internet networking. Packets are forwarded between routers until they reach their ultimate destination. This is very similar to how Internet routing works. A message is split up into many individual packets, and are labeled with their source and destination. The computer then sends these packets to a router, which decides where to send them next. The router needs only to keep track of a handful of routes (for example, how to get to the local network, the best route to a few other local networks, and one route to a gateway to the rest of the Internet). This list of possible routes is called the routing table. As packets arrive at the router, the destination address is examined and compared against its internal routing table. If the router has no explicit route to the destination in question, it sends the packet to the closest match it can find, which is often its own Internet gateway (via the default route). And the next router does the same, and so forth, until the packet eventually arrives at its destination. Packages can only make their way through the international postal system be- cause we have established a standardized addressing scheme for packages. For example, the destination address must be written legibly on the front of the package, and include all critical information (such as the recipient's name, 30 Chapter 3: Network Design street address, city, country, and postal code). Without this information, pack- ages are either returned to the sender or are lost in the system. Packets can only flow through the global Internet because we have agreed on a common addressing scheme and protocol for forwarding packets. These standard communication protocols make it possible to exchange in- formation on a global scale. Cooperative communications Communication is only possible when the participants speak a common lan- guage. But once the communication becomes more complex than a simple conversation between two people, protocol becomes just as important as language. All of the people in an auditorium may speak English, but without a set of rules in place to establish who has the right to use the microphone, the communication of an individuals ideas to the entire room is nearly impossi- ble. Now imagine an auditorium as big as the world, full of all of the comput- ers that exist. Without a common set of communication protocols to regulate when and how each computer can speak, the Internet would be a chaotic mess where every machine tries to speak at once. People have developed a number of communications frameworks to address this problem. The most well-known of these is the OSI model. The OSI model The international standard for Open Systems Interconnection (OSI) is de- fined by the document ISO/IEC 7498-1, as outlined by the International Standards Organization and the International Electrotechnical Commission. The full standard is available as publication "ISO/IEC 7498-1:1994," available from http://standards.iso.org/ittf/PubliclyAvailableStandards/. The OSI model divides network traffic into a number of layers. Each layer is independent of the layers around it, and each builds on the services provided by the layer below while providing new services to the layer above. The ab- straction between layers makes it easy to design elaborate and highly reli- able protocol stacks, such as the ubiquitous TCP/IP stack. A protocol stack is an actual implementation of a layered communications framework. The OSI model doesn't define the protocols to be used in a particular network, but simply delegates each communications "job" to a single layer within a well- defined hierarchy. While the ISO/IEC 7498-1 specification details how layers should interact with each other, it leaves the actual implementation details up to the manu- facturer. Each layer can be implemented in hardware (more common for lower layers) or software. As long as the interface between layers adheres to  Chapter 3: Network Design 31 the standard, implementers are free to use whatever means are available to build their protocol stack. This means that any given layer from manufacturer A can operate with the same layer from manufacturer B (assuming the rele- vant specifications are implemented and interpreted correctly). Here is a brief outline of the seven-layer OSI networking model: Layer Name Description 7 Application The Application Layer is the layer that most net- work users are exposed to, and is the level at which human communication happens. HTTP, FTP, and SMTP are all application layer protocols. The human sits above this layer, interacting with the application. 6 Presentation The Presentation Layer deals with data representa- tion, before it reaches the application. This would include MIME encoding, data compression, format- ting checks, byte ordering, etc. 5 Session The Session Layer manages the logical communica- tions session between applications. NetBIOS and RPC are two examples of a layer five protocol. 4 Transport The Transport Layer provides a method of reaching a particular service on a given network node. Exam- ples of protocols that operate at this layer are TCP and UDP. Some protocols at the transport layer (such as TCP) ensure that all of the data has arrived at the destination, and is reassembled and delivered to the next layer in the proper order. UDP is a "con- nectionless" protocol commonly used for video and audio streaming. 3 Network IP (the Internet Protocol) is the most common Net- work Layer protocol. This is the layer where routing occurs. Packets can leave the link local network and be retransmitted on other networks. Routers perform this function on a network by having at least two network interfaces, one on each of the networks to be interconnected. Nodes on the Internet are reached by their globally unique IP address. Another critical Network Layer protocol is ICMP, which is a special protocol which provides various management messages needed for correct operation of IP. This layer is also sometimes referred to as the Internet Layer.32 Chapter 3: Network Design Layer Name Description 2 Data Link Whenever two or more nodes share the same physi- cal medium (for example, several computers plugged into a hub, or a room full of wireless devices all using the same radio channel) they use the Data Link Layer to communicate. Common examples of data link protocols are Ethernet, Token Ring, ATM, and the wireless networking protocols (802.11a/b/g). Communication on this layer is said to be link-local, since all nodes connected at this layer communicate with each other directly. This layer is sometimes known as the Media Access Control (MAC) layer. On networks modeled after Ethernet, nodes are re- ferred to by their MAC address. This is a unique 48 bit number assigned to every networking device when it is manufactured. 1 Physical The Physical Layer is the lowest layer in the OSI model, and refers to the actual physical medium over which communications take place. This can be a copper CAT5 cable, a fiber optic bundle, radio waves, or just about any other medium capable of transmitting signals. Cut wires, broken fiber, and RF interference are all physical layer problems. The layers in this model are numbered one through seven, with seven at the top. This is meant to reinforce the idea that each layer builds upon, and de- pends upon, the layers below. Imagine the OSI model as a building, with the foundation at layer one, the next layers as successive floors, and the roof at layer seven. If you remove any single layer, the building will not stand. Simi- larly, if the fourth floor is on fire, then nobody can pass through it in either direction. The first three layers (Physical, Data Link, and Network) all happen "on the network." That is, activity at these layers is determined by the configuration of cables, switches, routers, and similar devices. A network switch can only dis- tribute packets by using MAC addresses, so it need only implement layers one and two. A simple router can route packets using only their IP addresses, so it need implement only layers one through three. A web server or a laptop computer runs applications, so it must implement all seven layers. Some ad- vanced routers may implement layer four and above, to allow them to make decisions based on the higher-level information content in a packet, such as the name of a website, or the attachments of an email. The OSI model is internationally recognized, and is widely regarded as the complete and definitive network model. It provides a framework for manufac- Chapter 3: Network Design 33 turers and network protocol implementers that can be used to build network- ing devices that interoperate in just about any part of the world. From the perspective of a network engineer or troubleshooter, the OSI model can seem needlessly complex. In particular, people who build and trouble- shoot TCP/IP networks rarely need to deal with problems at the Session or Presentation layers. For the majority of Internet network implementations, the OSI model can be simplified into a smaller collection of five layers. The TCP/IP model Unlike the OSI model, the TCP/IP model is not an international standard and its definitions vary. Nevertheless, it is often used as a pragmatic model for understanding and troubleshooting Internet networks. The vast majority of the Internet uses TCP/IP, and so we can make some assumptions about networks that make them easier to understand. The TCP/IP model of net- working describes the following five layers: Layer Name 5 Application 4 Transport 3 Internet 2 Data Link 1 Physical In terms of the OSI model, layers five through seven are rolled into the top- most layer (the Application layer). The first four layers in both models are identical. Many network engineers think of everything above layer four as "just data" that varies from application to application. Since the first three lay- ers are interoperable between virtually all manufacturers' equipment, and layer four works between all hosts using TCP/IP, and everything above layer four tends to apply to specific applications, this simplified model works well when building and troubleshooting TCP/IP networks. We will use the TCP/IP model when discussing networks in this book. The TCP/IP model can be compared to a person delivering a letter to a downtown office building. The person first needs to interact with the road it- self (the Physical layer), pay attention to other traffic on the road (the Data Link layer), turn at the proper place to connect to other roads and arrive at the correct address (the Internet layer), go to the proper floor and room num-34 Chapter 3: Network Design ber (the Transport layer), and finally give it to a receptionist who can take the letter from there (the Application layer). Once they have delivered the mes- sage to the receptionist, the delivery person is free to go on their way. The five layers can be easily remembered by using the mnemonic “Please Dont Look In The Attic,” which of course stands for “Physical / Data Link / Internet / Transport / Application.” The Internet protocols TCP/IP is the protocol stack most commonly used on the global Internet. The acronym stands for Transmission Control Protocol (TCP) and Internet Protocol (IP), but actually refers to a whole family of related communications protocols. TCP/IP is also called the Internet protocol suite, and it operates at layers three and four of the TCP/IP model. In this discussion, we will focus on version four of the IP protocol (IPv4) as this is now the most widely deployed protocol on the Internet. IP Addressing In an IPv4 network, the address is a 32-bit number, normally written as four 8-bit numbers expressed in decimal form and separated by periods. Exam- ples of IP addresses are 10.0.17.1, 192.168.1.1, or 172.16.5.23. If you enumerated every possible IP address, they would range from 0.0.0.0 to 255.255.255.255. This yields a total of more than four billion possible IP addresses (255 x 255 x 255 x 255 = 4,228,250,625); although many of these are reserved for special purposes and should not be assigned to hosts. Each of the usable IP addresses is a unique identifier that distinguishes one net- work node from another. Interconnected networks must agree on an IP addressing plan. IP addresses must be unique and generally cannot be used in different places on the Internet at the same time; otherwise, routers would not know how best to route packets to them. IP addresses are allocated by a central numbering authority that provides a consistent and coherent numbering method. This ensures that duplicate ad- dresses are not used by different networks. The authority assigns large blocks of consecutive addresses to smaller authorities, who in turn assign smaller consecutive blocks within these ranges to other authorities, or to their customers. These groups of addresses are called sub-networks, or subnets for short. Large subnets can be further subdivided into smaller subnets. A group of related addresses is referred to as an address space. Chapter 3: Network Design 35 Internet ? Server 10.1.1.2 PC Server 10.1.1.2 Figure 3.3: Without unique IP addresses, unambiguous global routing is impossible. If the PC requests a web page from 10.1.1.2, which server will it reach? Subnets By applying a subnet mask (also called a network mask, or simply net- mask) to an IP address, you can logically define both a host and the network to which it belongs. Traditionally, subnet masks are expressed using dotted decimal form, much like an IP address. For example, 255.255.255.0 is one common netmask. You will find this notation used when configuring network interfaces, creating routes, etc. However, subnet masks are more succinctly expressed using CIDR notation, which simply enumerates the number of bits in the mask after a forward slash (/). Thus, 255.255.255.0 can be simpli- fied as /24. CIDR is short for Classless Inter-Domain Routing, and is de- 1 fined in RFC1518 . A subnet mask determines the size of a given network. Using a /24 netmask, 8 bits are reserved for hosts (32 bits total - 24 bits of netmask = 8 bits for 8 hosts). This yields up to 256 possible host addresses (2 = 256). By conven- tion, the first value is taken as the network address (.0 or 00000000), and the last value is taken as the broadcast address (.255 or 11111111). This leaves 254 addresses available for hosts on this network. Subnet masks work by applying AND logic to the 32 bit IP number. In binary notation, the "1" bits in the mask indicate the network address portion, and "0" bits indicate the host address portion. A logical AND is performed by comparing two bits. The result is "1" if both of the bits being compared are 1. RFC is short for Request For Comments. RFCs are a numbered series of documents pub- lished by the Internet Society that document ideas and concepts related to Internet technologies. Not all RFCs are actual standards. RFCs can be viewed online at http://rfc.net/36 Chapter 3: Network Design also "1". Otherwise the result is "0". Here are all of the possible outcomes of a binary AND comparison between two bits. Bit 1 Bit 2 Result 000 010 100 111 To understand how a netmask is applied to an IP address, first convert every- thing to binary. The netmask 255.255.255.0 in binary contains twenty-four "1" bits:  255 255 255 0  11111111.11111111.11111111.00000000 When this netmask is combined with the IP address 10.10.10.10, we can apply a logical AND to each of the bits to determine the network address. 10.10.10.10:00001010.00001010.00001010.00001010 255.255.255.0:11111111.11111111.11111111.00000000  - 10.10.10.0:00001010.00001010.00001010.00000000 This results in the network 10.10.10.0/24. This network consists of the hosts 10.10.10.1 through 10.10.10.254, with 10.10.10.0 as the network address and 10.10.10.255 as the broadcast address. Subnet masks are not limited to entire octets. One can also specify subnet masks like 255.254.0.0 (or /15 CIDR). This is a large block, containing 131,072 addresses, from 10.0.0.0 to 10.1.255.255. It could be further subdivided, for example into 512 subnets of 256 addresses each. The first one would be 10.0.0.0-10.0.0.255, then 10.0.1.0-10.0.1.255, and so on up to 10.1.255.0-10.1.255.255. Alternatively, it could be subdivided into 2 blocks of 65,536 addresses, or 8192 blocks of 16 addresses, or in many other ways. It could even be subdivided into a mixture of different block sizes, as long as none of them overlap, and each is a valid subnet whose size is a power of two. While many netmasks are possible, common netmasks include: Chapter 3: Network Design 37 CIDR Decimal of Hosts /30 255.255.255.252 4 /29 255.255.255.248 8 /28 255.255.255.240 16 /27 255.255.255.224 32 /26 255.255.255.192 64 /25 255.255.255.128 128 /24 255.255.255.0 256 /16 255.255.0.0 65 536 /8 255.0.0.0 16 777 216 With each reduction in the CIDR value the IP space is doubled. Remember that two IP addresses within each network are always reserved for the net- work and broadcast addresses. There are three common netmasks that have special names. A /8 network (with a netmask of 255.0.0.0) defines a Class A network. A /16 (255.255.0.0) is a Class B, and a /24 (255.255.255.0) is called a Class C. These names were around long before CIDR notation, but are still often used for historical reasons. Global IP Addresses Have you ever wondered who controls the allocation of IP space? Globally routable IP addresses are assigned and distributed by Regional Internet Registrars (RIRs) to ISPs. The ISP then allocates smaller IP blocks to their clients as required. Virtually all Internet users obtain their IP addresses from an ISP. The 4 billion available IP addresses are administered by the Internet As- signed Numbers Authority (IANA, http://www.iana.org/). IANA has divided this space into large subnets, usually /8 subnets with 16 million addresses each. These subnets are delegated to one of the five regional Internet regis- tries (RIRs), which are given authority over large geographic areas. 38 Chapter 3: Network Design RIPE ARIN LACNIC AfriNIC APNIC Figure 3.4: Authority for Internet IP address assignments is delegated to the five Re- gional Internet Registrars. The five RIRs are: African Network Information Centre (AfriNIC, http://www.afrinic.net/) • Asia Pacific Network Information Centre (APNIC, http://www.apnic.net/) • American Registry for Internet Numbers (ARIN, http://www.arin.net/) • Regional Latin-American and Caribbean IP Address Registry (LACNIC, • http://www.lacnic.net/) Réseaux IP Européens (RIPE NCC, http://www.ripe.net/) • Your ISP will assign globally routable IP address space to you from the pool allocated to it by your RIR. The registry system assures that IP addresses are not reused in any part of the network anywhere in the world. Once IP address assignments have been agreed upon, it is possible to pass packets between networks and participate in the global Internet. The process of moving packets between networks is called routing. Static IP Addresses A static IP address is an address assignment that never changes. Static IP addresses are important because servers using these addresses may have DNS mappings pointed towards them, and typically serve information to other machines (such as email services, web servers, etc.). Chapter 3: Network Design 39 Blocks of static IP addresses may be assigned by your ISP, either by request or automatically depending on your means of connection to the Internet. Dynamic IP Addresses Dynamic IP addresses are assigned by an ISP for non-permanent nodes connecting to the Internet, such as a home computer which is on a dial-up connection. Dynamic IP addresses can be assigned automatically using the Dynamic Host Configuration Protocol (DHCP), or the Point-to-Point Protocol (PPP), depending on the type of Internet connection. A node using DHCP first requests an IP address assignment from the network, and automatically configures its network interface. IP addresses can be assigned randomly from a pool by your ISP, or might be assigned according to a policy. IP ad- dresses assigned by DHCP are valid for a specified time (called the lease time). The node must renew the DHCP lease before the lease time expires. Upon renewal, the node may receive the same IP address or a different one from the pool of available addresses. Dynamic addresses are popular with Internet service providers, because it enables them to use fewer IP addresses than their total number of custom- ers. They only need an address for each customer who is active at any one time. Globally routable IP addresses cost money, and some authorities that specialize in the assignment of addresses (such as RIPE, the European RIR) are very strict on IP address usage for ISP's. Assigning addresses dynami- cally allows ISPs to save money, and they will often charge extra to provide a static IP address to their customers. Private IP addresses Most private networks do not require the allocation of globally routable, public IP addresses for every computer in the organization. In particular, computers which are not public servers do not need to be addressable from the public Internet. Organizations typically use IP addresses from the private address space for machines on the internal network. There are currently three blocks of private address space reserved by IANA: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. These are defined in RFC1918. These addresses are not intended to be routed on the Internet, and are typically unique only within an organization or group of organizations which choose to follow the same numbering scheme. 40 Chapter 3: Network Design To LAN To LAN 10.2.99.0/16 192.168.1.0/24 Router Router Internet Router Router 172.16.1.0/24 10.15.6.0/24 To LAN To LAN Figure 3.5: RFC1918 private addresses may be used within an organization, and are not routed on the global Internet. If you ever intend to link together private networks that use RFC1918 ad- dress space, be sure to use unique addresses throughout all of the networks. For example, you might break the 10.0.0.0/8 address space into multiple Class B networks (10.1.0.0/16, 10.2.0.0/16, etc.). One block could be as- signed to each network according to its physical location (the campus main branch, field office one, field office two, dormitories, and so forth). The net- work administrators at each location can then break the network down further into multiple Class C networks (10.1.1.0/24, 10.1.2.0/24, etc.) or into blocks of any other logical size. In the future, should the networks ever be linked (either by a physical connection, wireless link, or VPN), then all of the ma- chines will be reachable from any point in the network without having to re- number network devices. Some Internet providers may allocate private addresses like these instead of public addresses to their customers, although this has serious disadvan- tages. Since these addresses cannot be routed over the Internet, computers which use them are not really "part" of the Internet, and are not directly reachable from it. In order to allow them to communicate with the Internet, their private addresses must be translated to public addresses. This transla- tion process is known as Network Address Translation (NAT), and is nor- mally performed at the gateway between the private network and the Inter- net. We will look at NAT in more detail on Page 43. Routing Imagine a network with three hosts: A, B, and C. They use the corresponding IP addresses 192.168.1.1, 192.168.1.2 and 192.168.1.3. These hosts are part of a /24 network (their network mask is 255.255.255.0). Chapter 3: Network Design 41 For two hosts to communicate on a local network, they must determine each others' MAC addresses. It is possible to manually configure each host with a mapping table from IP address to MAC address, but normally the Address Resolution Protocol (ARP) is used to determine this automatically. Computer B 192.168.1.2 who is 192.168.1.3? Computer A 192.168.1.1 Computer C 192.168.1.3 is 00:11:22:aa:bb:cc 192.168.1.3 Computer B 192.168.1.2 Computer A 192.168.1.1 Computer C 00:11:22:aa:bb:cc - DATA... 192.168.1.3 Figure 3.6: Computer A needs to send data to 192.168.1.3. But it must first ask the whole network for the MAC address that responds to 192.168.1.3. When using ARP, host A broadcasts to all hosts the question, "Who has the MAC address for the IP 192.168.1.3?" When host C sees an ARP request for its own IP address, it replies with its MAC address. Computer B: 192.168.1.2 Computer A: Computer C: Hub 192.168.1.1 192.168.1.3 Computer D: Computer F: Hub 192.168.2.3 192.168.2.1 Computer E: 192.168.2.2 Figure 3.7: Two separate IP networks. Consider now another network with 3 hosts, D, E, and F, with the correspond- ing IP addresses 192.168.2.1, 192.168.2.2, and 192.168.2.3. This is another /24 network, but it is not in the same range as the network above. All three 42 Chapter 3: Network Design hosts can reach each other directly (first using ARP to resolve the IP address into a MAC address, and then sending packets to that MAC address). Now we will add host G. This host has two network cards, with one plugged into each network. The first network card uses the IP address 192.168.1.4, and the other uses 192.168.2.4. Host G is now link-local to both networks, and can route packets between them. But what if hosts A, B, and C want to reach hosts D, E, and F? They will need to add a route to the other network via host G. For example, hosts A-C would add a route via 192.168.1.4. In Linux, this can be accomplished with the fol- lowing command: ip route add 192.168.2.0/24 via 192.168.1.4 ...and hosts D-F would add the following: ip route add 192.168.1.0/24 via 192.168.2.4 The result is shown in Figure 3.8. Notice that the route is added via the IP address on host G that is link-local to the respective network. Host A could not add a route via 192.168.2.4, even though it is the same physical machine as 192.168.1.4 (host G), since that IP is not link-local. Computer B: 192.168.1.2 Computer A: Computer C: Hub 192.168.1.1 192.168.1.3 192.168.1.4 Computer G 192.168.2.4 Computer F: Computer D: Hub 192.168.2.3 192.168.2.1 Computer E: 192.168.2.2 Figure 3.8: Host G acts as a router between the two networks. A route tells the OS that the desired network doesn't lie on the immediate link-local network, and it must forward the traffic through the specified router. If host A wants to send a packet to host F, it would first send it to host G. Host G would then look up host F in its routing table, and see that it has a direct  Chapter 3: Network Design 43 connection to host F's network. Finally, host G would resolve the hardware (MAC) address of host F and forward the packet to it. This is a very simple routing example, where the destination is only a single hop away from the source. As networks get more complex, many hops may need to be traversed to reach the ultimate destination. Since it isn't practical for every machine on the Internet to know the route to every other, we make use of a routing entry known as the default route (also known as the de- fault gateway). When a router receives a packet destined for a network for which it has no explicit route, the packet is forwarded to its default gateway. The default gateway is typically the best route out of your network, usually in the direction of your ISP. An example of a router that uses a default gateway is shown in Figure 3.9. 10.15.5.4 10.15.6.3 Internet 10.15.5.3 10.15.6.2 Internal 10.15.5.2 10.15.6.1 Router eth1 eth0 Routing table for internal router: Destination Gateway Genmask Flags Metric Iface 10.15.5.0 255.255.255.0 U 0 eth1 10.15.6.0 255.255.255.0 U 0 eth0 default 10.15.6.1 0.0.0.0 UG 0 eth0 Figure 3.9: When no explicit route exists to a particular destination, a host uses the default gateway entry in its routing table. Routes can be updated manually, or can dynamically react to network out- ages and other events. Some examples of popular dynamic routing protocols are RIP, OSPF, BGP, and OLSR. Configuring dynamic routing is beyond the scope of this book, but for further reading on the subject, see the resources in Appendix A. Network Address Translation (NAT) In order to reach hosts on the Internet, RFC1918 addresses must be con- verted to global, publicly routable IP addresses. This is achieved using a technique known as Network Address Translation, or NAT. A NAT device is a router that manipulates the addresses of packets instead of simply forward- ing them. On a NAT router, the Internet connection uses one (or more) glob-44 Chapter 3: Network Design ally routed IP addresses, while the private network uses an IP address from the RFC1918 private address range. The NAT router allows the global ad- dress(es) to be shared with all of the inside users, who all use private ad- dresses. It converts the packets from one form of addressing to the other as the packets pass through it. As far as the network users can tell, they are directly connected to the Internet and require no special software or drivers. They simply use the NAT router as their default gateway, and address pack- ets as they normally would. The NAT router translates outbound packets to use the global IP address as they leave the network, and translates them back again as they are received from the Internet. The major consequence of using NAT is that machines from the Internet can- not easily reach servers within the organization without setting up explicit for- warding rules on the router. Connections initiated from within the private ad- dress space generally have no trouble, although some applications (such as Voice over IP and some VPN software) can have difficulty dealing with NAT. To 10.1.1.3 Internet ? 69.90.235.226 192.0.2.1 NAT router 10.1.1.1 10.1.1.2 10.1.1.3 10.1.1.4 Figure 3.10: Network Address Translation allows you to share a single IP address with many internal hosts, but can make it difficult for some services to work properly. Depending on your point of view, this can be considered a bug (since it makes it harder to set up two-way communication) or a feature (since it effectively provides a "free" firewall for your entire organization). RFC1918 addresses should be filtered on the edge of your network to prevent accidental or mali- cious RFC1918 traffic entering or leaving your network. While NAT performs some firewall-like functions, it is not a replacement for a real firewall.  Chapter 3: Network Design 45 Internet Protocol Suite Machines on the Internet use the Internet Protocol (IP) to reach each other, even when separated by many intermediary machines. There are a number of protocols that are run in conjunction with IP that provide features as critical to normal operations as IP itself. Every packet specifies a protocol number which identifies the packet as one of these protocols. The most commonly used pro- tocols are the Transmission Control Protocol (TCP, number 6), User Data- gram Protocol (UDP, number 17), and the Internet Control Message Pro- tocol (ICMP, number 1). Taken as a group, these protocols (and others) are known as the Internet Protocol Suite, or simply TCP/IP for short. The TCP and UDP protocols introduce the concept of port numbers. Port numbers allow multiple services to be run on the same IP address, and still be distinguished from each other. Every packet has a source and destination port number. Some port numbers are well defined standards, used to reach well known services such as email and web servers. For example, web serv- ers normally listen on TCP port 80, and SMTP email servers listen on TCP port 25. When we say that a service "listens" on a port (such as port 80), we mean that it will accept packets that use its IP as the destination IP address, and 80 as the destination port. Servers usually do not care about the source IP or source port, although sometimes they will use them to establish the identity of the other side. When sending a response to such packets, the server will use its own IP as the source IP, and 80 as the source port. When a client connects to a service, it may use any source port number on its side which is not already in use, but it must connect to the proper port on the server (e.g. 80 for web, 25 for email). TCP is a session oriented protocol with guaranteed delivery and transmission control features (such as detec- tion and mitigation of network congestion, retries, packet reordering and re- assembly, etc.). UDP is designed for connectionless streams of information, and does not guarantee delivery at all, or in any particular order. The ICMP protocol is designed for debugging and maintenance on the Internet. Rather than port numbers, it has message types, which are also numbers. Dif- ferent message types are used to request a simple response from another com- puter (echo request), notify the sender of another packet of a possible routing loop (time exceeded), or inform the sender that a packet that could not be delivered due to firewall rules or other problems (destination unreachable). By now you should have a solid understanding of how computers on the network are addressed, and how information flows on the network between them. Now let's take a brief look at the physical hardware that implements these network protocols.46 Chapter 3: Network Design Ethernet Ethernet is the name of the most popular standard for connecting together computers on a Local Area Network (LAN). It is sometimes used to connect individual computers to the Internet, via a router, ADSL modem, or wireless device. However, if you connect a single computer to the Internet, you may not use Ethernet at all. The name comes from the physical concept of the ether, the medium which was once supposed to carry light waves through free space. The official standard is called IEEE 802.3. The most common Ethernet standard is called 100baseT. This defines a data rate of 100 megabits per second, running over twisted pair wires, with modu- lar RJ-45 connectors on the end. The network topology is a star, with switches or hubs at the center of each star, and end nodes (devices and ad- ditional switches) at the edges. MAC addresses Every device connected to an Ethernet network has a unique MAC address, assigned by the manufacturer of the network card. Its function is like that of an IP address, since it serves as a unique identifier that enables devices to talk to each other. However, the scope of a MAC address is limited to a broadcast domain, which is defined as all the computers connected together by wires, hubs, switches, and bridges, but not crossing routers or Internet gateways. MAC addresses are never used directly on the Internet, and are not transmitted across routers. Hubs Ethernet hubs connect multiple twisted-pair Ethernet devices together. They work at the physical layer (the lowest or first layer). They repeat the signals received by each port out to all of the other ports. Hubs can therefore be considered to be simple repeaters. Due to this design, only one port can suc- cessfully transmit at a time. If two devices transmit at the same time, they corrupt each other's transmissions, and both must back off and retransmit their packets later. This is known as a collision, and each host remains re- sponsible for detecting collisions during transmission, and retransmitting its own packets when needed. When problems such as excessive collisions are detected on a port, some hubs can disconnect (partition) that port for a while to limit its impact on the rest of the network. While a port is partitioned, devices attached to it cannot communicate with the rest of the network. Hub-based networks are generally more robust than coaxial Ethernet (also known as 10base2 or ThinNet), where misbehaving de- vices can disable the entire segment. But hubs are limited in their usefulness, since they can easily become points of congestion on busy networks.

Advise: Why You Wasting Money in Costly SEO Tools, Use World's Best Free SEO Tool Ubersuggest.