Tech

TCP/IP Basics–The World of TCP/IP–NETWORKING, SECURITY, & MORE ESSENTIALS—CompTIA Network+ (N10-007) NETWORK-PLUS Certification Prep Course Notes

TCP/IP BASICS

  • Intro to IP Addressing & Binary
    • Each computer on a TCP/IP network must have a unique IP address.
    • IPv4 addresses are written as four octets, such as: 192.168.4.12
    • Each octet represents a binary string;
      • 192, for example, is represented by 11000000
    • Dotted decimal notation–shorthand used to represent the 32 1’s & 0’s.
    • 28 (256) combinations
    • Each octet is valued between 0 and 255.
    • Converting from binary to dotted decimal:
  • Intro to ARP
    • APR (Address Resolution Protocol) resolves IP addresses.
    • ARP is what a computer uses when it knows the IP address, but needs the MAC address.
    • Type ‘arp -a’ to see the ARP cache (shows a list of the IP addresses & the MAC addresses).
    • ARP requests are broadcast over a network
  • Subnet Masks
    • Each host needs a subnet mask.
    • The host uses the subnet mask to know if the destination is on the local network or a remote network.
    • Each host knows the default gateway so that it can forward traffic to remote networks. The default gateway will figure out where to forward the message.
    • Network ID–the part of the network numbering system that has to be identical for every computer/device on that network.
    • Host ID–the part that changes for each individual computer/device.
      • Cannot use 0 or 255 for the Host ID; can use any number from 1 to 254.
        • Note: Subnets CAN end in 0 or 255.
    • Note: The subnet mask is only used by the computer–it is never sent out.
    • Note: Usually the subnet mask gets smaller for really huge networks & longer (like a /24 [“whack 24”] for smaller networks).
    • *Remember: When working with computers the most important thing to remember is:
      1. You’re going to have to have an IP address.
      2. You’re going to have to have a subnet mask.
      3. You’re going to have to have a default gateway (aka your router!!!)
  • Classful Addressing
    • Remember, the most important thing to remember about the internet is that every single computer on the internet HAS to have a real IP address!
    • Classful subnetting was the first effor to divide network ID’s.
    • Class A, B, & C licenses.
    • Memorize the first octet to know your class licenses!
    • The IANA (Internet Assigned Numbers Authority) keeps track of all the IP address & delegates them as needed.
    • The IANA passes numbers/(IP addresses) to RIR
    • RIRRegional Internet Registry–worldwide network broken up geographically
      • AfriNIC (African Network Information Center)
      • APNIC (Asia Pacific NIC)
      • ARIN (American Registry for Internet Numbers)
      • LACNIC (Latin American & Caribbean NIC)
      • RIPE NCC (Reseaux IP Europeans Network Coordination Centre)
    • The RIRs then pass out chunks of IP addresses to ISPs. (Internet Service Providers)
    • ISP’s then pass off IP address to consumers.
    • Class licenses” were used to organize all of this.
      • Class A 0-126 /8 (Any number from 0 to 126, “wack 8”)
        • ex: 14.0.0.0 (can be used to create about 16.7 million different combinations for IP addresses!) (Comcast or other big customers.)
      • Class B 128-191 /16 (Class B starts with 128 up to 191 and are “wack 16” addresses.)
        • Class B creates about 65,534 IP addresses.
      • Class C 192-223 /24 (Class C always starts with a 192 up to a 223, and are always “wack 24’s”. ex: 193.44.16 /24
      • So we can always identify a Class A, B, or C simply by memorizing the first number in the octet!
      • Subnetting divides Network IDs into two or more networks.
      • Subnets don’t have to be on the “dots” of the dot notation.
  • Subnetting With CIDR
    • CIDR (Classless Inter-Domain Routing) pronounced “cider”.
    • Subnet masks have all 1’s on the left and all 0’s on the right.
      • Remember, the dotted decimal notation system is just for humans to better read the info. The computers just see a long string of 1’s & 0’s.
    • The more subnets you have, the less hosts are available.
    • CIDR has been around since the 90’s, it’s a powerful & complicated tool.
      • CIDR gives more granular control over how we take one subnet & chop it up into lots of little subnets.
    • We, as individual consumers, don’t do a lot of subnetting ourselves, BUT we enjoy the benefits of it. Subnetting is most commonly done by ISPs.
    • REMEMBER, subnets don’t have to be all 255s & 0s.
      • Subnets have to be a string of ones (1’s) followed by a string of 0’s!
    • Also, remember, that the more you subnet something, the less hosts you have.
      • 2 subnets, 126 host per sub
    • Dynamic vs Static IP addresses
    • /24 (“wack 24”) = 254 hosts
      • Subnet Mask- /24 = 254 possible IP addresses
    • Knowing the number of hosts you need helps determine how small of a CIDR subnet would be needed.
      • /25 = 126 hosts (or 27 = 128-2 = 126 (We subtract 2 because you can’t use all 0’s or all 1’s as a real address, remember!)
      • /26 = 62 hosts (26 = 64-2 = 62)
      • /27 = 27-1’s followed by 5-0’s; so 25 = 32-2 = 30 hosts
      • /28 = 14 host (24 =16-2 = 14)
      • /29 = 6 hosts (23 = 8-2 = 6)
      • /30 = 2 hosts (22 = 4-2 = 2)
      • /31 = 0 hosts (21 = 2-2 = 0)
    • It’s really important that if we remember our subnet sizes, we can pretty much instantaneously know the number of possible hosts!
    • The ISP should provide the numbers of the subnet mask & Network ID.
  • Dynamic & Static IP Addressing
    • Each broadcast domain must have only one DHCP server.
    • Every modern operating system comes with DHCP enabled by default.
    • DHCP Relay enables a single DHCP server to service more than one broadcast domain.
    • DHCP & BOOTP (Bootstrap Protocol)–Linux
    • Process ex:
      • DHCP Discover broadcast message (Remember, broadcast is a MAC address of all F’s!) sent by DHCP client (computer).
        • Looking for DHCP server somewhere on the network.
      • The DHCP server will receive the ‘Discover’ broadcast message & send back a DHCP Offer (as a unicast message back to the client directly).
        • all the info needed (the IP address; the subnet mask; the default gateway; and other info)
      • The requesting client computer will receive the offer and then send a DHCP Request back to the DHCP server. (Basically saying ok, I’ll use that info!)
      • Once the DHCP server gets the request, he sends a ‘DHCP Acknowledge‘ back to confirm and stores all this info & keeps track of along with all the other clients on the network that are using DHCP.
      • The important part to remember is that for all this to happen, a DHCP server is needed! (Almost all home routers now include this already built-in.)
      • Notes:
        • Each broadcast domain must have only one DHCP server.
          • We DON’T want 2 servers responding to requests with different info!!!)
        • DHCP server has to be run within broadcast domain. (It can’t be located outside of the network, (unless using a DHCP relay!).)
  • Rogue DHCP Servers
    • If you get an APIPA (Automatic Private IP Addressing) address, check to see if you are connected to a DHCP server.
    • If you are connected to a DHCP server, and still get an APIPA address, make sure the DHCP server is working.
    • If you get an IP address other than your correct network ID, you may have a rogue DHCP server.
    • All DHCP problems manifest the same way; you open a browser & can’t access the internet, because you don’t have a valid IP address, or default gateway or DNS.
    • APIPA–built into all DHCP clients; designed as a fallback if you can’t find a DHCP server.
    • APIPA addresses always start with 169.254.
  • Special IP Addresses
    • Special internal IP addresses are: ’10.x.x.x’ , ‘172.16.x.x’ – ‘172.31.x.x’ & ‘192.168.x.x’.
    • The loopback address for IPv4 is ‘127.0.0.1’ and the loopback address for IPv6 is ‘::1’.
    • *An APIPA address (‘169.254.x.x’) indicates the DHCP server is down!!!
  • IP Addressing Scenarios
    • ‘ipconfig’ (Windows) and ‘ifconfig’ (Linux) display the IP address information.
    • Virtual machines can be a source of duplicate MAC address errors.
    • All the computers in one broadcast domain have the same subnet mask.