
































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

































โ Two machines can talk to each other โ Each machine has a network interface โ Network interfaces can be connected directly to each other via network cable โ Each network interface has a Media Access Control (MAC) address (AKA hardware address) โ MAC addresses look like this: 50:46:5d:54:94: โ MAC addresses are globally unique (at least in theory) โ Data is sent in chunks called โframesโ โ Each frame has a source and destination MAC address
โถ ifconfig enp3s enp3s0 Link encap:Ethernet HWaddr 50:46:5d:54:94: inet addr:192.168.1.30 Bcast:192.168.1.255 Mask:255.255.255. inet6 addr: fe80::5246:5dff:fe54:9423/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric: RX packets:48241295 errors:0 dropped:0 overruns:0 frame: TX packets:24083899 errors:0 dropped:0 overruns:0 carrier: collisions:0 txqueuelen: RX bytes:49741929087 (49.7 GB) TX bytes:2925004440 (2.9 GB)
โถ ip a show dev enp3s 2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 50:46:5d:54:94:23 brd ff:ff:ff:ff:ff:ff inet 192.168.1.30/24 brd 192.168.1.255 scope global enp3s valid_lft forever preferred_lft forever inet6 fe80::5246:5dff:fe54:9423/64 scope link valid_lft forever preferred_lft forever
โ Machine A wants to talk to Machine B โ Machine A has IP 192.168.0.1 and MAC aa:aa:aa:aa:aa:aa โ Machine B has IP 192.168.0.2 and MAC bb:bb:bb:bb:bb:bb โ Machine A sends a frame like this: โ Source MAC: aa:aa:aa:aa:aa:aa โ Destination MAC: ff:ff:ff:ff:ff:ff โ Data: โWho has 192.168.0.2? Tell 192.168.0.1!โ โ Machine B responds with a frame like this: โ Source MAC: bb:bb:bb:bb:bb:bb โ Destination MAC: aa:aa:aa:aa:aa:aa โ Data: โ192.168.0.2 is at bb:bb:bb:bb:bb:bb!โ โ Both machines store the IPs and corresponding MACs in their Address Resolution Protocol (ARP) cache for future use
โ Machine A wants to talk to Machine B again โ This time Machine A can find the MAC address in its ARP cache โ Machine A sends a frame that looks like this: โ Source MAC: aa:aa:aa:aa:aa:aa โ Destination MAC: bb:bb:bb:bb:bb:bb โ Data: โฆ โ Inside the data is an IP โpacketโ, which looks like this: โ Source IP: 192.168.0. โ Destination IP: 192.168.0. โ Data: โฆ โ The data in the last slide was actually an ARP Packet โ Why a MAC and an IP? โ Machines can have more than one IP addressโฆ And other reasons too
โ More than two machines can be connected to a hub โ A hub is pretty dumb โ It just sends everything it receives back out to all ports โ Machines ignore frames not intended for them so everything is (mostly) fine โ Everything that worked for two machines works exactly the same way โ But: โ Itโs slow (10Mbit, 100Mbit if youโre lucky) โ You get collisions (machines trying to talk over each other) โ We can do better
โ Machines can only directly send IP packets to machines on the same network โ Soooโฆ How do we define what a network (technically a sub-network) is? โ As well as an IP, each machine has a subnet mask โ They look like this: 255.255.255. โ The subnet mask is used in combination with a source and destination IP to decide if they are on the same subnet or not โ Itโs actually much easier to understand in binary!
โ It gets a little tiresome specifying the IP and the subnet mask โ You can use Classless Inter-Domain Routing notation instead โ Count the number of 1s in the subnet mask!
10.0.0.1/255.255.255. 00001010.00000000.00000000.00000001/11111111.11111111.11111111. 10.0.0.1/
โ To send a packet to a machine on another subnet the frame is sent to a router โ A router usually has more than one network interface (and MAC address) โ A router always has more than one IP address (at least one per subnet) โ Machine A (subnet one): โ MAC: aa:aa:aa:aa:aa:aa โ IP: 192.168.0.1 / 255.255.255. โ Machine B (subnet two): โ MAC: bb:bb:bb:bb:bb:bb โ IP: 192.168.1.1 / 255.255.255. โ Router (both subnets): โ MAC1: cc:cc:cc:cc:cc:cc โ IP1: 192.168.0.254 / 255.255.255. โ MAC2: dd:dd:dd:dd:dd:dd โ IP2: 192.168.1.254 / 255.255.255.
โ Machine A sent the frame to its default gateway as a last resort โ It might have had another option in its routing table :
Network Subnet Mask Gateway 0.0.0.0 0.0.0.0 192.168.0. 192.168.1.0 255.255.255.0 192.168.0. 192.168.2.0 255.255.255.0 192.168.0.
โ With this table the MAC for 192.168.0.253 would have been the destination โ Multiple networks connected via routers form what we call the internet :)