Kefk Network Home Kefk Network : Kefk Network GNU/Linux GNU/Linux | Über Kefk Network GNU/Linux About | Kefk Network GNU/Linux Wiki Wiki. Changelog | Index | Inhalt | Site Map | Suchen
Administration | Akteure | Anwendungen | Berlin | Business | Chronik | Counter | Desktop | Development | Distributionen | Dokumentation | Hardware | Jobs | Kernel | Lernen | Literatur | Meinung | Microsoft Windows | Netmarks | News | PDA | Praxis | Reviews | Server | Shell | Shopping | Software | Standards | Tagebuch | Theorie | Window Manager | Worldwide | X11.

 

Firewalling mit Iptables unter GNU/Linux

Administration : Firewalling : Iptables : Übersicht
20-Nov-2004/09-Jan-07


Übersicht

Betreiben einer Firewall mit Iptables unter GNU/Linux.

Beispielskript

Dieses Beispielskript kann aus Ausgangsbasis für eigene Firewallregeln genutzt werden. Es muss unter /etc/init.d abgelegt werden; zusätzlich müssen noch Symlinks im Verzeichnis des benutzten Runlevels angelegt werden.

#!/bin/sh

# Schnittstelle zum lokalen Netzwerk
IFACE_INT=eth0

# Internetschnittstelle - "ippp+" für ISDN
IFACE_EXT=ppp+

# Loopback device - bedraf keiner Anpassung
IFACE_LO=lo


# ************
# * POLICIES *
# ************

# Zurücksetzen der Konfiguration
iptables -F
iptables -t nat -F

iptables -X
iptables -t nat -X

# Default-Policies setzen - alles fliegt raus
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP

# Einschalten von ip-Forwarding
echo "1" > /proc/sys/net/ipv4/ip_forward


# *********
# * INPUT *
# *********

# Soll nicht sein
iptables -A INPUT -p TCP ! --syn -m state --state NEW -j DROP

# Vom internen Netz alles erlauben
iptables -A INPUT -i $IFACE_INT -j ACCEPT

# Vom Loopback Alles erlauben
iptables -A INPUT -i $IFACE_LO -j ACCEPT

# Vom Internet: Darf nicht sein
iptables -A INPUT -i $IFACE_EXT -s 10.0.0.0/8 -j DROP
iptables -A INPUT -i $IFACE_EXT -s 172.16.0.0/12 -j DROP
iptables -A INPUT -i $IFACE_EXT -s 192.168.0.0/24 -j DROP

# Vom Internet Erlauben von bereits initialisierten Verbindungen
iptables -A INPUT -i $IFACE_EXT -m state \
--state ESTABLISHED,RELATED -j ACCEPT


# ***********
# * FORWARD *
# ***********

# Wegen der Telekom
iptables -I FORWARD -p TCP --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

# Lokal -> Internet: Alles erlauben
iptables -A FORWARD -i $IFACE_INT -o $IFACE_EXT -j ACCEPT


# Internet -> Lokales: Nur Verkehr über bereits bestehende Verbindungen erlauben
iptables -A FORWARD -i $IFACE_EXT -o $IFACE_INT -m state \
--state ESTABLISHED,RELATED -j ACCEPT


# **********
# * OUTPUT *
# **********

# Ins lokale Netzwerk: Alles erlauben
iptables -A OUTPUT -o $IFACE_INT -j ACCEPT

# Ans Loopback: Alles erlauben
iptables -A OUTPUT -o $IFACE_LO -j ACCEPT

# Ins Internet : Alles erlauben
iptables -A OUTPUT -o $IFACE_EXT -j ACCEPT



# Masquerading
iptables -A POSTROUTING -o $IFACE_EXT -t nat -j MASQUERADE


# Den Rest mitprotokollieren
iptables -A OUTPUT -j LOG --log-prefix "Nicht raus: "
iptables -A FORWARD -j LOG --log-prefix "Nicht durch: "
iptables -A INPUT -j LOG --log-prefix "Nicht rein: "

Quelle: Benutzer glatzor (Debianforum.de)

Literatur

Linux iptables Pocket Reference
von Gregor N. Purdy
Sprache: Englisch
Broschiert - 91 Seiten - O'Reilly & Associates
Erscheinungsdatum: 1. August 2004
ISBN: 0596005695
Preis: EUR 8,49

Synopsis: Firewalls, Network Address Translation (NAT), and network logging and accounting are all provided by Linux's Netfilter system, also known by the name of the command used to administer it, iptables. The iptables interface is the most sophisticated ever offered on Linux and makes Linux an extremely flexible system for any kind of network filtering you might do. Large sets of filtering rules can be grouped in ways that makes it easy to test them and turn them on and off. Do you watch for all types of ICMP traffic--some of them quite dangerous? Can you take advantage of stateful filtering to simplify the management of TCP connections? Would you like to track how much traffic of various types you get? This pocket reference will help you at those critical moments when someone asks you to open or close a port in a hurry, either to enable some important traffic or to block an attack. The book will keep the subtle syntax straight and help you remember all the values you have to enter in order to be as secure as possible. The listings of all iptables options are divided into those suitable for firewalling, accounting, and NAT.

Netmarks

Krnlpanic.com: How to use IP Tables (Linux Help),
krnlpanic.com/tutorials/iptables.php.

UnixReview.com: Using iptables, April 2001, von Joe "Zonker" Brockmeier,
www.unixreview.com/documents/s=1236/urm0104l/0104l.htm.

JustLinux.com: Help File Library: Iptables Basics, von Prince_Kenshi,
www.justlinux.com/nhf/Security/IPtables_Basics.html.

Debianforum.de: Firewallscripts,
www.debianforum.de/forum/viewtopic.php?t=3419.

Forum mit kommentierten, Debian-spezifischen Beispielsskripts und Diskussion.

James C. Stephens: Iptables,
www.sns.ias.edu/~jns/security/iptables.

Einige kommentierte Beispielskripts.

James C. Stephens: Connection tracking,
www.sns.ias.edu/~jns/security/iptables/iptables_conntrack.html.

»Connection tracking refers to the ability to maintain state information about a connection in memory tables, such as source and destination ip address and port number pairs (known as socket pairs), protocol types, connection state and timeouts. Firewalls that do this are known as stateful. Stateful firewalling is inherently more secure than its "stateless" counterpart .... simple packet filtering. Connection tracking is accomplished with the state option in iptables«.

Harald Welte: Netfilter connection tracking and nat helper modules, Version 1.2, 2000/10/14 20:37:53,
gnumonks.org/ftp/pub/doc/conntrack+nat.html.

Anmerkungen

Forum: (Anmerkungen in diesem Forum: )

Neue Anmerkung verfassen
Darstellungsmodus : Alle | Voransicht | Nur Titel | Aktualisieren
Besuchen Sie 2eNetWorX und Open Source & Free Software für weitere freie Software-Projekte unter Win32.

Iptables:
Nach oben
Wer ist online?
Name: Besucher.
Online: 8 aktive User.
Login | Logout
Monitoring:
Benachrichtigen bei Änderungen:

mi.gif (12x15 -- 70 bytes)Top-Distributionen:
Debian GNU/Linux 3.1 »Sarge«,
mit Debian-Anwenderhandbuch.


DVD-ROM +
Bonus-DVD
amazon_small.gif (55x15 -- 576 bytes)EUR 49,90
(versandkostenfrei)


Debian GNU/Linux Power Pack.
von Peter H. Ganten und Wulf Alex.

3540432507.03.MZZZZZZZ.jpg (93x140 -- 3556 bytes)
946 Seiten, zwei DVDs
amazon_small.gif (55x15 -- 576 bytes)EUR 69,95
(versandkostenfrei)

mi.gif (12x15 -- 70 bytes)Ubuntu:
Ubuntu/Kubuntu 5.10,
mit Handbuch.


amazon_small.gif (55x15 -- 576 bytes)EUR 29,90
(versandkostenfrei)


mi.gif (12x15 -- 70 bytes)SuSE Linux:
SUSE Linux 10.0 deutsch.
von Novell


amazon_small.gif (55x15 -- 576 bytes)EUR 48,95
(versandkostenfrei)


SuSE Linux 9.3 Professional
von Novell.


amazon_small.gif (55x15 -- 576 bytes)EUR 82,99
(versandkostenfrei)


SuSE Linux 9.3 Professional Update.
von Novell


amazon_small.gif (55x15 -- 576 bytes)EUR 59,95
(versandkostenfrei)

mi.gif (12x15 -- 70 bytes)Red Hat Linux:
Red Hat Linux Professional Workstation.

3827207525.03.MZZZZZZZ.jpg (134x150 -- 5811 bytes)
amazon_small.gif (55x15 -- 576 bytes)EUR 99,95
(versandkostenfrei)


Red Hat Linux 9 Personal.
Red Hat Linux 9 Professional.

3827207479.03.MZZZZZZZ.jpg (116x140 -- 3312 bytes)
amazon_small.gif (55x15 -- 576 bytes)ab EUR 39,99
(versandkostenfrei)

mi.gif (12x15 -- 70 bytes)Literaturhinweise:
Linux Administration Handbook
von Evi Nemeth, Garth Snyder u.a.

0130084662.03.MZZZZZZZ.jpg (104x140 -- 6538 bytes)

Englische Originalausgabe - 850 Seiten - 2002
amazon_small.gif (55x15 -- 576 bytes)EUR 49,90 (versandkostenfrei)
Deutsche Ausgabe - 998 Seiten - 2003
amazon_small.gif (55x15 -- 576 bytes)EUR 39,95 (versandkostenfrei)


The Linux Cookbook
von Michael Stutz

1886411484.01.MZZZZZZZ.jpg (110x140 -- 6489 bytes)
Englische Originalausgabe - 306 Seiten - 2001
amazon_small.gif (55x15 -- 576 bytes)EUR 36,50 (versandkostenfrei)

Linux Cookbook
von Carla Schroder
Englische Originalausgabe (O'Reilly)
553 Seiten - 2004
amazon_small.gif (55x15 -- 576 bytes)EUR 40,90 (versandkostenfrei)


Linux Rute User's Tutorial and Exposition
von Paul Sheer

0130333514.01.MZZZZZZZ.jpg (106x140 -- 6836 bytes)
amazon_small.gif (55x15 -- 576 bytes)
Englische Originalausgabe - 630 Seiten - 2001

mi.gif (12x15 -- 70 bytes)Amazon.de:
Suchen in:
Suchbegriffe:
Über Amazon.de
Kefk Network:
Thematisch verwandte Subsites:
Apple, BSD, Hardware, Internet, Microsoft Windows, Networking, Open Content, Open Source & Free Software, Politik, Recht, Safety, Security, Shopping, Software, The Tark, Webworking, Wissen.
Kefk Network Home
Hacker Emblem glider.png (55x55 -- 724 bytes)

 

Zurück ] Weiter ]

URL: http://www.kefk.net/Linux/Administration/Firewalling/Iptables/index.asp.
Translate this page to   Service provided by Google.
Website: About | Index | Inhalt | Site Map | Suchen | Wer ist online? | What's new?.
Thematisch verwandte Subsites: Apple | BSD | Open Source | Project »Tark« | Software | UNIX | Windows | Wissen.
Mirrors: Connected | DAHB | Debian-Howto | Jargon File | Linuxfibel | Linux-Buch | RUTE | SelfLinux | TeX.
Ergänzungen, Kommentare und Fragen: Kontakt | Foren | Wiki.
E-Mail: echo "asb at keNOSPAMfk.net"| sed -e "s/ at /@/" -e "s/NOSPAM//".
Registered Linux user: #34377 <http://counter.li.org>.
  Copyright | Credits | Disclaimer | Impressum | Rechtliche Hinweise | Wayback Machine.