The Journey of A Packet Through The Linux Network Stack
The Journey of A Packet Through The Linux Network Stack
and Applications
Kernel
BSD Sockets
Socket Interface
INET Sockets
TCP UDP
Protocol Layers
IP
ARP
Link Layers
PPP SLIP Ethernet
Network card
receives a frame
issues an Driver
interrupt handles the interrupt
•Frame RAM
•Allocates sk_buff
(called skb)
•Frame skb
CPU
calls core/dev.c:net_rx_action()
calls calls
ip_rcv_finish() route.c:ip_route_input()
Destination == local?
YES ip_input.c:ip_local_deliver()
NO Calls ip_route_input_slow()
ipv4/route.c:ip_route_input_slow()
Can forward?
•Forwarding enabled?
•Know route?
NO Sends ICMP
•/proc/sys/net/ipv4/conf/<device>/forwarding
•/proc/sys/net/ipv4/conf/default/forwarding
•/proc/sys/net/ipv4/ip_forwarding
IP TTL > 1
YES Decreases TTL
NO Sends ICMP
Kernel Route
Forwarding Information
Base
Miss
Fib_lookup () in
ip_fib_main_table
Miss
Drop packet
Basic networking
Ethernet
VLAN
Subnet, ARP
DHCP
IP
TCP/UDP/ICMP
Network Components
Switch ( packet swtiching vs flow)
Router ( vs Gateway )
Firewalls ( vs Iptables )
Load balancers ( vs Routers)
Tunnel technologies
Generally Known as Overlay
GRE
VXLAN
Why not ipsec?
Network namespaces
A way ( not only ) of scoping networking
functions and components.
VRF : multiple Gateway on the same router
at the same time
Openstack networking
Add more complexity
veth, openvswitch, linux bridge
Google’s Jupiter
192.1.1.202 eBGP
Compute node Routing Table
Default GW 192.168.1.1 eth1
Switch Namespace dhcp-server 192.1.1.201
iBGP
Host Route dest 10.10.100.2/32
to 10.10.100.1
process eth1
10.10.100.1
neutron-dhcp-
linux bridge agent
IP:10.10.100.2/ neutron-
32 linuxbridge-
agent
vm Routing Table
Default GW x.x.x.x eth0
GW
nova-compute
eth0 Controller
global name space
Flannel
Krnet 2016 kakaocorp
Scalable container network: Kakao’s
case
It has history
First approach was using docker libnetwork
Using Docker libnet
blog.midonet.org
BGP
Router
Router
Injector
Cluster