SEP Packet Capturing Using the Linux Netfilter Framework Ivan Pronchev pronchev@in.tum.de



Similar documents
Network packet capture in Linux kernelspace

Operating Systems Design 16. Networking: Sockets

IMPROVING PERFORMANCE OF SMTP RELAY SERVERS AN IN-KERNEL APPROACH MAYURESH KASTURE. (Under the Direction of Kang Li) ABSTRACT

IP Layer Implementatoin of Linux Kernel Stack

Netfilter s connection tracking system

VENKATAMOHAN, BALAJI. Automated Implementation of Stateful Firewalls in Linux. (Under the direction of Ting Yu.)

Introduction to Linux Virtual Server and High Availability

Lab 6: Building Your Own Firewall

AIR FORCE INSTITUTE OF TECHNOLOGY

A Research Study on Packet Sniffing Tool TCPDUMP

RFC 2544 Performance Evaluation for a Linux Based Open Router

Intro to Linux Kernel Firewall

An Approach for Network Forwarding Systems Quality

Red Hat Linux Internals

Xinying Wang, Cong Xu CS 423 Project

Linux Driver Devices. Why, When, Which, How?

A SIMPLE WAY TO CAPTURE NETWORK TRAFFIC: THE WINDOWS PACKET CAPTURE (WINPCAP) ARCHITECTURE. Mihai Dorobanţu, M.Sc., Mihai L. Mocanu, Ph.D.

Linux Firewall Lab. 1 Overview. 2 Lab Tasks. 2.1 Task 1: Firewall Policies. Laboratory for Computer Security Education 1

Linux Kernel Networking. Raoul Rivas

Packet Capture, Filtering and Analysis

Open Source Traffic Analyzer

KVM Architecture Overview

How to replicate the fire: HA for netfilter based firewalls

ct_sync: state replication of ip_conntrack

Bandwidth Management in MPLS Networks

Lab VI Capturing and monitoring the network traffic

Firewalls. Chien-Chung Shen

Linux LKM Firewall v 0.95 (2/5/2010)

Linux Software Router: Data Plane Optimization and Performance Evaluation

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

IgH Master Documentation

Network forensics 101 Network monitoring with Netflow, nfsen + nfdump

How To Monitor And Test An Ethernet Network On A Computer Or Network Card

Improving Passive Packet Capture: Beyond Device Polling

Presentation of Diagnosing performance overheads in the Xen virtual machine environment

Monitoring high-speed networks using ntop. Luca Deri

Assessing the Performance of Virtualization Technologies for NFV: a Preliminary Benchmarking

Software Datapath Acceleration for Stateless Packet Processing

Optimizing Point-to-Point Ethernet Cluster Communication

Enabling Linux* Network Support of Hardware Multiqueue Devices

Network Administration and Monitoring

Linux Virtual Server Tutorial

OpenBSD. network stack internals

Improving Passive Packet Capture: Beyond Device Polling

Tracing your virtual machines

Linux Networking Stack

The Performance Analysis of Linux Networking Packet Receiving

Wire-speed Packet Capture and Transmission

HONE: Correlating Host activities to Network communications to produce insight

Performance of Software Switching

Load Balancer Comparison: a quantitative approach. a call for researchers ;)

The Lagopus SDN Software Switch. 3.1 SDN and OpenFlow. 3. Cloud Computing Technology

Netfilter / IPtables

Operating Systems. Design and Implementation. Andrew S. Tanenbaum Melanie Rieback Arno Bakker. Vrije Universiteit Amsterdam

Outline. Operating Systems Design and Implementation. Chap 1 - Overview. What is an OS? 28/10/2014. Introduction

Have both hardware and software. Want to hide the details from the programmer (user).

Active-Active Servers and Connection Synchronisation for LVS

Datacenter Operating Systems

Load Balancing - Single Multipath Route HOWTO

Heavy and Lightweight Dynamic Network Services : Challenges and Experiments for Designing Intelligent Solutions in Evolvable Next Generation Networks

Lab 5 Explicit Proxy Performance, Load Balancing & Redundancy

CS 416: Opera-ng Systems Design

Customized Data Exchange Gateway (DEG) for Automated File Exchange across Networks

Question: 3 When using Application Intelligence, Server Time may be defined as.

Useful USB Gadgets on Linux

Lecture 5. User-Mode Linux. Jeff Dike. November 7, Operating Systems Practical. OSP Lecture 5, UML 1/33

Wireshark in a Multi-Core Environment Using Hardware Acceleration Presenter: Pete Sanders, Napatech Inc. Sharkfest 2009 Stanford University

Tyche: An efficient Ethernet-based protocol for converged networked storage

A way towards Lower Latency and Jitter

Chapter 10 Case Study 1: LINUX

IO Visor Project Overview

Packet Sniffing and Spoofing Lab

Advanced Computer Networks. Network I/O Virtualization

Intel DPDK Boosts Server Appliance Performance White Paper

A Comparative Study on Vega-HTTP & Popular Open-source Web-servers

Linux firewall. Need of firewall Single connection between network Allows restricted traffic between networks Denies un authorized users

Ulogd2, Advanced firewall logging

ncap: Wire-speed Packet Capture and Transmission

Network Virtualization Technologies and their Effect on Performance

Packet Sniffers. * Windows and Linux - Wireshark

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

Practical Network Forensics

Bridgewalling - Using Netfilter in Bridge Mode

Design of an Application Programming Interface for IP Network Monitoring

EXPLORING LINUX KERNEL: THE EASY WAY!

I3: Maximizing Packet Capture Performance. Andrew Brown

Linux Networking Basics

point to point and point to multi point calls over IP

Attacking the TCP Reassembly Plane of Network Forensics Tools

PRODUCTIVITY ESTIMATION OF UNIX OPERATING SYSTEM

CS Computer and Network Security: Firewalls

Implementation and Performance Evaluation of M-VIA on AceNIC Gigabit Ethernet Card

Data Center Bridging Attributes. John Fastabend LAN Access Division, Intel Corp.

batman-adv scalability

Collecting Packet Traces at High Speed

Introduction to Network Security Lab 1 - Wireshark

Accelerate In-Line Packet Processing Using Fast Queue

ICS 351: Today's plan. IP addresses Network Address Translation Dynamic Host Configuration Protocol Small Office / Home Office configuration

Potential Performance Bottleneck in Linux TCP


Transcription:

SEP Packet Capturing Using the Linux Netfilter Framework Ivan Pronchev pronchev@in.tum.de

Today's Agenda Goals of the Project Motivation Revision Design Enhancements tcpdump vs kernel sniffer Interesting and Future Questions

Goals of the Project Approaching Linux netfilter framework Developing kernel sniffer Comparing with an existing packet capturing tool

Motivation Finding ways to improve capturing rates Userspace vs Kernelspace

Revision Linux Netfilter Framework Main Data Structures Receive Livelock Processing Multiple Frames During an Interrupt(NAPI) NAPI/non NAPI Frame Reception Packet Path through the IP Kernel Stack Netfilter Hooks in Details Kernel Sniffer

interrupt handler Non NAPI device driver interrupt handler NAPI device driver Research Unit VIII: Network Architectures NAPI/non NAPI Frame Reception TCP/IP Protokoll ARP Protokoll Ipv6 Protokoll ip_rcv arp_rcv... ipv6_rcv packet_rcv packet_type >func packet_type >func netif_receive_skb process_backlog Non NAPI netif_receive_skb NAPI netif_rx_schedule netif_rx dev >poll eth0 net_rx_action netif_rx_schedule netif_rx_schedule

L4 Protocols ip_push_pending_frames ip_queue_xmit IPv4 Kernel Stack raw_send_hdrinc Transport/L4 protocols Receive Routine NF_IP_LOCAL_OUT ip_output ip_finish_output NF_IP_POST_ROUTING ip_forward_finish NF_IP_FORWARDING ip_forward ip_local_deliver_finish NF_IP_LOCAL_IN ip_local_deliver ip_rcv_finish ip_finish_output2 hard_start_xmit Device Driver NF_IP_PRE_ROUTING ip_rcv

Design How to capture packets? How file operations work in kernelspace? How to capture packets and write them into a file?

Design How to capture packets? NF_IP_PRE_ROUTING ROUTE NF_IP_FORWARD NF_IP_POST_ROUTING ROUTE NF_IP_LOCAL_IN NF_IP_LOCAL_OUT

Design How file operations work in kernelspace? Userspace applications open close read write... System call interface VFS Ext2 Ext3 DOS...

Design How file operations work in kernelspace? Storage device Superblock include/linux/fs.h Inode Inode Process A File Dentry Dentry Process B File include/linux/dcache.h

Not possible: context switch disabled in nf_hook_slow while writing invokes scheduling if necessary! Research Unit VIII: Network Architectures Design How to capture packets and write them into a file? NF_IP_PRE_ROUTING NF_HOOK nf_hook_slow nf_iterate nf_hooks[pf][pre_routing] nf_hook_ops.hook ROUTE NF_IP_LOCAL_IN NF_IP_FORWARD NF_IP_POST_ROUTING ROUTE NF_IP_LOCAL_OUT Writing packets into a file

Design How to capture packets and write them into a file? NF_IP_PRE_ROUTING hook_func ROUTE NF_IP_FORWARD NF_IP_POST_ROUTING hook_func ROUTE NF_IP_LOCAL_IN NF_IP_LOCAL_OUT skbuff_queue kernel thread log.pcap How to store the packets until further procession? pcap header pcap packet header packet pcap packet header packet...

Design VFS filp_open IPv4 Stack NF_IP_POST_ROUTING hook_func NF_IP_PRE_ROUTING hook_func VFS file >f_op >write dev_set_promiscuity net_enable_timestamp nf_register_hook kernel_thread dev0 dev1 devn sk_buff_head sk_buff sk_buff kernel_thread threaded_write VFS file >f_op >write log.pcap pcap header pcap packet header packet pcap packet header packet...

ip_rcv int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { 1. When the interface is in promiscuous mode drop all the crap that it receives, do not try to analyze it. if (skb >pkt_type == PACKET_OTHERHOST) goto drop;...... 2.Call the prerouting netfilter hook. return NF_HOOK(PF_INET, NF_IP_PRE_ROUTING, skb, dev, NULL, ip_rcv_finish); 3.By error discard the sk_buff structure. inhdr_error:...... drop: kfree_skb(skb); out:...... }

Design VFS filp_open IPv4 Stack NF_IP_POST_ROUTING hook_func NF_IP_PRE_ROUTING hook_func VFS file >f_op >write dev_set_promiscuity net_enable_timestamp nf_register_hook dev_add_pack kernel_thread dev0 dev1 devn ptype_all ksniff_rcv VFS file >f_op >write sk_buff_head sk_buff sk_buff kernel_thread threaded_write VFS file >f_op >writev log.pcap pcap header pcap packet header packet pcap packet header packet...

Communication through the procfs start,stop,restart Interaction with the sniffer queue_size device_name logfile snaplen Statistics Errors Received packets Captured packets Enhancements Logging packets from a certain network device

tcpdump vs kernel sniffer Test machine: Athlon XP 1800, RAM:256 maximal disk's write speed ~ 34 MB/s TEST 1 : kernel sniffer, snaplen=1500 TEST 1: tcpdump, snaplen=1500 Packets:2000000 (1496byte,0frags) 70808pps 847Mb/sec (847432454bps) errors: 0 Packets:2000000 (1496byte,0frags) 70800pps 847Mb/sec (847344015bps) errors: 0 Captured packets:603874 Received packets:655560 589831 packets captured 661719 packets received by filter

tcpdump vs kernel sniffer TEST 2: kernel sniffer, snaplen=96 TEST 2: tcpdump, snaplen=96 Packets:2000000 (1496byte,0frags) Packets:2000000 (1496byte,0frags) 70799pps 847Mb/sec (847331807bps) errors: 070808pps 847Mb/sec (847431164bps) errors: 0 Captured packets:647783 Received packets:647783 TEST 3: kernel sniffer, snaplen=1500 642799 packets captured 645014 packets received by filter TEST 3: tcpdump, snaplen=1500 Packets:10.000.000 (1496byte,0frags) Packets:10.000.000 (1496byte,0frags) 47274pps 565Mb/sec (565784851bps) errors: 047088pps 563Mb/sec (563557308bps) errors: 0 Captured packets:3791329 Received packets:9844006 3643704 packets captured 9930613 packets received by filter

Queue vs Ring buffer Interesting and Future Questions Direct IO vs non Direct IO file operations Finding ways to improve capturing rates

Thanks for the attention