Understanding IP Addressing in Networking
IP addressing plays a crucial role in providing unique addresses to machines on the internet, identifying networks and hosts, enabling routing, and ensuring proper packet delivery across networks. This content covers the need for IP addresses, their role in routing, address parts, classful IP addressing, address masks, and the use of routers in handling masked addresses. It also explains how to determine if a machine is on a network using IP and mask values.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Q and A, Ch. 21 CS332, Fall 2017 Victor Norman
Reason for IP addresses Q: I'm still not super clear on the need for IP addresses. I think it's for: 1. provide unique address for each machine on the internet; A: Yes 2.to send packet regardless the physics of the hardware(?); A: Yes 3.identify the type of network a host or the destination machine is on. A: No.
Role of IP address in routing Q: When a packet is sent across networks, is the IP address used to carry the packet all the way to the destination? or does it carry the packet to the correct LAN and the MAC address takes care of the rest? A: All the way. The destination IP address does not change. When it gets to the last router, the router sends the packet to the destination with the destinations MAC address in Ethernet header.
IP Address Parts Every IP address has two (or 3) parts: Network part: uniquely identifies the network universally. Host part: uniquely identifies the host on the network. Why is this done? Routing is done on the network part of an IP address. For scalability. Part of the host part can be used as a subnet part, within an organization.
Classful IP Addressing (the old way) Figure 21.1 4 kinds of addresses Didn t have to specify the mask, because you could figure it out from the address. Exercise: what class does 200.201.202.203 belong to?
Address masks Q: Can you explain address masks a bit more? A: An address mask indicates with 1 bits the part of an address that is the network part. The 1 bits are all consecutive and at the left-most part of the address. Can be shown as /n first n bits are 1s which means the first n bits are the network part. E.g., Class C address 24-bit network part 255.255.255.0 /24 NOTE: masks only needed in classful addressing to indicate the subnet part.
Routers and masks Q: Does a router take in an IP address, mask it, then send it on to another network with the masked address? A: Masks are used in routing, but just to figure out what the network part of an address is. Masks are NOT sent in each IP header only src and dest IP addresses are there.
How to tell if a machine is on a network? A machine with address addr is on network N with mask M if addr & M == N N is 32-bit network address (host part all 0s) & is binary AND Could read this: if the network part of addr equals the network N. Exercise: is 153.106.129.33 on network 153.106.128 / 24 ? How about 153.106.128 / 17? Q: does every interface on a LAN have to have the same mask?
Subnet Addressing With classful addressing, if you got a class B address, you had 1 LAN with 2^16 hosts on it. What if you wanted 2 LANs? (Why would you?) Internally in your network, you could subdivide your LAN into multiple LANs (or subnets) using subnetting. Borrow some bits of the host part to indicate the subnet. 1 bit 2 LANs; 2 bits 4 LANs; etc. Now, you have to route between LANs in your organization. Now, every machine in your network has to know the netmask for the network so that it can figure out if another IP address is on its LAN or on another LAN.
Exercise BeatHope.com, LLC, needs IP addresses for 500 computers (and we still live in a classful addressing world) What class of IP addresses should they request? They want 3 subnets, for privacy/security: 30 machines on one subnet, 50 machines on another, 420 machines on the last. What subnetting scheme should they use? How does the world see BeatHope.com s network? I.e., what mask does the world use?
Classless Addressing What is the problem with having only class A, B, or C address blocks? If you need, say, 256 hosts (which is > 254), you need class B, which means ~65,200 wasted IP addresses What is the solution? Assign blocks of IP addresses to organizations based on any number of bits in the mask. (instead of just 8, 16, or 24 bits) e.g., 28 bit mask 2^4 2 hosts = 14 hosts. e.g., 23 bit mask 2 ^ 9 2 hosts = 510 hosts. Means many 23-bit IP address blocks can be given out to many companies, instead of 1 16-bit address block. Means far fewer wasted IP addresses and far more # of networks.
Example Tiny Corp wants a network with max 14 hosts. Network provider gives them 154.100.1.0/28 first 3 bytes have to be 154.100.1, top half of 4thbyte has to be all 0s. Hosts in the network will be from 154.100.1.1 154.100.1.14. Bcast address is 154.100.1.15 (all host bits are 1s). Joe s Pizza asks for and gets network 154.100.1.16/28. top half of 4thbyte is 0001. Hosts are 154.100.1.17 154.100.1.30. BubbleGumRUs has network 154.100.1.32/28 16 networks with 154.100.1/28 can be allocated
Do classes matter anymore? Q: In classless routing, do classes matter any more? A: Sort of. If you have what used to be a class B address (16-bit network part), then your network must have a mask of at least 16 bits. You can t just have 8 bits, because there are 2^8 networks with the same top 8 bits. In other words, from looking at an address alone, you can tell the mask must be >= some #.
Transition to CIDR Q: How did the transition to CIDR happen? What had to be done? A: Subnet masks were used internally within an organization already. With CIDR, masks needed to be used in ISPs (i.e., the Internet backbone) for proper routing. So, network masks needed to be advertised/distributed to all ISP routers along with the network numbers themselves. So, change in route propagation protocols (OSPF, RIP, BGPv4, etc.)
Watch out! One problem with masks that aren t 8, 16, or 24 bits is that IP addresses are still written 8-bits . 8-bits . 8-bits . 8-bits. E.g., In CS at Calvin, we have machines on 153.106.116.* and 153.106.117.* that are on the same LAN Hard to tell that from looking at the addresses alone. 116 = 0111 0100, 117 = 0111 0101 mask is /23 255.255.254.0. last 9 bits of the IP address are the host part.
Reuse of addresses Q: Can IP addresses be reused within a network? A: Yes. IP addresses within an organization are usually assigned with DHCP. These addresses are leased , and can be taken back and given to another machine.
Address depletion, sales, etc. Q: Can IP addresses be sold? A: I thought it was no , but it turns out it is yes . http://www.gtri.com/how-to-buy-or-sell-ipv4- addresses/ https://www.arin.net/resources/index.html https://www.iana.org/numbers
Special addresses Network address: all host bits in the address are 0s. Used in routing tables, etc. Directed broadcast address: all host bits in the address are 1s. when used as a destination address in a packet, it means the packet is routed to the destination network and then broadcast on it. Not done by routers today.
Special addresses (2) Limited broadcast address 32 1 bits. As a destination address, means send to all machines on the local Layer 2 network. Loopback address: 127.0.0.0/8 typically 127.0.0.1 Used to test your local TCP/IP stack or to send some packet back to yourself so another task can process it.
Multiple IP addresses on one machine? Q: Is it possible for a host to have more than one IP address? A: Yes! If a host has multiple routing interfaces then it must have multiple IP addresses. A router/host has to decide how to get a packet to its destination: can the packet be sent directly to its destination or does it have to go through a router to be forwarded? So, each interface has to have an IP address (and know the netmask) for the network it is on.
IP broadcast Q: How much is IP broadcast used? A: Limited broadcast is used when you have to reach every/any machine on this network. It is used for DHCP request ARP request
Universal Addressing Scheme Q: Apart from the fact that arbitrary pairs of application programs can communicate without knowing the type of network hardware, what are the other needs for a universal addressing scheme? A: That s about the only thing I can think of
Dotted-decimal notation Q: I still don't understand dotted decimal. Are we supposed to know how to convert from 32 bit to dotted decimal? If so how do I even begin to do that? A: An IP address is 4 bytes = 32 bits. One byte is a decimal number from 0 to 255. So, you convert each byte of the address to decimal and put a . between each part.
Non-computers have IP addresses? Q: The chapter talks about computers having IP addresses but do other devices like printers have them as well? A: Yes! Anything that needs to talk on the network needs to have an IP address.
No hierarchical structure? Q: Could the Internet have been designed with no hierarchical structure of IP addresses so none would be wasted? A: It could but it wouldn t scale. Packets are routed based on their network part only. This allows one routing entry for hundreds or thousands of hosts. Without a hierarchy, you d have to have an entry for every host.
Suffix not needed? Q: If you apply a mask to an IP address, you only see the prefix right? Why? Don't you need to know the suffix as well? A: The mask is applied to the address in a host or router when deciding how to route the packet. It is not applied anywhere else. And, routing is based on the network an address belongs to, so to make this decision, the host/router doesn t need to know the suffix.
Need for classless addressing Q: Can you explain the need for classless addressing? A: IANA began to see that lots of addresses were being wasted. If your company needed 300 addresses, you couldn t get a class C address (254 addresses max), so you got a class B, with 65534 addresses, most of which went unused. And, the number of class B networks was going down fast
Lots of IP addresses available? Q: Aren't there so many IP addresses available, that it would never matter if we were wasteful? A: No! The last set of addresses was given out by the IANA to a regional address registrar last year. We are now out of IP addresses.
More memory for CIDR? Q: Did it use a lot more memory to start storing a 32 bit mask along with every 32 IP address? A: The question is, where is this extra memory required? The IP packet header didn t change at all. Routing tables didn t change either because subnetting was available before CIDR. The only thing that changed is routing protocols, and they take more memory now, and the fact that ISPs can hand out non-/8, /16, and /24 blocks of addresses.
IP Address Reuse Q: Are IP addresses reused, and does a server store what IP addresses are being used and then know when one is no longer being used? A: IP addresses are re-used in a network that assigns them via DHCP. And, they could be reused in the Internet when one company s address block is not used anymore.
Switching algorithm in memory have a table that maps between port and mac address. receive frame on port n, with source mac smac and dest mac dmac. look up smac in table. Add entry if not there. Update entry if there, and port is not n. if dmac is bcast (all 1s), send to all ports, except n. look up dmac in table: if not there, send frame to all ports except n. If there, send frame to only port associated with dmac. go through all entries in table and remove old ones.
Practice questions Need a network with 2000 hosts. What class network would you get in the old days when we did classful networking? With classless addressing, your ISP would give you a network with what mask?
Practice questions (2) For network 200.201.220.16/28: how many hosts can you have? what is the broadcast address? what is highest IP address?
Practice (3) You get 153.106.96.0/20 from your ISP. How many bits for host part? What is the limited broadcast address? You want 16 subnets, so what is your internal subnet mask? What is the lowest host IP address for subnet 3 (starting with 0)?