CS 378 (Spring 2003)

Similar documents
5105: BHARATHIDASAN ENGINEERING COLLEGE NATTARMPALLI UNIT I FUNDAMENTALS AND LINK LAYER PART A

Fundamentals of Computer Networking AE6382

Operating Systems. 17. Sockets. Paul Krzyzanowski. Rutgers University. Spring /6/ Paul Krzyzanowski

Fundamental Questions to Answer About Computer Networking, Jan 2009 Prof. Ying-Dar Lin,

EXAMGOOD QUESTION & ANSWER. Accurate study guides High passing rate! Exam Good provides update free of charge in one year!

Data Communications and Networks Spring Syllabus and Reading Assignments

Computer Network Programming. The Transport Layer. Dr. Sam Hsu Computer Science & Engineering Florida Atlantic University

TCP/IP Network Essentials

Assignment - 1 Chap. 1 Wired LAN s

COMPUTER NETWORKING LAB EXERCISES (TP) 4

Mike Anderson. TCP/IP in Embedded Systems. CTO/Chief Scientist The PTR Group, Inc.

Chapter 7. Local Area Network Communications Protocols

TCP/IP and the OSI Model

Network Implementation

Computer Communication & Networks / Data Communication & Computer Networks Week # 03

Packet Sniffing and Spoofing

Identify the features of network and client operating systems (Windows, NetWare, Linux, Mac OS)

ACL Rule Configuration on the WAP371

ETSF10 Internet Protocols Network Layer Protocols

Network Architecture Models

( A ) 1. WAP is a (A) protocol (B) hardware (C) software (D) network architecture

CSC 474/574 Information Systems Security

OMNeT++ Community Summit, Beyond INET 3.0

Layer 4: UDP, TCP, and others. based on Chapter 9 of CompTIA Network+ Exam Guide, 4th ed., Mike Meyers

EMT2455 Data Communications 4. Network Layer. Dr. Xiaohai Li. Dept. of Computer Eng. Tech., NYCCT. Last Update: Nov.

521262S Computer Networks 2 (fall 2007) Laboratory exercise #2: Internetworking

IP Basics Unix/IP Preparation Course June 29, 2010 Pago Pago, American Samoa

CS-435 spring semester Network Technology & Programming Laboratory. Stefanos Papadakis & Manolis Spanakis

Network Security. Introduction to networks. Radboud University, The Netherlands. Autumn 2015

Introduction... xiii Chapter 1: Introduction to Computer Networks and Internet Computer Networks Uses of Computer Networks...

1. Which OSI layers offers reliable, connection-oriented data communication services?

LAN Setup Reflection. Ask yourself some questions: o Does your VM have the correct IP? o Are you able to ping some locations, internal and external?

Antonio Cianfrani. Fundamentals of IP Networking

QUESTION BANK UNIT-I

C19: User Datagram and Multicast

Exam : Title : Sun Certified Network Administrator for Solaris 10 OS. Version : DEMO

Static and source based routing

cs144 Midterm Review Fall 2010

COMS Introduction to Computers. Networking

Interconnecting Networks with TCP/IP. 2000, Cisco Systems, Inc. 8-1

CS Computer and Network Security: Firewalls

ECPE / COMP 177 Fall Some slides from Kurose and Ross, Computer Networking, 5 th Edition

Vorlesung Kommunikationsnetze

On Distributed Communications, Rand Report RM-3420-PR, Paul Baran, August 1964

Operating Systems. 16. Networking. Paul Krzyzanowski. Rutgers University. Spring /6/ Paul Krzyzanowski

Mainframe Networking 101 Share Session 15422

The Lean Plan p. 1. Embedded Systems. The Operating System The Development Environment. Acknowledgments Introduction p. 1.

Practical Exercises in Computer Networks

IP - The Internet Protocol. Based on the slides of Dr. Jorg Liebeherr, University of Virginia

LAN Setup Reflection

Mainframe Networking 101 Share Session. Junie Sanders Kevin Manweiler -

C18: Network Fundamentals and Reliable Sockets

CS164 Final Exam Winter 2013

Guide to Networking Essentials, 6 th Edition. Chapter 5: Network Protocols

Topics Quick review of network fundamentals The ISO OSI 7-layer model (and why it matters) Network and host part of an IP address Function of the

SJTU 2018 Fall Computer Networking. Wireless Communication

Introduction to Computer Networks. CS 166: Introduction to Computer Systems Security

Network Administra0on

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 11

Lecture 2. Outline. Layering and Protocols. Network Architecture. Layering and Protocols. Layering and Protocols. Chapter 1 - Foundation

VPN-against-Firewall Lab: Bypassing Firewalls using VPN

Computer Network Addressing. The TCP/IP Layers and Addresses. Topics. The Internet Communication. The TCP/IP Layers and Addresses IP Address

Computer Networks. More on Standards & Protocols Quality of Service. Week 10. College of Information Science and Engineering Ritsumeikan University

Lab 1: Packet Sniffing and Wireshark

Network+ Guide to Networks 6 th Edition. Chapter 4 Introduction to TCP/IP Protocols

Network+ Guide to Networks, Seventh Edition Chapter 2, Solutions

ITexamGuide. High-quality IT Cert Exam study guide

SC/CSE 3213 Winter Sebastian Magierowski York University CSE 3213, W13 L8: TCP/IP. Outline. Forwarding over network and data link layers

Monitoring (and) IPv6

Appendix B Policies and Filters

0 TCP/IP overview. 0.1 The Internet

THE INTERNET PROTOCOL INTERFACES

The Internet. 9.1 Introduction. The Internet is a global network that supports a variety of interpersonal and interactive multimedia applications.

ROYAL INSTITUTE OF INFORMATION & MANAGEMENT

The Internet Protocol

THE INTERNET PROTOCOL/1

Computer Networks (Unit wise Questions)

Some of the slides borrowed from the book Computer Security: A Hands on Approach by Wenliang Du. Firewalls. Chester Rebeiro IIT Madras

CCNA MCQS with Answers Set-1

MiPDF.COM. 1. Convert the decimal number 231 into its binary equivalent. Select the correct answer from the list below.

Networking Fundamentals

FINAL EXAM REVIEW PLEASE NOTE THE MATERIAL FROM LECTURE #16 at the end. Exam 1 Review Material

University of Southern California EE450: Introduction to Computer Networks

Introduction. An introduction to the equipment and organization of the Internet Lab.

Introduction to Firewalls using IPTables

Computer Networks. Dr. Abdel Ilah ALshbatat Dept. of Communication and Computer Engineering Faculty of Engineering Tafila Technical University

CS 356: Computer Network Architectures. Lecture 10: IP Fragmentation, ARP, and ICMP. Xiaowei Yang

Lecture 1: Introduction

Lecture 04: Networking & Internetworking

show ipv6 nat translations, on page 71

Internet. Organization Addresses TCP/IP Protocol stack Forwarding. 1. Use of a globally unique address space based on Internet Addresses

TSIN02 - Internetworking

What is a Network? TCP / IP. The ISO OSI Model. Protocols. The TCP/IP Protocol Suite. The TCP/IP Protocol Suite. Computer network.

firewall { all-ping enable broadcast-ping disable ipv6-receive-redirects disable ipv6-src-route disable ip-src-route disable log-martians enable name

Linux IP Networking. Antonio Salueña

A 10 years journey in Linux firewalling Pass the Salt, summer 2018 Lille, France Pablo Neira Ayuso

CS 348 Computer Networks. IP and Routing. Indian Institute of Technology, Bombay

CCRI Networking Technology I CSCO-1850 Spring 2014

Lecture 3 Protocol Stacks and Layering

Unit 28 Website Production ASSIGNMENT 1

Transcription:

Department of Computer Sciences THE UNIVERSITY OF TEXAS AT AUSTIN CS 378 (Spring 2003) Linux Kernel Programming Yongguang Zhang (ygz@cs.utexas.edu) Copyright 2003, Yongguang Zhang

This Lecture Linux Networking Setting up networks with UML Overview of Linux networking code Major data structures Questions? How much do you know about IP networking? Spring 2003 2003 Yongguang Zhang 2

Building a Test-bed Network To build a test-bed network with UML instances To test your network implementation Here, you need to know a little bit about Linux networking and network administration How to configure an IP address: ifconfig How to configure the route table: route How to test the network: ping How to debug the network: tcpdump Spring 2003 2003 Yongguang Zhang 3

Virtual Networks with UML UML supports a virtual Ethernet driver Ethernet packets are sent via UDP through UML host Emulate an Ethernet segment with an IP multicast group (UML host joins this group) UML UML UML host Virtual Ethernet Virtual Ethernet UTCS UDP Spring 2003 2003 Yongguang Zhang 4

A Very Simple IP Network IP network basics Each network interface must have a unique IP address Network interfaces connected by the same network must belong to the same subnet Host 1 Host 2 Network interface Network interface IP address: 192.168.1.1 IP address: 192.168.1.2 Ethernet segment (subnet: 192.168.1.0/24) Spring 2003 2003 Yongguang Zhang 5

Build this Network with UML Host 1 Host 2 Network interface Network interface IP address: 192.168.1.1 IP address: 192.168.1.2 UML host UDP 224.1.0.0 UML host Spring 2003 2003 Yongguang Zhang 6

Before We Start You will need to run multiple instances of UML In the same UTCS host, or In different hosts Use COW (copy-on-write) to use disk space Make root fs file read-only: chmod a-r root_fs_utcs First UML:./linux ubd0=cow1,root_fs_utcs Second UML:./linux ubd0=cow2,root_fs_utcs These cow* files take little space Spring 2003 2003 Yongguang Zhang 7

Step 1: Add an Ethernet to UML Adding a network device to UML Specify an ethn= argument in UML command line Pick an Ethernet segment for this device (i.e. pick a multicast address) UML command line syntax eth0=mcast,ethernetaddr,multicastaddr,port,ttl Example: To add a eth0 device on Ethernet segment 224.1.0.0./linux ubd0=cow1,root_fs_utcs eth0=mcast,,224.1.0.0,, Spring 2003 2003 Yongguang Zhang 8

Step 2: Start Up this Interface Configure the network interface within UML Once you run UML with the eth0= argument, you get an eth0 device Check this with: ifconfig eth0 Assign an IP address to this interface ifconfig eth0 192.168.1.1 up To check this configuration: ifconfig eth0 route n Spring 2003 2003 Yongguang Zhang 9

Step 3: Start up Another Host Start another UML host with the same virtual network In the same Linux host or another host in the same physical network (e.g, both in UTCS net)./linux ubd0=cow2,root_fs_utcs eth0=mcast,,224.1.0.0,, Make sure you use the same multicast address & port! Within this UML, configure the network with a different IP address, but in the same subnet ifconfig eth0 192.168.1.2 up Spring 2003 2003 Yongguang Zhang 10

Step 4: Test the Network Now, you have two UML hosts connected by a virtual network In first host: try ping 192.168.1.2 In second host: try ping 192.168.1.1 In first host: try ssh 192.168.1.2 Try tcpdump while you are doing these Spring 2003 2003 Yongguang Zhang 11

UML Networking Cautions Pick your multicast address to avoid conflict with other people I suggest: 224.1.ab.cd, where abcd is the last 4 digits of your account uid Spring 2003 2003 Yongguang Zhang 12

A More Complex Network Build your own network (with multiple subnets) Remember to use different multicast address (one per subnet) Set up your own routing Host 1 Host 2 Network interface NIC NIC 192.168.1.1 192.168.1.2 192.168.2.1 Host 3 Network interface 192.168.2.2 Subnet (192.168.1.0/24) Subnet (192.168.2.0/24) Spring 2003 2003 Yongguang Zhang 13

Building it with UML Host 2 (router): To start UML with 2 virtual Ethernet interfaces:./linux ubd0=cow2,root_fs_utcs eth0=mcast,,224.1.0.0,, eth1=mcast,,224.2.0.0,, To configure within UML: ifconfig eth0 192.168.1.2 up ifconfig eth1 192.168.2.1 up Host 3: To start UML:./linux ubd0=cow3,root_fs_utcs eth0=mcast,,224.2.0.0,, To configure within UML: ifconfig eth0 192.168.2.2 up Spring 2003 2003 Yongguang Zhang 14

Enable Routing Enable routing Enable IP forwarding at router (Host 2) echo 1 > /proc/sys/net/ipv4/ip_forward Need to add a static route at host 1 route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.2 Need to add a static route at host 2 route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.2.1 To test At host 1: ping 192.168.2.2 Spring 2003 2003 Yongguang Zhang 15

Linux Networking Architecture Network subsystem in Linux kernel (NET4.0) Supports a wide range of network architecture (family): IP, IPv6, IPX, Supports a wide range of network hardware: Ethernet, token ring, wireless, serial line, Supports network roles: host, router, bridge/switch A complete and robust internetworking system This class Study IP(v4) only Study network implementation in kernel only Spring 2003 2003 Yongguang Zhang 16

Linux Kernel Responsibility Protocol implementation and API Transport level and below: TCP, UDP, IP, ARP, Ethernet Higher-level protocols are implemented in user-space: HTTP, DNS, SMTP, SSH, Network configuration/management API for setting IP address, route table, ARP table Dynamic configuration/network management are implemented in user-space: DHCP, dynamic routing Networked OS services Network file system (NFS, SMB,...) Spring 2003 2003 Yongguang Zhang 17

Networking Stack Application Presentation Session Transport Network Data-link Physical User Space socket Linux Kernel hardware Java, HTML Socket programming Protocol implementation Network administration Networking Stack Spring 2003 2003 Yongguang Zhang 18

Networking Stack Components Socket API Common API for all network architectures/devices Network and transport layers Core protocols, multiplexing/de-multiplexing Grouped under different network families Network device drivers Manage hardware (network interface cards) Deal with data-link functions (such as MAC) Can be virtual (e.g., ppp0) Spring 2003 2003 Yongguang Zhang 19

Source Code Layout Under linux kernel source tree net/*.c, net/core/ : socket API, kernel abstractions and common utilities net/ethernet/, /net/atm/ : common device layer net/sched/ : packet schedulers (QoS) net/bridge/ : Ethernet bridge code net/*/ : protocol family (one per dir, e.g, net/ipv4/) drivers/net/*/ : network device driver (one per dir) Spring 2003 2003 Yongguang Zhang 20

Layering in the Networking Stack BSD Socket INET Socket TCP/UDP IP Common network layer Socket API IPv4-specific socket interface multiplexing Transport protocols IP input/output chain forwarding/routing IP-layer protocols Socket buffer, netfilter queue disciplines interface to device driver Spring 2003 2003 Yongguang Zhang 21

Socket Layer BSD socket Defining API and servicing related system calls Providing a common file interface for sockets (through a special file system called sockfs) Major data structure: struct socket (definition: include/linux/net.h, code: net/socket.c, net/core/) INET socket IPv4-specific socket interface Protocols multiplexing Major data structure: struct sock (definition: include/net/sock.h, code: net/ipv4/af_inet.c) Spring 2003 2003 Yongguang Zhang 22

Protocol Layer Protocol multiplexing and demultiplexing Setting up socket types, protocol switches, and handlers Major data structure: list of socket types, protocol hash Code: net/ipv4/protocol.c, net/ipv4/af_inet.c Raw socket: net/ipv4/raw.c Protocol-specific processing TCP, UDP: net/ipv4/tcp*.c, net/ipv4/udp.c ICMP, IGMP: net/ipv4/icmp.c, net/ipv4/igmp.c Tunneling, multicast: net/ipv4/ipip.c, net/ipv4/ipmr.c Spring 2003 2003 Yongguang Zhang 23

The IP Layer IP packet processing Code: net/ipv4/ip_*.c Address resolution Major data structure: neighor cache (ARP cache) Code: net/ipv4/arp.c Forwarding/routing Major data structure: FIB, route cache Code: net/ipv4/fib_*.c, net/ipv4/route.c Spring 2003 2003 Yongguang Zhang 24

Common Network Layer Basic data structure: socket buffer Used in all network stack: carry the packet payload for going through the input/output chains Minimize copying: only twice (between user mode and kernel mode, and from/to the network hardware) Other functions Netfilter hooks (for packet mangling, like firewall) Scheduling and queueing disciplines (for QoS) Common net device functions (for interfacing with device driver) Spring 2003 2003 Yongguang Zhang 25

Input Chain and Output Chain application socket TCP output IP output TCP input IP input Network device driver Spring 2003 2003 Yongguang Zhang 26

Summary Linux Networking LKP: 8 ULK: 18 Next lecture: Linux Networking Spring 2003 2003 Yongguang Zhang 27