Networking Overview

warmersafternoonΔίκτυα και Επικοινωνίες

23 Οκτ 2013 (πριν από 3 χρόνια και 9 μήνες)

81 εμφανίσεις

Linux Networking
Overview

COMS W6998
-
5

Spring 2010

Outline


Layering in Networks


ISO Network Model


IP Network Model


Linux Kernel Outline


Network Subsystem Outline

Layer
-
Based Communication
Models

Instance (N)

Instance (N
-
1)

Application

Instance


(N+1)

Instance


(N+1)

Application

(N+1)
-
Protocols

(N)
-
protocol


(N
-
1)
-
protocol

Instance


(N+1)

Instance (N)

Instance (N
-
1)

Instance


(N+1)

Transmission medium

Transmission medium

Intermediate system

End systems

End systems

Layer (N
-
1)

Layer (N)

Layer (N+1)

Application

Application

Concepts in Layered Model


Protocols


Rules that two parties talk and understand each other


Horizontal interface


Services


Functions provided by a lower layer to the neighboring
upper layer


Vertical interface


Service interface (function calls)

ISO/OSI Reference Model

ISO/OSI Reference model

Application

Presentation

Session

Transport

Network

Data link

Physical


Application: Protocols for different
applications, HTTP, SMTP, FTP, etc


Presentation layer: Regulating data
presentation (formatting, ASN/1)


Session : Handling structured message
exchange, multiplexing sessions


Transport: End
-
to
-
end functions
between applications. Flow control,
packet ordering, etc.


Network: Connecting networks. Packet
routing/forwarding


Data link layer: Moving data between
two directly connected stations. Flow
control, error detection, etc. Shared
medium: access control. LLC/MAC


Physical: Media types, coding methods,
bit sequences vs. physical signals

ISO vs. The Internet

ISO/OSI reference model

Internet reference model

Application

Presentation

Application


(HTTP, SMTP, SSH)

7

6

5

4

3

2

1

Transport

(TCP/UDP)

Internet

(IPv4/v6)

Data link

(802.x, PPP, SLIP)

Session

Transport

Network

Data link

Physical

Design Principles


Optimize for the common case


E.g., TCP header prediction


Never touch/copy data


E.g., checksum offload


Mistakes can be made at each layer


Use common facilities at each layer


Buffer management, hash tables, timers


Use best
-
of
-
breed practices in these facilities

Kernel Structure

vim

apache

sshd

Shared C Library

System Call Interface

User

Kernel

Process
Mgmt

Memory
Mgmt

File
System

Device
Control

Network
Subsys

CPU
Support
Code

Hardware

MMU
Support
Code

CPU

RAM

Character
Devices

Network
Devices

Network
device
drivers

Character
device
drivers

Block
device
drivers

Block
Devices


Process management


Creating, destroying, putting to sleep, waking up, and
scheduling processes.


Memory management


Allocates memory to processes; maps virtual memory
to physical memory; enforces protection


File system


In UNIX, almost everything is handled over the file
system interface.


Device drivers can be addressed as files


/proc file system allows us to access data and
parameters in the kernel


Kernel Structure


Device drivers


Abstract away the underlying hardware and allow us to
access the hardware with well
-
defined APIs


The use of kernel modules allow device drivers to be
dynamically loaded/unloaded


Networking


Provides communication between end hosts


Incoming packets are asynchronous events and have
to be collected and identified, before a process can
handle them.


Many network operations occur asynchronously and
cannot be associated to a specific process. Instead,
interrupts and timers are used extensively.

Kernel Structure (2)

Kernel Structure

vim

apache

sshd

Shared C Library

System Call Interface

User

Kernel

Process
Mgmt

Memory
Mgmt

File
System

Device
Control

Network
Subsys

CPU
Support
Code

Hardware

MMU
Support
Code

CPU

RAM

Block
Devices

Character
Devices

Network
Devices

Network
device
drivers

Character
device
drivers

Block
device
drivers

COMS
W6998

Network Subsystem

System Call Interface

User

Kernel


Interrupts

Soft
IRQs

Lists

UDP

Wait
Queues

Hardware

Timers


Intel E1000

E1000
driver

Application


Intel E1000

Hash
Tables


Synch
&
Atomic
Ops

E1000
driver

Sockets

ip_proto

TCP

SCTP

data link layer

ARP

IPV4

IPV6

bridging

ICMP

sk_buff

net_device

U/K
copy

DMA

PCI

Mem
Alloc


Notifiers

VFS

sock

socket

Network
-
specific facilities


sk_buff
:


Core networking data structure for managing data (i.e.,
packets)


net_device:


Core data structure that represents a network interface
(e.g., an Intel E1000 Ethernet NIC).


proto_ops:


Data structure for different IP protocol families


SOCK_STREAM, SOCK_DGRAM, SOCK_RAW


Virtual functions for
bind()
,
accept()
,
connect()
, etc.


struct sock/ struct socket
:


Core data structures for representing sockets


Kernel facilities (1)


Timers


Facility for scheduling work in the future (e.g., retransmitting a
lost TCP segment)


Hash tables


Facility for creating associations (e.g., 4
-
tuple


TCP
connection block), looking them up, deleting them


User/kernel copying


Library for safely transferring data across the user/kernel
boundary


Memory allocation


Mechanism for the network subsystem to obtain memory
(e.g., pinned pages for arriving packets to land in)


Linked lists


What you think

Kernel facilities (2)


Atomic operations and synchronization


Mechanisms for managing concurrency correctly


Interrupts


Hardware interface for notifying OS of an event (e.g., a packet
arrival)


Soft IRQs


“Software interrupts” that are asynchronously executed in
response to a hardware interrupt


Wait Queues


Mechanism for processes/threads/tasks to wait for an event,
put themselves to sleep, or wake another process up


Notifiers


Publish/subscribe system for notifying other systems about an event
(e.g., interface goes down)

That’s the big picture…


Later lectures will delve into the details


Not enough time to cover everything


Suggestions about what to cover welcome


Or how to cover it


Bottom
-
up or top
-
down?


Use your project to cover something
interesting and/or important to you

For next week


Install a distribution inside a VM


Download/build/install the appropriate 2.6.31
kernel source in the VM


Enable kgdb, kprobes, oprofile, magic sysreq,
debugfs


If this is difficult for you, you probably are in
the wrong class..