netkit lab load balancer web switch 1.1 Giuseppe Di Battista, Massimo Rimondini Version Author(s)



Similar documents
netkit lab load balancer dns 1.2 Massimo Rimondini Version Author(s)

netkit lab web server and browser 1.2 Giuseppe Di Battista, Maurizio Patrignani, Massimo Rimondini Version Author(s)

1:1 NAT in ZeroShell. Requirements. Overview. Network Setup

Assignment 3 Firewalls

netkit lab bgp: multi-homed Università degli Studi Roma Tre Dipartimento di Informatica e Automazione Computer Networks Research Group

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

netkit lab static-routing Università degli Studi Roma Tre Dipartimento di Informatica e Automazione Computer Networks Research Group

netkit lab two-hosts Università degli Studi Roma Tre Dipartimento di Informatica e Automazione Computer Networks Research Group

Linux Routers and Community Networks

netkit lab single-host Università degli Studi Roma Tre Dipartimento di Informatica e Automazione Computer Networks Research Group

Network Security Exercise 10 How to build a wall of fire

+ iptables. packet filtering && firewall

Firewalls. Chien-Chung Shen

Network security Exercise 9 How to build a wall of fire Linux Netfilter

Linux Firewall Wizardry. By Nemus

netkit lab MPLS VPNs with overlapping address spaces 1.0 S.Filippi, L.Ricci, F.Antonini Version Author(s)

netkit lab Università degli Studi Roma Tre Dipartimento di Informatica e Automazione Computer Networks Research Group Version 1.

Main functions of Linux Netfilter

walkthrough Università degli Studi Roma Tre Dipartimento di Informatica e Automazione Computer Networks Research Group Version 1.

Dynamic Host Configuration Protocol (DHCP) 02 NAT and DHCP Tópicos Avançados de Redes

Track 2 Workshop PacNOG 7 American Samoa. Firewalling and NAT

10.4. Multiple Connections to the Internet

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

netkit lab Traffic Engineering with MPLS for Linux Version Author(s) F. Di Ciccio, F. Antonini (Kasko Networks S.r.l.)

Firewall. IPTables and its use in a realistic scenario. José Bateira ei10133 Pedro Cunha ei05064 Pedro Grilo ei09137 FEUP MIEIC SSIN

Version Author(s) Web Description

Linux Firewalls (Ubuntu IPTables) II

CS Computer and Network Security: Firewalls

Chapter 7. Firewalls

Firewall Examples. Using a firewall to control traffic in networks

CS Computer and Network Security: Firewalls

Vertigo's Running Dedicated Server HOWTO (v1.2)

CSC574 - Computer and Network Security Module: Firewalls

CERN Cloud Infrastructure. Cloud Networking

Linux Networking: IP Packet Filter Firewalling

Computer Firewalls. The term firewall was originally used with forest fires, as a means to describe the

netkit lab bgp: prefix-filtering Università degli Studi Roma Tre Dipartimento di Informatica e Automazione Computer Networks Research Group

CheckPoint Software Technologies LTD. How to Configure Firewall-1 With Connect Control

TECHNICAL NOTES. Security Firewall IP Tables

Load Balancing Sophos Web Gateway. Deployment Guide

CSE543 - Computer and Network Security Module: Firewalls

Smoothwall Web Filter Deployment Guide

Load Balancing SIP Quick Reference Guide v1.3.1

Load Balancing Barracuda Web Filter. Deployment Guide

ClusterLoad ESX Virtual Appliance quick start guide v6.3

Rapid Access Cloud: Se1ng up a Proxy Host

ipchains and iptables for Firewalling and Routing

Firewalls. Firewall types. Packet filter. Proxy server. linux, iptables-based Windows XP s built-in router device built-ins single TCP conversation

IP Address: the per-network unique identifier used to find you on a network

Load Balancing Web Proxies Load Balancing Web Filters Load Balancing Web Gateways. Deployment Guide

Optimisacion del ancho de banda (Introduccion al Firewall de Linux)

Load Balancing Bloxx Web Filter. Deployment Guide

Load Balancing Smoothwall Secure Web Gateway

Load Balancing McAfee Web Gateway. Deployment Guide

Firewalls. October 23, 2015

Load Balancing Trend Micro InterScan Web Gateway

Module: Firewalls. Professor Patrick McDaniel Spring CMPSC443 - Introduction to Computer and Network Security

Netfilter. GNU/Linux Kernel version 2.4+ Setting up firewall to allow NIS and NFS traffic. January 2008

Intro to Linux Kernel Firewall

Loadbalancer.org Appliance Setup v5.9

How To Configure A Vyatta As A Ds Internet Connection Router/Gateway With A Web Server On A Dspv.Net (Dspv) On A Network With A D

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

Linux Cluster Security Neil Gorsuch NCSA, University of Illinois, Urbana, Illinois.

CIS 433/533 - Computer and Network Security Firewalls

Load Balancing Clearswift Secure Web Gateway

Netfilter / IPtables

UNIVERSITY OF BOLTON CREATIVE TECHNOLOGIES COMPUTING AND NETWORK SECURITY SEMESTER TWO EXAMINATIONS 2014/2015 NETWORK SECURITY MODULE NO: CPU6004

ExamPDF. Higher Quality,Better service!

Firewalls, NAT and Intrusion Detection and Prevention Systems (IDS)

Loadbalancer.org. Loadbalancer.org appliance quick setup guide. v6.6

How To Understand A Firewall

CIT 480: Securing Computer Systems. Firewalls

MikroTik RouterOS Workshop Load Balancing Best Practice. Warsaw MUM Europe 2012

Home Linux Networking Lab (202) This Howto shows how to recreate the CIS Lab environment at home.

Linux Administrator (Advance)

Application Description

Multi-layer switch hardware commutation across various layers. Mario Baldi. Politecnico di Torino.

Protecting and controlling Virtual LANs by Linux router-firewall

Home Networking In Linux

configure WAN load balancing

Manuale Turtle Firewall

Lecture Objectives. Lecture 6 Mobile Networks: Nomadic Services, DHCP, NAT, and VPNs. Agenda. Nomadic Services. Agenda. Nomadic Services Functions

Enabling NAT and Routing in DGW v2.0 June 6, 2012

Evaluation guide. Vyatta Quick Evaluation Guide

How to configure DNAT in order to publish internal services via Internet

Load Balancing VMware Horizon View. Deployment Guide

Bridgewalling - Using Netfilter in Bridge Mode

Appliance Quick Start Guide. v7.6

Focus on Security. Keeping the bad guys out

Guardian Digital WebTool Firewall HOWTO. by Pete O Hara

Chapter 11 Network Address Translation

Load Balancing VMware Horizon View. Deployment Guide

Single Pass Load Balancing with Session Persistence in IPv6 Network. C. J. (Charlie) Liu Network Operations Charter Communications

Linux Firewall. Linux workshop #2.

Linux as an IPv6 dual stack Firewall

GregSowell.com. Mikrotik Security

Transcription:

netkit lab load balancer web switch Version Author(s) 1.1 Giuseppe Di Battista, Massimo Rimondini E-mail Web Description contact@netkit.org http://www.netkit.org/ A lab showing the operation of a web switch based on iptables

copyright notice All the pages/slides in this presentation, including but not limited to, images, photos, animations, videos, sounds, music, and text (hereby referred to as material ) are protected by copyright. This material, with the exception of some multimedia elements licensed by other organizations, is property of the authors and/or organizations appearing in the first slide. This material, or its parts, can be reproduced and used for didactical purposes within universities and schools, provided that this happens for non-profit purposes. Information contained in this material cannot be used within network design projects or other products of any kind. Any other use is prohibited, unless explicitly authorized by the authors on the basis of an explicit agreement. The authors assume no responsibility about this material and provide this material as is, with no implicit or explicit warranty about the correctness and completeness of its contents, which may be subject to changes. This copyright notice must always be redistributed together with the material, or its portions.

lab topology clients A web switches B server farm 10.0.0.0/24 1 eth0 4 eth1 100.0.0.0/24 10 eth0 ws_round-robin 1 eth0 client1 2 eth0 5 eth1 2 eth0 server1 ws_random server2 client2 11 eth0 3 eth0 ws_ip 6 eth1 3 eth0 server3

lab description servers offer a simple HTML default page each physical server hosts a different page, so that they can be easily distinguished web switches each web switch implements a different policy for directing requests to the servers ws_round-robin: sends request i to server ((i-1) mod 3)+1 ws_random: sends each request to a random server ws_ip: directs requests to servers based on the client s IP address clients host a simple web browser (links)

lab description servers each server has a different IP address in the subnet 100.0.0.0/24 no special configuration, just a simple HTML default page in /var/www/index.html

lab description web switches each web switch has two interfaces one facing the internal network, with an IP address in the same subnet as the servers one facing the external network, exposing a single virtual IP address (VIP) to the clients clients only see VIPs of the web switches: they do not know how many servers are in the farm

lab description web switches web switches are implemented using the Linux firewall iptables round robin

lab description web switches web switches are implemented using the Linux firewall iptables round robin iptables --table nat --append PREROUTING --destination 10.0.0.1 --match statistic --mode nth --every 3 --jump DNAT -- traffic redirection is is implemented via NAT rules

lab description web switches web switches are implemented using the Linux firewall iptables round robin iptables --table nat --append PREROUTING --destination 10.0.0.1 --match statistic --mode nth --every 3 --jump DNAT -- redirect traffic addressed to to the the VIP VIP exposed by by the the web web switch

lab description web switches web switches are implemented using the Linux firewall iptables round robin iptables --table nat --append PREROUTING --destination 10.0.0.1 --match statistic --mode nth --every 3 --jump DNAT -- one every 3 packets is is directed...

lab description web switches web switches are implemented using the Linux firewall iptables round robin iptables --table nat --append PREROUTING --destination 10.0.0.1 --match statistic --mode nth --every 3 --jump DNAT --...to...to web web server 100.0.0.1 (actually, the the packet s destination IP IP is is rewritten)

lab description web switches web switches are implemented using the Linux firewall iptables round robin iptables --table nat --append POSTROUTING --source 10.0.0.0/24 --destination 100.0.0.0/24 --jump MASQUERADE with with this this rule rule servers see see traffic as as if if it it came from from the the web web switches themselves, and and so so HTTP replies can can properly be be sent sent back back

lab description web switches web switches are implemented using the Linux firewall iptables round robin iptables --table nat --append POSTROUTING --source 10.0.0.0/24 --destination 100.0.0.0/24 --jump MASQUERADE with with this this rule rule servers see see traffic as as if if it a it hack hack (yes, indeed it s it s came a hack) from to from to have the the web all web all the the 3 web web switches operating switches in in themselves, the same topology; without this, this, web and web and so servers so HTTP would replies only only be be able able to to send send traffic can back can properly back through be be sent a sent single web web switch (via (via a back default back route)

lab description web switches web switches are implemented using the Linux firewall iptables random iptables --table nat --append PREROUTING --destination 10.0.0.2 --match statistic --mode random --probability 0.33 -- iptables --table nat --append PREROUTING --destination 10.0.0.2 --match statistic --mode random --probability 0.33 -- jump DNAT -- jump DNAT -- iptables --table nat --append PREROUTING --destination 10.0.0.2 --match statistic --mode random --probability 0.5 -- iptables --table nat --append PREROUTING --destination 10.0.0.2 --match statistic --mode random --probability 0.5 -- jump DNAT -- jump DNAT -- iptables --table nat --append PREROUTING --destination 10.0.0.2 --jump DNAT --to-destination 100.0.0.3 iptables --table nat --append PREROUTING --destination 10.0.0.2 --jump DNAT --to-destination 100.0.0.3 iptables --table nat --append PREROUTING --destination 10.0.0.2 --match statistic --mode random --probability 0.33 --jump DNAT -- similar to to the the round robin case, but but the the rule rule applies with with a certain probability

lab description web switches web switches are implemented using the Linux firewall iptables ip-based iptables --table nat --append PREROUTING --destination 10.0.0.3 --source 10.0.0.10 --jump DNAT --to-destination iptables --table nat --append PREROUTING --destination 10.0.0.3 --source 10.0.0.10 --jump DNAT --to-destination 100.0.0.1 100.0.0.1 iptables --table nat --append PREROUTING --destination 10.0.0.3 --source 10.0.0.11 --jump DNAT --to-destination iptables --table nat --append PREROUTING --destination 10.0.0.3 --source 10.0.0.11 --jump DNAT --to-destination 100.0.0.2 100.0.0.2 iptables --table nat --append PREROUTING --destination 10.0.0.3 --source 10.0.0.10 --jump DNAT -- the the server is is deterministically chosen based on on the the client s (source) address

experiments to experiment load balancing, pick one of the clients, start links, and direct it to one of the VIPs exposed by web switches: client1 client1:~# links http://10.0.0.1/ to experiment round robin balancing client1 client1:~# links http://10.0.0.2/ to experiment random balancing client1 client1:~# links http://10.0.0.3/ to experiment perclient-ip balancing

experiments once you have accessed one of the VIPs, you get a page stating which is the physical server that has served it load balancing can be checked by reloading the page (ctrl+r), but...

experiments once you have accessed one of the VIPs, you get a page stating which is the physical server that has served it load balancing can be checked by reloading the page (ctrl+r), but......by default all HTTP requests use the same connection (HTTP 1.1)! since iptables tracks TCP connections, all HTTP requests within the same connection are directed to the same physical server to really appreciate load balancing you need to close the connection and establish a new one ctrl+s, then ctrl+r

more experiments each client has a handy script that sends 100 HTTP requests (each on a different connection) to a user-specified IP reports the number of pages that have been served by each physical server client2 client2:~#./count_server_replies.sh 10.0.0.2 37 replies received from server 1 32 replies received from server 2 31 replies received from server 3 client2:~#

more experiments after booting, each web switch automatically displays statistics about the number of times that iptables rules have matched check the pkts field in chain PREROUTING ws_ip Every 2.0s: iptables -t nat -vnl Wed Oct O 26 10:30:49 2011 Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination 9 540 DNAT all -- * * 10.0.0.10 10.0.0.3 to:100.0.0.1 13 780 DNAT all -- * * 10.0.0.11 10.0.0.3 to:100.0.0.2 Chain POSTROUTING (policy ACCEPT 1 packets, 60 bytes) pkts bytes target prot opt in out source destination 22 1320 MASQUERADE all -- * * 10.0.0.0/24 100.0.0.0/24 Chain OUTPUT (policy ACCEPT 1 packets, 60 bytes) pkts bytes target prot opt in out source destination