Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Content imported from a Scroll Translations translation file.
Sv translation
languageen

CentOS 7

On CentOS 7, firewall-cmd is used to maintain the firewall.

List All Rules

Translations Ignore


Code Block
firewall-cmd --list-all


Allow a port

This example allows a TCP port through the firewall, for all network interfaces in the "public" zone:

Translations Ignore


Code Block
firewall-cmd --zone=public --add-port=3306/
tcp 
tcp --permanent



 

This example allows a UDP port through the firewall, for all network interfaces in the "public" zone:

Translations Ignore


Code Block
firewall-cmd --zone=public --add-port=20202/udp --permanent



Delete a rule
Translations Ignore


Code Block
firewall-cmd --zone=public --remove-port=3306/tcp --permanent


Reload the firewall

This makes the port changes active:

Translations Ignore


Code Block
firewall-cmd --reload

 



If port changes are specified without the --permanent flag, they will be active, but not permanent. The following command makes them permanent:

Translations Ignore


Code Block
firewall-cmd --runtime-to-permanent


CentOS 6

On CentOS 6, iptables is used to maintain the firewall.

Caution: iptables is cryptic and sometimes rather stupid. Especially: it will add multiple rules for the same port, and does not check if the port is already open.

List All Rules

Translations Ignore


Code Block
iptables -L -n


The -n option causes the ports to be listed numerically.
 


Alternatively:

Translations Ignore


Code Block
iptables-save > iptables_rules

less iptables_rules



This method is particularly useful for cleaning up duplicated rules.

Allow a port

This example allows a TCP port through the firewall:

Translations Ignore


Code Block
iptables -I INPUT 4 -p tcp -m tcp --dport 3306 -j ACCEPT

service iptables save




 

This example allows a UDP port through the firewall, for all network interfaces in the "public" zone:

Translations Ignore


Code Block
iptables -I INPUT 4 -p tcp -m udp --dport 20202 -j ACCEPT

service iptables save



Reload the firewall

This makes the port changes permanent:

Translations Ignore


Code Block
service iptables save


Delete a rule

The simplest way to delete rules in iptables, is to save and restore the configuration: 


First, save the rules:

Translations Ignore


Code Block
iptables-save > iptables_rules
 



Now edit the rules:

Translations Ignore


Code Block
vi iptables_rules

 



Now restore the rules, with the changes made, and make them permanent:

Translations Ignore


Code Block
iptables-restore < iptables_rules


service iptables save



Sv translation
languagede

CentOS 7

On CentOS 7, firewall-cmd is used to maintain the firewall.

List All Rules

Auf CentOS 7 wird firewall-cmd zur Wartung der Firewall verwendet.

Alle Regeln auflisten

Translations Ignore


Code Block
firewall-cmd --list-all


Einen Port zulassen

Dieses Beispiel erlaubt einen TCP-Port durch die Firewall für alle Netzwerkschnittstellen in der "public" (öffentlichen) Zone:

Translations Ignore


Code Block
firewall-cmd --zone=public --add-port=3306/tcp --permanent



Dieses Beispiel erlaubt einen UDP-Port durch die Firewall für alle Netzwerkschnittstellen in der "public" Zone:

Translations Ignore


Code Block
firewall-cmd --zone=public --add-port=20202/udp --permanent


Löschen einer Regel

Translations Ignore


Code Block
firewall-cmd --zone=public --remove-port=3306/tcp --permanent


Die Firewall neu laden

Dadurch werden die Portänderungen aktiv:

Translations Ignore


Code Block
firewall-cmd --reload



Wenn Port-Änderungen ohne das Kennzeichen --permanent angegeben werden, sind sie aktiv, aber nicht dauerhaft. Der folgende Befehl macht sie permanent:

firewall-cmd --runtime-to-permanent

CentOS 6

Auf CentOS 6 wird iptables zur Wartung der Firewall verwendet.

Vorsicht: iptables ist kryptisch und manchmal etwas dumm. Besonders: es fügt mehrere Regeln für den gleichen Port hinzu und prüft nicht, ob der Port bereits offen ist..

Alle Regeln auflisten

Translations Ignore


Code Block
iptables -L -n


Die Option -n bewirkt, dass die Ports numerisch aufgelistet werden.


Alternativ:

Translations Ignore


Code Block
iptables-save > iptables_rules
less iptables_rules



Diese Methode ist besonders nützlich, um doppelte Regeln zu bereinigen.

Einen Port zulassen

Dieses Beispiel lässt einen TCP-Port durch die Firewall zu:

Translations Ignore


Code Block
iptables -I INPUT 4 -p tcp -m tcp --dport 3306 -j ACCEPT
service iptables save



Dieses Beispiel erlaubt einen UDP-Port durch die Firewall für alle Netzwerkschnittstellen in der "public" Zone:

Translations Ignore


Code Block
iptables -I INPUT 4 -p tcp -m udp --dport 20202 -j ACCEPT
service iptables save


Firewall neu laden

Dadurch werden die Portänderungen dauerhaft:

Translations Ignore


Code Block
service iptables save


Löschen einer Regel

Der einfachste Weg, Regeln in iptables zu löschen, ist das Speichern und Wiederherstellen der Konfiguration:


Speichern Sie zunächst die Regeln:

Translations Ignore


Code Block
iptables-save > iptables_rules



Bearbeiten Sie nun die Regeln:

Translations Ignore


Code Block
vi iptables_rules



Stellen Sie nun die Regeln mit den vorgenommenen Änderungen wieder her und machen Sie sie dauerhaft:

Translations Ignore


Code Block
iptables-restore < iptables_rules
service iptables save



Sv translation
languagefr

CentOS 7

Sur CentOS 7, firewall-cmd est utilisé pour maintenir le pare-feu.

Liste de toutes les règles

Translations Ignore


Code Block
firewall-cmd --list-all
Allow a


Autoriser un port

This example allows a TCP port through the firewall, for all network interfaces in the "public" zone:

Cet exemple permet un port TCP à travers le pare-feu, pour toutes les interfaces réseau dans la zone "publique" :

Translations Ignore


Code Block
firewall-cmd 
firewall-cmd
--zone=public --add-port=3306/
tcp 
tcp --permanent
This example allows a UDP port through the firewall, for all network interfaces in the "public" zone:



Cet exemple permet un port UDP à travers le pare-feu, pour toutes les interfaces réseau dans la zone "publique" :

Translations Ignore


Code Block
firewall-cmd 
firewall-cmd
--zone=public --add-port=20202/udp --permanent
Delete a rule



Supprimer une règle
Translations Ignore


Code Block
firewall-cmd --zone=public --remove-port=3306/tcp --permanent

Reload the firewall

This makes the port changes active:


Recharger le pare-feu

Cela rend les changements de port actifs :

Translations Ignore


Code Block
firewall-cmd --
reloadIf port changes are specified without the
list-all



Si les changements de port sont spécifiés sans l'option --permanent

flag, they will be active, but not permanent. The following command makes them permanent:

, ils seront actifs, mais pas permanents. La commande suivante les rend permanents :

Translations Ignore


Code Block
firewall-cmd --runtime-to-permanent


CentOS 6

On

Sur CentOS 6,

 iptables is used to maintain the firewall.

Caution: iptables is cryptic and sometimes rather stupid. Especially: it will add multiple rules for the same port, and does not check if the port is already open.

List All Rules

iptables est utilisé pour maintenir le pare-feu.

Attention : iptables est cryptique et parfois assez stupide. Surtout : il ajoute plusieurs règles pour le même port, et ne vérifie pas si le port est déjà ouvert.

Liste de toutes les règles

Translations Ignore


Code Block
iptables -L -n

The -n option causes the ports to be listed numerically.

Alternatively:


L'option -n entraîne l'affichage d'une liste numérique des ports.


Alternativement :

Translations Ignore


Code Block
iptables-save > iptables_rules
 less iptables_rules

This method is particularly useful for cleaning up duplicated rules.

Allow a port

This example allows a TCP port through the firewall:
iptables -I INPUT 4 -p tcp -m tcp --dport 3306 -j ACCEPT
service iptables save

This example allows a UDP port through the firewall, for all network interfaces in the "public" zone:
iptables -I INPUT 4 -p tcp -m udp --dport 20202 -j ACCEPT
service iptables save

Reload the firewall

This makes the port changes permanent:



Cette méthode est particulièrement utile pour nettoyer les règles dupliquées.

Autoriser un port

Cet exemple permet un port TCP à travers le pare-feu :

Translations Ignore


Code Block
iptables -I INPUT 4 -p tcp -m tcp --dport 3306 -j ACCEPT service iptables save




Cet exemple permet un port UDP à travers le pare-feu, pour toutes les interfaces réseau dans la zone "publique" :

Translations Ignore


Code Block
iptables -I INPUT 4 -p tcp -m udp --dport 20202 -j ACCEPT service iptables save



Recharger le pare-feu

Cela rend les changements de port permanents :

Translations Ignore


Code Block
service iptables save

Delete a rule

The simplest way to delete rules in iptables, is to save and restore the configuration:

First, save the rules:


Supprimer une règle

La façon la plus simple de supprimer des règles dans iptables, est de sauvegarder et de restaurer la configuration :


D'abord, sauvegardez les règles :

Translations Ignore


Code Block
iptables-save > iptables_rules
Now edit the rules



Maintenant, modifiez les règles :

Translations Ignore


Code Block
vi iptables_rules

Now restore the rules, with the changes made, and make them permanent:



Restaurez maintenant les règles, avec les modifications apportées, et rendez-les permanentes :

Translations Ignore


Code Block
iptables-restore < iptables_rules

 service iptables save