Docsity

Ethernet and IP, Lecture notes of Computer Networks

Partial preview of the text

Download Ethernet and IP and more Lecture notes Computer Networks in PDF only on Docsity!

Ethernet and IP

A slightly less introductory networking class

Drew Saunders

Networking Systems

Stanford University

Goals of Class

• Slightly more in-depth knowledge of Ethernet.

• Internet Protocol, TCP, UDP, ARP, ICMP.

• IP addressing, subnet masks.

• Some troubleshooting of ethernet and IP problems.

Our friend, the 7-layer

networking model.

DOD 3-layer model

Application

Protocol

Local Network (LAN)

Simplified 4/5-layer model

Transport Network Data Physical

Application

OSI 7-layer model

Application Presentation Session Transport Network Data 1 Physical

2

3

4

5

6

7

OSI (Open Systems Interconnection) mnemonic:AllPeopleSeemToNeedDataProcessing We’ll be using the “simplified model,” and talking mostly about the Network (IP) and Transport (TCP and UDP) layers, plus a little about Data (Ethernet details). Although not strictly correct, people tend to call everything from layer 4 down a “packet.”

Bits

Frames

Packets

Segments

Data

Data Unit Name

Cables, Microwaves

Switches, Hubs, WAPs

Routers, Firewalls

Software, Firewalls

Applications

What “lives” here?

Networking layers compared to

the postal system.

  • What are you sending?^ (Application)
  • Where am I going?^ (Addressing, DNS)
  • How do I get there?^ (Routing)
  • What am I packaged in?^ (Network, Data)
  • What carries me?^ (Data, Physical)
  • What are the traffic rules on my road/train/flight?

(Data, Physical)

More on Ethernet

  • Preamble: 64 alternating 0’s and 1’s to synchronize the computers.
  • Destination: 48-bit^ (usually done as 12 hex characters)^ address of the intended receiver, all 1’s (FFFF...) for broadcast.
  • Source: Your own HW address.
  • Type: Ethernet II is the only type really used any more, there are 3 others for legacy Layer 3 protocols (Appletalk, IPX, etc.)
  • Data: The contents, which aren’t the concern of the ethernet layer, but are to be handed off to the next layer.
  • CRC: Cyclic Redundancy Check. When the computer builds the packet, it does some math based on the packet (which is, after all, just 0’s and 1’s) and puts the result of that calculation at the end. If the receiver does the same math and gets a different result, the packet is rejected and an error is sent back to the sender.
Data

Source HW Addr

Dest. HW Addr.

CRC Error Preamble Type Checking

Common Ethernet Problems

  • Physical layer: Is the cable plugged in? Is it broken? Did someone run their chair over it for the last time? “It worked fine yesterday!”
  • Speed mis-match. Most modern computers and network equipment can speak at either 10Mbps or 100Mbps or 1000Mbps, but each end has to agree. Auto-negotiation may fail, so one end or both may have to be forced to a specific speed.
  • Duplex mis-match. Most modern computers and network equipment use full duplex only (they can send and receive at the same time), older equipment may be half duplex (send or receive). Duplex mis-matches don’t cause the link to be down, but cause a lot of chopped up data and retransmits and slowness.
  • MDI/MDIX^ (Medium Dependent Interface^ (Crossover))^ problem. When connecting a switch to switch, or computer to computer, you usually need to use a crossover cable, otherwise, you have transmit “talking” to transmit, and receive “talking” to receive. Auto-MDIX can allow you to use a regular cable, but doesn’t always work.

IP Addressing

  • IP addresses are in the form of 4 octets^ (32 bits), each from 0-255.
    • IPv6 uses 128 bits and is expressed in hex.
  • Like phone numbers, they go from general to specific as you go left to right
    • But unlike phone numbers, the “area code” can be of variable size.
  • 171.64.20.23^ (the host “networking.stanford.edu”), 171.64. means “Stanford.edu” 20. means “Networking group subnet” and .23 means “networking.”
  • The division between network, subnet and host is determined by subnet masks and CIDR prefixes. Your host needs to be told its subnet mask.
  • There used to be a way of determining network size by network “Class.” Classes were A, B, C, D. Nobody uses “classful” routing any more, everything is done as “classless” routing. CIDR is “Classless Inter-Domain Routing” and is pronounced like the apple beverage.

Subnet Masks

  • From a networking point of view, your host knows only two things: “Local to my net” and “give it to the router.”
  • The subnet mask tells your host whether another IP number is “Local” or “The Router’s Problem.” It draws the line in the sand for you.
  • Subnet masks are also in the form of four octets, but you’ll generally see them in the form of 255.255.255.0 or something like that.
  • Convert the subnet mask to binary, you’ll have a string of 32 digits, a long series of 1’s, followed by a series of 0’s. Where the 1’s end and the 0’s begin is your subnet boundary. 255.255.254.0 is 23 “1’s” then 9 “0’s.”
  • If your subnet mask is wrong, you may send things “locally” that belong to the router, which will probably fail, or send things to the router that are local, which will work but is excess work for the router.

CIDR Prefix to Subnet Cheat-sheet

for common Stanford network sizes

“Usable” IP numbers?

  • In any subnet, at least 3 IP numbers are taken up. The network itself takes the “bottom” number. In the case above, 171.64.20.0 is the IP number that designates the network itself.
  • Just like in ethernet, we need a way to talk to everyone all at once, and that’s a broadcast. That’s the “top” number, or 171.64.21.255 in the example above.
  • If you want to ever be able to send IP packets to another network, you’ll need a router, and it needs at least one IP number (and often more). At Stanford, we use the “network+1,” so 171.64.20.1 is the router for 171.64.20.0/23. The router can have any IP number, but most people use one near the bottom or top of the network range. - Cisco HSRP^ (Hot-Swappable Router Protocol)^ uses two routers that “share” the one IP number, so .1 would be for the active router, while. and .3 are the actual two routers. If the active .1 “dies” the other takes over that address.

Let’s do some subnet math!

Tape up your glasses and tuck in your pocket protectors!

  • Your host, 172.31.12.20 is on a /27 network. Is 172.31.12.40 on your net?
  • Convert 172.31.12.20 to binary, convert 172.31.12.40 to binary.
    • 10101100.0001111.00001100.00010100^ and 10101100.0001111.00001100.
  • Write 27 1’s in a row, fill out the rest of the 32 bits with 0’s, divide into 4 8- bit segments to make it easier to follow. - 11111111.11111111.11111111.
  • Where the 1’s end and the 0’s begin on the subnet mask, if everything to the left is the same, then it’s the same subnet. If there’s any difference, then it’s not the same subnet, and you pass those packets on to the router.

Stanford’s IP numbers

IP range CIDR Prefix Netmask Use

128.12.0.0 /16 255.255.0.0 Dorms

171.64.0.0 /14 255.252.0.0 Stanford’s main IP range

171.64.0.0 /16 255.255.0.0 Used for main campus

171.65.0.0 /16 255.255.0.0 Medical Center, Hospital

171.66.0.0 /16 255.255.0.0 Remote, DSL, Modems, some departments

171.67.0.0 /16 255.255.0.0 Main campus, large blocks

68.65.160.0 /21 255.255.248.0 Cable Modem

204.63.224.0 /21 255.255.248.0 Livermore Auxiliary Data Center

See this list and more athttps://www.stanford.edu/services/lnaguide/lnasonly/net_numbers.html

IPv

  • IPv6 is IP Protocol version 6, as opposed to the current IPv4.
  • IPv4 provides ~4.3 billion IP numbers^ (4,294,967,296 to be exact), but there’s a lot of inefficiency, plus a lot of demand. IPv6 provides 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses. That should be sufficient for a very long time.
  • IPv4 is out of assignable IP number blocks. The main benefit of IPv6 is a (hopefully) inexhaustible quantity of IP numbers. The main problem with IPv6 is translating between IPv4 and IPv6. As there is no entity that can demand that IPv4 no longer be routed, organizations will have to route both IPv4 and IPv6 or tunnel or translate for many years.
  • IPv6 uses CIDR prefixes, just like IPv4. Stanford’s IPv6 range is 2607:F6D0::/32, which provides for 2^96 numbers (a whole lot). We’ll allocate subnets as /64, or 2^64 numbers (still quite a bit). Pine Hall, where we’re testing IPv6 is using 2607:f6d0:c001::/64.
  • We don’t expect to be needing to do much with IPv6 at Stanford, but are ready when the demand arises.

NAT (Network Address Translation)

  • NAT, Network Address Translation, allows devices^ (usually routers, sometimes special NAT-only devices) to associate one public IP number with one or more private IP numbers.
  • NAT is one of the main reasons why IPv4 has lasted as long as it has and IPv6 isn’t as popular.
  • At Stanford, we use 10.32.0.0/15 for main campus wireless, which we then associate through NAT with a real 171.66.x.x IP range. This allows us to handle the ever increasing number of wireless users.
  • At Stanford, for wireless guest, we use NAT to associate the small public IP range of 68.65.169.128/25 with the huge internal IP range of 10.22.0.0/16.