Teaching Tip In a tour de force, the author used less than 250 words on Page 137 to describe two decades of network protocol history and introduce two Key Terms (protocol and protocol suite). This reflects the new CompTIA exam objectives’ focus on the most important protocol suite, TCP/IP. The other protocol suites are just history. IP works at Layer 3 (Network) This chapter deals with IP addressing (IPv4 now – IPv6 in Chapter 13).
Teaching Tip Point out that the use of the term IP in this chapter refers to IPv4, unless otherwise stated.
This entire chapter focuses on IPv4
The Windows GUI utility, Internet Protocol Version 4 (TCP/IPv4) , will be discussed later in the Chapter.
Yes, this is at the Windows command prompt! The CMD window has been modified to have a white background and black text. It is a nice touch, but students might be a bit confused. This is an excellent opportunity to tell them that they will often encounter customized desktops, and they should learn to find and recognize their favorite tools regardless of how they appear.
Teaching Tip The three “jobs” of IP listed above are detailed in the next three sections titled Network IDs, Interconnecting, and Subnet Mask.
Teaching Tip The author is building up to explaining network mask, so avoid going into detail at this point. However, be careful how you explain things so far. The book says that you cannot have an address that ends with a zero, but the rule being applied here is that the Host ID cannot be all one’s, nor can it be all zeroes – in binary . This all depends on the masking, so proceed carefully. All will be revealed.
Note: This is why default gateway is part of IP configuration.
While the above example is fine for teaching this concept, later in the chapter (after page 153), come back to this example and have the students explain why a /25 subnet would not be used. See rule #3 on Page 153 in the Chapter: You cannot have a single-character network ID extension. You always start by moving the subnet at least two digits.
Teaching Tip There is a small error in Figure 7.31 on Page 155. The last digit of the next-to-the-last line should be a zero. This could be a teaching opportunity: ask the students to discover the error.
There are several ways to access the Properties of Internet Protocol Version 4 (TCP/IPv4). Vista instructions for just one way to get there: open the Start Menu , right click on Network and select Properties . In the Network and Sharing Center select Manage network connections . Right-click Local Area Connection and select Properties . If the User Account Control window pops up, select Continue . In the Local Area Connection Properties dialog box scroll (if necessary) to Internet Protocol Version 4 (TCP/IPv4) and carefully click on the words (not the check box). Click the Properties button. This will show the TCP/IPv4 Properties.
Even though by convention we use 127.0.0.1 as the loopback address, the entire 127.0.0.0/8 subnet is reserved for loopback! You can use any address in the 127.0.0.0/8 subnet as a loopback address
Networking Chapter 7
TCP/IP Basics Chapter 7
Objectives• Describe how the Internet Protocol works• Explain CIDR and subnetting• Describe the functions of static and dynamic IP addresses
Moving up the OSI Layers• Chapters 3 through 6 detailed Layers 1 and 2• Ethernet network technology• Now explore the software side of networking – Individual rule is a protocol – A protocol suite is a set of rules• Begin with Internet Protocol (IP) of TCP/IP
Three Parts to Chapter 7• IP in Depth• CIDR and Subnetting• Using IP Addresses
Figure 7.3 Broadcasting won’t work for the entire Internet
• TCP/IP on LAN over Ethernet – IP addressing overcomes limits of Ethernet MAC addresses • Unique IP address per host • Unique address per logical network • Communicate between LANs without broadcasts
• IP Addresses (IPv4 only] – 32-bit value • Example: 11000000101010000000010000000010 • Broken into four groups of eight 11000000.10101000.00000100.00000010 • Each 8-bit value convertsed into a decimal number between 0 and 255
• IP Addresses (IPv4 only] – Converted: 11000000101010000000010000000010 is displayed as 192.168.4.2 in dotted decimal notation (dotted-octet numbering system) – Know how to convert dotted decimal to binary and back • Every OS has a calculator
• Using a Calculator for conversion – Decimal to binary • Enter value in decimal view • Switch to binary view to convert value • Leading zeroes do not display in Calculator • Leading zeroes important when working with IP addresses
Figure 7.4 Macintosh OS X Calculator in Programmer mode
Figure 7.5 Converting decimal to binary with Windows Vista’s Calculator
• Every MAC address must be unique• Every IP address must be unique
Figure 7.6 Small network with both IP and MAC addresses
• Utilities for displaying IP and MAC addresses – Every OS has at least one GUI tool • Mac OS X system’s Network utility • Windows Local Area Connection Properties – Every OS has a command-line utility • Windows has IPCONFIG • UNIX/Linux/Mac use IFCONFIG
• IP Addresses in Action – IP must do three things 1. Give each LAN its own identifier 2. Allow routers connecting LANs to use network identifiers to send packets to the right network 3. Give each computer a way to understand when a packet is intended for a computer on the local LAN or for a computer on the WAN
1. IP must give each LAN its own identifier – Network IDs • All computers on same LAN must have same network ID • Each computer on same LAN must have a unique host ID • Example: 192.168.5.x represents addresses in Figure 7.10 – Network address of this network is 192.168.5.0 (assuming a 24- bit mask) – Network ID plus Host ID = one IP address.
2. IP must allow routers connecting LANs to use network identifiers to send packets to the right network – Interconnecting • Requires a router connection • Router requires a network connection and IP address on each LAN – IP address of router’s connection to a LAN is the default gateway for that LAN – Network administrators often give lowest host address in the network to the router
– Interconnecting (cont.) • Router uses a built-in router table – Uses this to determine where to send packets – How router uses routing table: Everything for 192.168.5.0 Everything else goes out goes out 192.168.5.1 188.8.131.52
– Interconnecting (cont.) • Limitations of using 192.168.5.0 as host ID – Limited to 192.168.5.1 through 192.168.5.254 (254 addresses) • Network ID of 184.108.40.206 has a total of 65,534 hosts • Network ID of 220.127.116.11 has a total of 16.7 million hosts • Network IDs allow router to connect multiple LANs to a WAN
3. IP must give each computer a way to understand when a packet destination is local or on the WAN – Subnet Mask • Sending to host on same network: broadcast for MAC address • Sending to host on another network: send to default gateway • Sending computer uses subnet mask to determine where to send packet • Example of a subnet mask using dotted-octet binary notation: 11111111.11111111.11111111.00000000 • Example of the same subnet mask using dotted decimal notation: 255.255.255.0
Figure 7.14 The three amigos, separated by walls or miles
– Subnet Mask (cont.) • Line up an IP address with a corresponding subnet mask in binary – Portion of IP address that aligns with the ones of the subnet mask is the network ID of the IP address. – Portion of IP address that aligns with the zeroes of the subnet mask is the HostID of the IP address
Dotted Binary DecimalIP address 192.168.5.23 11000000.10101000.00000101.00010111Subnet mask 255.255.255.0 11111111.11111111.11111111.00000000Network ID 192.168.5.0 11000000.10101000.00000101.xHost ID x.x.x.23 x.x.x.00010111
– Subnet Mask (cont.) • Sending computer compares the destination IP address to its own IP address using the subnet mask • If the destination IP address matches the computer IP wherever there’s a 1 in the subnet mask, sending computer knows the address is local • If the destination IP address does not match the sending computer’s IP wherever there’s a 1 in the subnet mask, sending computer knows the address is remote
– Subnet Mask (cont.) • When the destination address is local, the sending computer sends out an Address Resolution Protocol (ARP) broadcast to determine the destination computer’s MAC address • The ARP packet contains the sending computer’s IP address as well as the destination address • Destination computer responds to the ARP request by sending an ARP response containing its MAC address • Sending computer can now send data packets to destination
– Subnet Mask (cont.) • When the sending computer discovers that the destination address does not have the same network ID as itself, then it must send the packet beyond the local network • The packet must be sent to the default gateway • Sending computer must ARP for the MAC address of the default gateway
– Subnet Mask (cont.) • An IP address followed by the / and a number describes the IP and the address in one statement18.104.22.168/24 = IP address plus subnet maskIP address = 22.214.171.124Subnet mask = 255.255.255.018126.96.36.199/16 = IP address plus subnet maskIP address = 188.8.131.52Subnet mask = 255.255.0.0
– Subnet Mask (cont.) • Network administrators must enter correct IP address and subnet mask when configuring a network card • The networking software does the rest • If you want a computer to work in a routed network, you must configure the computer correctly with an IP address, subnet mask, and default gateway
– Class IDs • No two devices on the Internet can share the same IP address • Internet Assigned Number Authority (IANA) tracks and disperses IP addresses in chunks called class licenses – Oversees several Regional Internet Registries (RIRs) – RIRs in turn pass out IP addresses to large ISPs – ISPs pass out IP addresses to most end users
First Decimal Hosts per Value (range) Addresses Network IDClass A 1 – 126 184.108.40.206 – 220.127.116.11 16,277,214Class B 128 – 191 18.104.22.168 – 22.214.171.124 65,534Class C 192 – 223 192.0.0.0 – 126.96.36.199 254Class D 224 – 239 188.8.131.52 – 184.108.40.206 MulticastClass E 240 – 255 240.0.0.0 – 255.255.255.255 Reserved IP Address Classes
– Class IDs – More about Class D and E • Three ways to send a packet – Broadcast to every computer on the LAN – Unicast from one computer to another computer – Multicast from one computer to a group » Uncommon between computers » Often used by routers
– Class IDs – The state of IP address • IP class licenses were allocated too generously at first • Unallocated IP addresses became scarce • IP class licenses concept did not scale well – If you needed 2000 IP addresses you had to take a single Class B or eight Class C licenses • Solution – New method for generating blocks of IP addresses – Classless Inter-Domain Routing (CIDR)
• CIDR and Subnetting Overview – CIDR based on subnetting – Subnetting chops up a single class of IP addresses into multiple smaller groups – CIDR and subnetting are virtually the same thing – Subnetting done by an organization on a block of addresses to create multiple subnetworks – CIDR done by an ISP on a block of addresses to create multiple subnets to pass out to customers
• Subnetting – More efficient use of IP addresses than class licenses – Enables separation of networks for security – Enables bandwidth control – Subnet mask is cornerstone of subnetting • Extend subnet masks of /8, /16, or /24 subnet by adding more ones (removing equal number of zeroes).
• Subnetting the Internet Café – 50 computers • 40 public computers • 10 back office computers • 10 wireless clients (maximum) – Network ID 192.168.4/24 – Must prevent people using the public system from accessing private machines
• Subnetting the Internet Café (cont.) – Begin with the given subnet mask and move it to the right until you have the number of subnets you need – Forget the dots • Don’t be limited to /8, /16, /24 networks • Network IDs do not need to end on the dots • Create subnets of /26, /27, /22, etc.
• Subnetting the Internet Café (cont.) – 192.168.4/24 – Change a zero to a one in the subnet mask – /24 becomes a /25 subnet 11111111111111111111111110000000
• Calculating Hosts – Hosts on a /24 network – 192.168.4.1 to 192.168.4.254 = 254 hosts – Calculate in binary • In a /24 network 8 binary digits are used for the host ID • 00000001 to 11111110 = 254 hosts • 2(number of zeroes in the subnet mask) – 2 • 28 – 2 = 254 total hosts – Memorize the formula
• Calculating Hosts (cont.) – Hosts on a /16 network • In a /16 network 16 zeroes are part of the host ID • 0000000000000001 to 1111111111111110 = 65,534 hosts • 2(number of zeroes in the subnet mask) – 2 • 216 – 2 = 65,534 total hosts
• Calculating Hosts (cont.) – Hosts on a /26 network • In a /26 network 6 zeroes are part of the host ID • 000001 to 111110 = 62 hosts • 2(number of zeroes in the subnet mask) – 2 • 26 – 2 = 62 total hosts
• Your First Subnet – Convert the 192.168.4/24 net ID into three network IDs – Write out the subnet mask in binary – Place a line at the end of the ones
• Your First Subnet (cont.) – Draw a second line one digit to the right – Three areas (a Mike Trick, not official terms) • Subnet mask (SM) • Network ID extension (NE) • Hosts (H) – This is now a /25 subnet mask
• Your First Subnet (cont.) – A subnet mask is always 32 binary digits long – A string of ones followed by a string of zeroes 11111111111111111111111110000000 – Put periods between every eight digits 11111111.11111111.11111111.10000000 – Then convert to dotted decimal – The resulting subnet mask: 255.255.255.128
• Your First Subnet (cont.) – Get used to the idea of subnet masks that use more than 255s and 0s (in dotted decimal form) – Examples of legitimate subnet masks • 255.255.255.224 11111111.11111111.11111111.11100000 • 255.255.128.0 11111111.11111111.10000000.00000000 • 255.248.0.0 11111111.11111000.00000000.00000000
• Rules for Calculating Subnets 1. Starting with a beginning subnet mask, you extend the subnet extension until you have the number of subnets you need 2. You cannot have an NE of all zeroes or all ones, so you calculate the number of subnets using this formula: new subnets = 2(number of zeroes in the subnet mask) – 2 3. You cannot have a single-character network ID extension. You always start by moving the subnet at least two digits
• Calculating Subnets (cont.) – Rules 2 and 3 explained • Adding just a single digit to the beginning subnet mask only gives you two network IDs: a zero and a one • You cannot have a network ID extension of all zeroes or all ones • Therefore, you need rule 3
Figure 7.26 Single-digit network ID extensions are not allowed
• Calculating Subnets (cont.) – Subnet /24 to /26 – Adds two digits, creating four new network IDs (two of which are not usable) – Convert the original network ID to binary and add the four different network ID extension to the end – The possible NEs in binary are 00, 01, 10, 11 – Can’t have all zeroes, can’t have all ones – Therefore, only two new networks (01 and 10)
• Calculating Subnets (cont.) – The new network IDs in decimal 192.168.4.64/26 hosts = 192.168.4.65 – 192.168.4.126 192.168.4.128/26 Hosts = 192.168.4.129 – 192.168.4.191
Figure 7.29 Two networks using the two network IDs
• Calculating Subnets (cont.) – The Internet Café needs three subnets – How large a network ID extension is needed? – Two NE digits = 22 – 2 = 2 network IDs – Three NE digits = 23 – 2 = 6 network IDs – Therefore, you need to extend the NE three digits to get at least three network IDs – Three are wasted
• Calculating Subnets (cont.) – Create a /27 subnet by moving the NE over three digits – Calculate the host address ranges for each usable new subnet – 192.168.4.32/27 (192.168.4.33–192.168.4.62) – 192.168.4.64/27 (192.168.4.65–192.168.4.94) – 192.168.4.96/27 (192.168.4.97–192.168.4.126) – 192.168.4.128/27 (192.168.4.129–192.168.4.158) – 192.168.4.160/27 (192.168.4.161–192.168.4.190) – 192.168.4.192/27 (192.168.4.193–192.168.4.222)
Figure 7.30 Moving the network ID extension three digits
Figure 7.31 Two of the six network ID address ranges
Manual Binary to Dotted Decimal Conversion• Write bit values in decimal from left to right – Take binary value of one dotted octet portion and place ones and – zeroes under appropriate positions 128 64 32 16 8 4 2 1 1 0 0 1 0 1 1 0 Add the decimal values that have a 1 underneath – 128+16+4+2 = 150
• Manual Dotted Decimal to Binary Conversion – Start with bit values beginning with 128 – Place decimal value above the first value on the left which it exceeds and subtract and place a one to represent this binary value 221 128 64 32 16 8 4 2 1 93 1
• Manual Dotted Decimal to Binary Conversion – Place the remainder above the next bit value that it exceeds (Place a zero in positions that are skipped) 221 93 29 13 5 1 128 64 32 16 8 4 2 1 93 29 13 5 1 0 1 1 0 1 1 1 0 1 – Decimal 221 = binary 11011101
• CIDR: Subnetting in the Real World – Two situations in which subnetting takes place • ISPs (Large ones) – Receive class licenses from IANA – Subnet those class licenses for customers • Very large customers – Take subnets from ISPs (sometimes already subnetted class licenses) – Make their own subnets
• CIDR: Subnetting in the Real World (cont.) – Why learn subnetting? • CompTIA Network+ exam requires it • There’s a good chance you’ll contact an ISP and get CIDR addresses – Think of subnets in terms of CIDR values like /8, /22, /26, and so on • More advanced IT certifications (Cisco, Microsoft, etc.) require this knowledge
• Overview of Using IP Addresses – Assigning IP addresses to computers – Specialty IP addresses
• Assigning an IP address, subnet mask, and default gateway – Static addressing • Type in all the information – Dynamic addressing • Server program automatically passes out the information to computers on the network
• Static IP Addresses – Manually type in all IP information • What are you typing in? • Where do you type it? – Assuming a Class C license for 197.156.4/24 • You can do whatever you want with your own network ID • Use legit IP address and mask for network ID • Every IP address must be unique • You don’t have to use the numbers in order • You don’t have to use 220.127.116.11 as default gateway
• Static IP Addresses (cont.) – Network techs’ set of principles • Give the default gateway the first host IP address in the network ID • Try to use the IP addresses in some kind of sequential order • Try to separate servers from clients – Servers host addresses: 18.104.22.168 to 22.214.171.124 – Client host addresses: 126.96.36.199 to 188.8.131.52 • Write down whatever you do so person who comes after you understands what you did
• Static IP Addresses (cont.) – Give each computer an IP address, subnet mask, and default gateway • In Windows use the Internet Protocol Version 4 (TCP/IPv4) Properties dialog box • In Macintosh OS X, run the Network utility in System Preferences • In UNIX/Linux use the command-line IFCONFIG command
Figure 7.33 Entering static IP information in Windows Internet Protocol Version 4 (TCP/IPv4) Properties
Figure 7.34 Entering static IP information in the OS X Network utility
Figure 7.35 IFCONFIG command to set static IP address
• Static IP Addresses (cont.) – After adding IP information to at least two systems, verify with the PING command – Successful PING confirms two systems can communicate – If the PING is not successful • Check your IP settings • Check connections, driver, etc. – Static addressing used for most critical systems – Most systems today use dynamic IP addressing
Figure 7.37 Two PINGs (successful PING on top, unsuccessful PING on bottom)
• Dynamic IP Addressing – Dynamic Host Configuration Protocol (DHCP) • More popular form of dynamic IP addressing • Bootstrap Protocol (BOOTP) older version – Automatically assigns an IP address whenever a computer connects to the network – DHCP uses a simple process • Computer is configured to use DHCP • Every OS has a method to tell computer to use DHCP • Windows setting: Obtain an IP address automatically
• How DHCP Works – DHCP Server is configured to pass out IP addresses • Scope = range of IP addresses • Subnet mask for scope • Default gateway for scope • Gives out other information (detailed in later chapters)
• How DHCP Works (cont.) – When DHCP client boots up it broadcasts a DHCP discovery packet • Discovery packet asks “Are there any DHCP servers out there?” • DHCP server responds with a DHCP offer • DHCP clients responds with a DHCP request • DHCP server responds with a DHCP acknowledge and maintains a database of the MAC addresses of DHCP clients along with the IP information assigned to each • DHCP client accepts with a DHCP lease
Figure 7.39 Computer sending out a DHCP discovery message
Figure 7.41 DHCP request and DHCP acknowledge
• How DHCP Works (cont.) – DHCP Lease • Set for a fixed amount of time • Usually 5 to 8 days • At the end of the lease time, DHCP client makes another DHCP discovery message • DHCP server looks at the MAC address, comparing it to its database of leases • Unless another computer has taken the lease, server will give the client the same IP information, including the same IP address
• Living with DHCP – Possible problems • DHCP client tries to get a DHCP address and fails • Symptoms – OS will post an error – DHCP client will have an address in the 169.254/16 network ID – Can access local computers, but cannot connect to Internet
• Living with DHCP – Automatic Private IP Addressing (APIPA) • Addresses in the 169.254/16 network ID that a DHCP client will assign to itself when it fails to find a DHCP server • Allows computers on same LAN to communicate (if they are using APIPA) • APIPA does not provide default gateway, so clients using APIPA cannot access the Internet • Use available tool to see IP settings • If you see an APIPA address, you know you have a DHCP problem
• Living with DHCP – Reestablish the lease manually – In Windows • Ipconfig/renew – On a Macintosh • Go to System Preferences and use the Network utility – May need to force computer to release its lease • Windows command line: ipconfig /release ipconfig /renew • Release in Linux: sudo ifconfig eth0 down • Renew in Linux: sudo ifconfig eth0 up
Figure 7.43 Network utility in System Preferences
• Special IP Addresses – Loopback = 127.0.0.1 • Use to send packets from your NIC to itself • Test NIC’s capability to send and receive packets: ping 127.0.0.1 – Private IP addresses • 10.0.0.0 through 10.255.255.255 (1 Class A license) • 172.16.0.0. through 172.31.255.255 (16 Class B licenses) • 192.168.0.0 through 192.168.255.255 (256 Class C licenses) – All other IP addresses are public IP addresses