English / Deutsch | Druckversion Plop Linux  
Twitter
twitter

<< Zurück
Kompilieren

Inhaltsverzeichnis

Weiter >>
PXE Netzwerk Boot Server

Konfiguration


Da alle Programme vom original Source Code kompiliert werden, sind sie wie auf deren Webseite zu konfigurieren. Die Programme werden so kompiliert, dass sich die Konfigurationsdateien in /etc, das Programm und die Daten in /usr und /var befinden.


Firewall


Iptables wird verwendet um die Firewallregeln einzustellen.

Erstellen Sie ein Skript mit Ihren Firewallregeln im Verzeichnis /var/firewall/ mit dem Namen firewall.sh

Setzen Sie die Rechte mit chmod 700 /var/firewall/firewall.sh

Um die Firewall automatisch beim Booten zu aktivieren, tragen Sie das Skript in die /etc/rc.local ein. Schreiben Sie /var/firewall/firewall.sh über der Zeile mit ifconfig oder dhclient in der /etc/rc.local Datei.


/var/firewall/firewall.sh


Lesen Sie die Dokumentation von iptables um die Firewall für Ihre Anforderungen zu konfigurieren. Hier sehen Sie noch ein paar Beispiele für Firewallskripts. Sie sind für die Firewallkonfiguration Ihrer Firewall selbst verantwortlich!

Ein einfaches Firewall Beispiel

#!/bin/sh

IPTABLES=/usr/sbin/iptables


# Deny access from outside.
$IPTABLES -P INPUT DROP
$IPTABLES -P FORWARD DROP

# Permit anything going out.
$IPTABLES -P OUTPUT ACCEPT

# Flush (-F) all specific rules.
$IPTABLES -F INPUT
$IPTABLES -F FORWARD
$IPTABLES -F OUTPUT

# Allow connection to port 22 (SSH) from internet
$IPTABLES -A INPUT -p tcp -i eth0 --dport 22  -j ACCEPT


Ein einfaches Firewallskript mit der unktion eines Gateways

#!/bin/sh

IPTABLES=/usr/sbin/iptables

LANETH=eth1
WANETH=eth0

# Permit anything going out and drop input
$IPTABLES -P INPUT DROP
$IPTABLES -P FORWARD DROP
$IPTABLES -P OUTPUT ACCEPT

# Flush (-F) all specific rules
$IPTABLES -F INPUT
$IPTABLES -F FORWARD
$IPTABLES -F OUTPUT
$IPTABLES -F -t nat


$IPTABLES -A INPUT -i $WANETH -p udp -j ACCEPT
$IPTABLES -A INPUT -i $WANETH -p icmp -j ACCEPT

# Forward all packets from $LANETH (internal network) to $WANETH (the internet).
$IPTABLES -A FORWARD -i $LANETH -o $WANETH -j ACCEPT

# Forward packets that are part of existing and related connections from $WANETH to $LANETH.
$IPTABLES -A FORWARD -i $WANETH -o $LANETH -m state --state ESTABLISHED,RELATED -j ACCEPT

# Permit packets in to firewall itself that are part of existing and related connections.
$IPTABLES -A INPUT -i $WANETH -m state --state ESTABLISHED,RELATED -j ACCEPT


# Allow connection to port 22 (SSH) from internet
$IPTABLES -A INPUT -p tcp -i $WANETH --dport 22  -j ACCEPT


# Allow all inputs to firewall from the internal network and local interfaces
$IPTABLES -A INPUT -i $LANETH -s 0/0 -d 0/0 -j ACCEPT
$IPTABLES -A INPUT -i lo -s 0/0 -d 0/0 -j ACCEPT

# Accept inputs from port 9000 and above
$IPTABLES -A INPUT -p tcp -i $WANETH --dport 9000: -j ACCEPT

# Enable SNAT functionality on $WANETH
$IPTABLES -A POSTROUTING -t nat  -o $WANETH -j MASQUERADE

echo 1 > /proc/sys/net/ipv4/ip_forward



<< Zurück
Kompilieren

Inhaltsverzeichnis

Weiter >>
PXE Netzwerk Boot Server


© 2024 by Elmar Hanlhofer