280 likes | 326 Views
DHCP allows hosts to dynamically obtain their IP address from a network server when they join a network. It supports address renewal and allows reuse of addresses while connected.
E N D
DHCP: Dynamic Host Configuration Protocol Goal: allow host to dynamically obtain its IP address from network server when it joins network Can renew its lease on address in use Allows reuse of addresses (only hold address while connected an “on”) Support for mobile users who want to join network (more shortly) DHCP overview: • host broadcasts “DHCP discover” msg [optional] • DHCP server responds with “DHCP offer” msg [optional] • host requests IP address: “DHCP request” msg • DHCP server sends address: “DHCP ack” msg Network Layer
E B A DHCP client-server scenario 223.1.2.1 DHCP 223.1.1.1 server 223.1.1.2 223.1.2.9 223.1.1.4 223.1.2.2 arriving DHCP client needs address in this network 223.1.1.3 223.1.3.27 223.1.3.2 223.1.3.1 Network Layer
DHCP discover src : 0.0.0.0, 68 dest.: 255.255.255.255,67 yiaddr: 0.0.0.0 transaction ID: 654 DHCP client-server scenario arriving client DHCP server: 223.1.2.5 DHCP offer src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 654 Lifetime: 3600 secs DHCP request src: 0.0.0.0, 68 dest:: 255.255.255.255, 67 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs time DHCP ACK src: 223.1.2.5, 67 dest: 255.255.255.255, 68 yiaddrr: 223.1.2.4 transaction ID: 655 Lifetime: 3600 secs Network Layer
DHCP: more than IP address DHCP can return more than just allocated IP address on subnet: • address of first-hop router for client • name and IP address of DNS sever • network mask (indicating network versus host portion of address) Network Layer
DHCP UDP IP Eth Phy DHCP UDP IP Eth Phy DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP: example • connecting laptop needs its IP address, addr of first-hop router, addr of DNS server: use DHCP • DHCP request encapsulated in UDP, encapsulated in IP, encapsulated in 802.1 Ethernet 168.1.1.1 • Ethernet frame broadcast (dest: FFFFFFFFFFFF) on LAN, received at router running DHCP server router (runs DHCP) • Ethernet demuxed to IP demuxed, UDP demuxed to DHCP Network Layer
DHCP UDP IP Eth Phy DHCP UDP IP Eth Phy DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP DHCP: example • DCP server formulates DHCP ACK containing client’s IP address, IP address of first-hop router for client, name & IP address of DNS server • encapsulation of DHCP server, frame forwarded to client, demuxing up to DHCP at client • client now knows its IP address, name and IP address of DSN server, IP address of its first-hop router router (runs DHCP) Network Layer
NAT: Network Address Translation rest of Internet local network (e.g., home network) 10.0.0/24 10.0.0.1 10.0.0.4 10.0.0.2 138.76.29.7 10.0.0.3 Datagrams with source or destination in this network have 10.0.0/24 address for source, destination (as usual) All datagrams leaving local network have same single source NAT IP address: 138.76.29.7, different source port numbers Network Layer
NAT – Network Address Translation Placement and operation of a NAT box. Network Layer
Internet Control Message Protocol The principal ICMP message types. 5-61 Network Layer
ICMP: example • Hannah being a great network trouble shooter • Can test basic network connectivity using • The ping command • uses the ICMP sending a message called echo request • The destination should reply with an ICMP echo reply Network Layer
Exercises • A router has the following entries in its routing table: Address/mask Next hop 135.46.56.0/22 interface 0 135.46.60.0/22 interface 1 192.53.40.0/23 interface 2 default interface 3 • For each of the following addresses, what does the router do if a packet with that address arrives: a) 135.46.63.10, b) 135.46.57.14, c)135.46.52.2, d)192.53.40.7, e) 192.53.56.7 Network Layer
Solution • The packets are routed as follows: • a) Interface 1 • b) Interface 0 • c) Interface 3 • d) Interface 2 • e) Interface 3 Network Layer
Exercises • A router has just received the following new IP addresses: 57.6.96.0/21, 57.6.104.0/21, 57.6.112.0/21, and 57.6.120.0/21. If all of them use the same outgoing line, can they be aggregated? If so, to what? If not, why not? Network Layer
Exercises • You have a class C network, and you need to design it for 7 usable subnets with each subnet handling a minimum of 18 hosts each. Which of the following network masks should you use? • 255.255.224.0 • 255.255..255.230 • 255.255.255.224 • 255.255.255.240 • None of the above Network Layer
Solution • Answer: C Explanation: The default subnet mask for class C network is 255.255.255.0. If one has to create 5 subnets, then 3 bits are required. With 3 bits we can create 6 subnets. The remaining 5 bits are used for Hosts. One can create 30 hosts using 5 bits in host field. This matches with the requirement. Network Layer
Exercises • If a host on a network has the address 172.16.210.0/22, what is the address of the subnetwork to which the host belongs? • 172.16.42.0 • 172.16.107.0 • 172.16.208.0 • 172.16.255.208 • 172.16.254.0 Network Layer
Solution • Answer: C Explanation: This question is much easier then it appears when you convert it to binary and do the Boolean operation as shown below: IP address 172.16.210.0 = 10101100.00010000.11010010.00000000 /22 mask = 11111111.11111111.11111100.00000000 AND result = 11111111.11111111.11010000.00000000 AND in decimal= 172 . 16 . 208 . 0 Network Layer
Exercises • How many subnetworks and hosts are available per subnet if you apply /28 mask to the 210.10.2.0 class C network • 30 networks and 6 hosts • 6 networks and 30 hosts • 8 networks and 32 hosts • 14 networks and 6 hosts • None of the above Network Layer
Solution • Answer: E Explanation: A 28 bit subnet mask (11111111.11111111.11111111.11110000) applied to a class C network uses a 4 bits for networks, and leaves 4 bits for hosts. Using the 2n-2 formula, we have 24-2 (or 2x2x2x2 2) which gives us 14 for both the number of networks, and the number of hosts. Network Layer
Exercises • Given that you have a class B IP address network range, which of the subnet masks below will allow for 100 subnets with 500 usable host addresses per subnet? • 255.255.0.0 • 255.255.224.0 • 255.255.254.0 • 255.255.255.0 • 255.255.255.224 Network Layer
Solution • Answer: C Explanation: Using the 2n-2 formula for host addresses, 29-2 = 510 host address, so a 9-bit subnet mask will provide the required number of host addresses. If these 9 bits are used for the hosts in a class B network, then the remaining 7 bits are used for the number of networks. Again using the 2n-2 formula, we have 2n- 2 = 126 networks that are available. Network Layer
Exercises • Given the following IP address and subnet mask: 172.16.211.12/20, find the broadcast address associated with the subnet that this IP address resides upon. • 172.16.255.255 • 172.16.224.224 • 172.16.224.255 • 172.16.223.255 • None of the above Network Layer
Exercises • Your network uses the 172.12.0.0 IP address. You need to support 459 hosts per network, while accommodating the maximum number of subnets. Which mask would you use? • 255.255.0.0 • 255.255.128.0 • 255.255.254.0 • 255.255.255.254 • 255.255.255.128 Network Layer
Solution • Answer:C Explanation: To obtain 459 hosts the number of host bits will be 9. This can support a maximum of 510 hosts. To keep 9 bits for hosts means the last bit in the 3rd octet will be 0. This gives 255.255.254.0 as the subnet mask. Network Layer
Exercises • The LAU network was assigned the class C network address 189.66.1.0 from the ISP. If the administrator at LAU were to subnet this class C network using the 255.255.255.224 subnet mask, how many hosts will they be able to support on each subnet? • 14 • 16 • 32 • 30 • None of the above Network Layer
Solution • Answer: D Explanation: The subnet mask 255.255.255.224 is a 27 bit mask (11111111.11111111.11111111.11100000). It uses 3 bits from the host Id for the network ID, leaving 5 bits for host addresses. We can calculate the number of hosts supported by this subnet by using the 2n-2 formula where n represents the number of host bits. In this case it will be 5. 25-2 gives us 30. Network Layer
Exercises • You have been the CIDR block of 115.64.4.0/22 from your ISP. Which of the IP addresses below can you use for a host? • 115.64.8.32 • 115.64.7.64 • 115.64.6.255 • 115.64.3.255 • 115.64.5.128 • 115.64.12.128 Network Layer
Solution • Answer: B, C, E Explanation: 115.64.4.0 =01110011.01000000.00000100.00000000 Subnet mask = 11111111.11111111.11111100.00000000= 255.255.252.0 Subnet number = 01110011.01000000.00000100.00000000= 115.64.4.0 Broadcast = 01110011.01000000.00000111.11111111= 115.64.7.255 Valid address range = 115.64.4.1 - 115.64.7.254 Network Layer