Documente Academic
Documente Profesional
Documente Cultură
Christian Benvenuti
(christian.benvenuti@libero.it) [http://benve.info]
ICTP-ITU-URSI School on Wireless Networking for Scientific Applications in Developing Countries (5-23 February 2007, Trieste, Italy)
how to use binary operators? the difference between L2 and L3 addresses? the difference between L2 and L3 networks? how subnetting works? the difference between Routing and Switching? what NAT is and how it is used?
Agenda
Evolution of computer networks Protocol suites (ISO/OSI vs TCP/IP) Most common network device types (classified by
layers where they operate and functionalities)
L2 networks VS L3 networks Basic network design rules Basics on Addressing/Subnetting Common Network Services Where does Linux fit into the network?
10 Years ago:
Can the use of th e network come useful to this problem? Is there a valid reason not to use the network to address this problem? I can't imagine a world without the network!
Today:
Future
Application
ISO-OSI
TCP/IP
Ethernet
Need of rules Need to reduce the design complexity Distinction between the functions of the upper and lower layers Peer-2-Peer communication + encapsulation
Layer i+1
RX TX
Layer i+1
RX
Transmission media
TCP/IP
MAC
TCP/IP
Collision free
Static (TDMA, ...) Dynamic (Token, Bitmap, ...) CSMA [p-persistent] /CD
TCP/IP
Fragmentation/Defragmentation ...
Network Data Link Physical
MAC MAC
TCP/IP
(Logical) Connection multiplexing Flow control Error detection (data corruption) ... Most common transport protocols:
Transport Network Data Link Physical
MAC MAC
TCP/IP
This is the layer where the applications users interface with are located.
TCP/IP
QoS
Flow-Control
Security
QoS
NAT/PAT
Size
Local Area Network (LAN) Metropolitan Area Network (MAN) Wide Area Network (WAN) The Internet
MAN
WAN
Internet
IPv4 Ethernet
Wired LANs
Ethernet
Fast/Giga/10-Giga
Wireless LANs
802.11b, ... <this will be the focus of the next three weeks> Its younger brother IPv6 is not yet as widely used as IPv4.
Ethernet 00:E0:00:8D:6B:82
Ethernet frame
Ethernet 00:E0:00:F5:6D:EE
LAN
Network (Ipv4)
IPv4
10.0.1.1
DST: 10.0.1.2 SRC: 10.0.1.1
Data-Link (Ethernet)
IPv4
10.0.1.2
Ethernet 00:E0:00:8D:6B:82
Ethernet 00:E0:00:F5:6D:EE
LAN
Network (IPv4)
Please transmit this data to the address 10.0.1.2
Data-Link (Ethernet)
IPv4
10.0.1.1
Please transmit this data to the address ?????????
IPv4
10.0.1.2
Ethernet 00:E0:00:8D:6B:82
Ethernet 00:E0:00:F5:6D:EE
LAN
Network (Ipv4)
IP addr 10.0.1.2 Ethernet addr OO:E0:00:F5:6D:EE
Data-Link (Ethernet)
ARP Cache
IPv4
10.0.1.1
IPv4
10.0.1.2
Ethernet 00:E0:00:8D:6B:82
Ethernet 00:E0:00:F5:6D:EE
DST: 00:E0:00:8D:6B:82 DST: FF:FF:FF:FF:FF:FF SRC: 00:E0:00:F5:6D:EE SRC: 00:E0:00:8D:6B:82 ARP: 10.0.1.2 is at 00:E0:00:F5:6D:EE ARP: Who is 10.0.1.2?
LAN
Fragmentation is needed each time the size of the block of data (PDU) a layer needs to transmit exceeds the maximum size handled by the lower layer. There are good reasons to avoid fragmentation whenever possible
TCP
Basic hdr: 20 Bytes Min: / Max: /
UDP hdr
Min: /
IPv4
Ethernet
Min: 64 Bytes
ETH PAD
Binary numbers
(MSB) 8th 7th 6th 5th 4th 3rd 2nd 1st (LSB)
xxxxxxxx
20= 1 21= 2 22= 4 23= 8 24= 16 25= 32 26= 64 27=128 Binary 00000000 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000 Decimal Hex 0 1 2 4 8 16 32 64 128 0x00 0x01 0x02 0x04 0x08 0x10 0x20 0x40 0x80 A 28= 256 29= 512 210= 1024 211= 2048 212= 4096 213= 8192 214=16384 215=32768 216=65536 Binary 00000000 00000001 00000011 00000111 00001111 00011111 00111111 01111111 11111111
Decimal Hex 0 1 3 7 15 31 63 127 255 0x00 0x01 0x03 0x07 0x0F 0x1F 0x3F 0x7F 0xFF
B Binary 11111111 11111110 11111100 11111000 11110000 11100000 11000000 10000000 00000000
Decimal Hex 255 254 252 248 240 224 192 128 0 0xFF 0xFE 0xFC 0xF8 0xF0 0xE0 0xC0 0x80 0x00
Binary operators
AND
0 1
0 0 0
1 0 1
OR
0 1
0 0 1
1 1 1
There are many more but we need only those two in this class
32 bits
XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX
XXXXXXXX
XXXXXXXX
Given an IP address, the netmask (and the broadcast) address is derived from its class (but you can change both) Public VS Private addresses Unicast, Multicast, Broadcast addresses
Reserved X X X X X X X X addresses
#Networks #Hosts per network 127 16.777.216 16.129 65.536 2.097.152 256
IP addr: 140.105.16.50
Private Addresses
10.0.0.0/8 172.16.0.0/16
1 x Class A 16 x Class B
10 = 0 0 0 0 1 0 1 0 172 = 1 0 1 0 1 1 0 0 192 = 1 1 0 0 0 0 0 0
The use of broadcast and multicast addresses is a convenient way for sending a packet to multiple recipients (link layer protocols use them too).
A broadcast message is addressed at all the hosts of a given network (or subnet).
A multicast message is addressed at those hosts that subscribed to the associated multicast group.
Network address
The broadcast is built (by default) by setting to 1 all the bits of the host address
Host address
Network address
1 1 1 . . . . . . . . . . . .1
Subnetting
Network address
Subnet address
Host address
It is no longer needed to use the default netmask derived from the class (i.e., /24, /16, /8)
The IP address and the associated netmask together tell you what other (neighbor) IP addresses are directly connected (i.e., only 1 hop away).
LAN
192.168.1.100/24
192.168.1.100/24
Subnet address: 192.168.1.0/24 Network address: 192.168.1.0 Default broadcast: 192.168.1.255 Range of addresses: 192.168.1.1 ... 192.168.1.255 #Hosts: 256-2 = 254
... LAN
Subnet address: 192.168.1.0/24 Network address: 192.168.1.0 Default broadcast: 192.168.1.255 Range of addresses: 192.168.1.1 ... 192.168.1.255 #Hosts: 256-2 = 254 Subnet address: 192.168.1.0/25 LAN1 Network address: 192.168.1.0 Default broadcast: 192.168.1.127 Range of addresses: 192.168.1.1 ... 192.168.1.123 #Hosts: 128-2 = 126 Subnet address: 192.168.1.128/25 LAN2 Network address: 192.168.1.128 Default broadcast: 192.168.1.255 Range of addresses: 192.168.1.129 ... 192.168.1.255 #Hosts: 128-2 = 126
... LAN1
... LAN2
Routing is the action needed to make it possible for hosts located in different subnets to communicate A Router is a network device that routes traffic. A routing table is a collection of routes that define how to reach a given network/subnet. A basic router routes traffic based on the destination address
Example
NOTE: Depending on the router type, forwarding may need to be explicitly enabled Routing table Destination 192.168.1.0/24 192.168.2.0/24 192.168.1.1/32 192.168.2.1/32 Next-hop <direct> <direct> <local> <local> Interface eth0 eth1 <lo> <lo>
192.168.1.X/24 A
LAN 1 eth0 192.168.1.100 eth0 192.168.1.200
/25
ROUTER
eth0 192.168.1.1 eth1 192.168.2.1 eth0 192.168.2.150 LAN 2
B
Destination Next-hop Interface 192.168.1.0/24 <direct> eth0 192.168.1.200/32 <local> <lo>
C 192.168.2.X/24
Routing table
Default routes
A default route is used when there is no explicit route toward a given destination address. You can configure more than one default route (however it is not a common scenario) While hosts always use default routes, routers rarely do.
The Internet
Subnet 192.168.1.0/24
eth0: 192.168.1.10/24 ...
eth0: 192.168.1.1/24
Destination
Next-hop
Interface
Exercise
A
192.168.1.10/24
eth0
D
192.168.1.11/25
eth0:
C
eth0: 192.168.2.11/24
Summarization
Router
Router
Subnetting
Summarization
Example of summarization
10.0.1.0/24
eth0 10.0.1.2 ... eth0 10.0.1.1
ROUTER A
Next-hop Interface <direct> eth0 10.0.1.1 eth0 10.0.1.1 eth0 10.0.1.1 eth0 10.0.1.1 eth0
ROUTER B
eth4
eth3
eth2
eth1
Destination Next-hop Interface 10. 0.1.0/24 <direct> eth0 192.168.0.0/22 10.0.1.1 eth0 ...
192
11000000
. . .
168
10101000
. . .
0
000000 00
. . . . .
Host
0
00000000
192
11000000
168
10101000
1
000000 01
0
00000000
192
11000000
168
10101000
2
000000 10
0
00000000
192
11000000
168
10101000 Network
3
000000 11
0
00000000 Host
192
168
10101000
0
0
00000 00
0
00000000
11000000
Routing
Dynamic routing may be used anyway to provide some kind of high availability (to handle router failures)
Depending on the size of the network and your exact requirements, different protocols are available for the job.
Routing VS Switching
L3 Routing tables
VS L2 Forwarding databases
L3 Routing protocols VS L2 Spanning Tree The hierarchical configuration model (access, distribution, core) applies to both. Do not associate switching with the low-end 4-port switches! Spanning Tree Protocol/s Virtual LANS (VLANS) ...
HUB
Port 1
Port 2
Port 3
Port 4
Bridge
BRIDGE
Port 1 Port 2
HUB1
Port 1 Port 2 Port 3 Port 4 Port 1 Port 2 Port 3
HUB2
Port 4
A1
B1
C1
A2
B2
C2
Case 1 Case 2
Case 3
Can A1 talk to A2 while C1 talks to D1? Can A1 talk to B1 while A2 talks to B2? Can A1 talk to B1 while C1 talks to C2?
SWITCH
Port 1
Port 2
Port 3
Port 4
HUB1
Port 1
Port 2
Port 3
Port 4
BR1
Port 1 Port 2
Port 1 Port 2
BR2
HUB2
Port 1
Port 2
Port 3
Port 4
Port 5
A2
B2
C2
VERY IMPORTANT
You know (very well) what you are doing You rely on a protocol like the Spanning Tree to disable the redundant links
Distribution
D1
D2
Access
A1
A2
A3
A4
PC1
PC2
PC3
PC4
PC5
PC6
PC7
PC8
192.168.1.0/24
.1 .100 ...
Let's see how the host accesses the WEB server ... step by step ...
Any questions?
Copyright
Creative CC Commons
Attribution
Noncommercial.
Share Alike.