Vai al contenuto

ΛG

__

cropped-seguimi-su-youtube-grigio2.png
Menu principale
  • ⏎
  • BLOG
  • ARTICOLI
    • Tecnologia
    • Giochi
    • Pensieri
    • Apple Mac
    • Windows
    • Linux
    • Raspberry-Pi
    • Software
  • RECENSIONI
    • LE MIE RECENSIONI
    • RECENSIONI FILMS
  • I VIDEO
    • I MIEI ULTIMI VIDEO
    • LE CREAZIONI DI MATILDA
  • TUTORIALS
  • CHI SONO?
Pulsante chiaro/scuro
  • Linux
  • Linux
  • Software
  • Ultime

Installare e configurare Iptables su Linux CentOS

amnesyswt 6 Agosto 2013

firewallCon questo Post andiamo a illustrare la procedura per installare e configurare iptables su un server Linux CentOS 6.3.

Iptables è un pacchetto software che permette al sistema Linux di diventare un potente Firewall Software.

E’ usato per impostare, mantenere e ispezionare le tabelle delle regole di filtraggio dei pacchetti IP direttamente dal Kernel di Linux.

Interfacciandolo alla rete Lan, Iptables permette a Linux di eseguire anche un controllo e filtraggio dei pacchetti di rete.

1. Per installare iptables, basta eseguire il seguente comando:

[root@centos63 ~]# yum install iptables -y

2. Controllate a questo punto la versione del pacchetto di Iptables installato:

[root@centos63 ~]# rpm -qa | grep iptables
iptables-ipv6-1.4.7-5.1.el6_2.i686
iptables-1.4.7-5.1.el6_2.i686

3. Controllate lo stato di Iptables:

[root@centos63 ~]# /etc/init.d/iptables status
iptables: Firewall is not running.

o

[root@centos63 ~]# service iptables status
iptables: Firewall is not running.

4. Avvio e Stop di Iptables :

Start :

[root@centos63 ~]# service iptables start
iptables: Applying firewall rules: [ OK ]

Stop :

[root@centos63 ~]# service iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]

5. Settare l’avvio automatic alla partenza di Iptables:

[root@centos63 ~]# chkconfig iptables on

6. Visualizzare le regole di base di Iptables:

[root@centos63 ~]# cat /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
-A INPUT -j REJECT –reject-with icmp-host-prohibited
-A FORWARD -j REJECT –reject-with icmp-host-prohibited
COMMIT

7. Visualizzare le porte correnti aperte:

[root@centos63 ~]# netstat -plunt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:46915 0.0.0.0:* LISTEN 1170/rpc.statd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1538/mysqld
tcp 0 0 127.0.0.1:3310 0.0.0.0:* LISTEN 1406/clamd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1152/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1390/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1629/master
tcp 0 0 :::111 :::* LISTEN 1152/rpcbind
tcp 0 0 :::59988 :::* LISTEN 1170/rpc.statd
tcp 0 0 :::22 :::* LISTEN 1390/sshd
tcp 0 0 ::1:25 :::* LISTEN 1629/master
udp 0 0 0.0.0.0:59738 0.0.0.0:* 1170/rpc.statd
udp 0 0 0.0.0.0:111 0.0.0.0:* 1152/rpcbind
udp 0 0 192.168.1.54:123 0.0.0.0:* 1398/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 1398/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 1398/ntpd
udp 0 0 0.0.0.0:903 0.0.0.0:* 1152/rpcbind
udp 0 0 0.0.0.0:922 0.0.0.0:* 1170/rpc.statd
udp 0 0 :::50667 :::* 1170/rpc.statd
udp 0 0 :::111 :::* 1152/rpcbind
udp 0 0 fe80::20c:29ff:fe1b:b39c:123 :::* 1398/ntpd
udp 0 0 ::1:123 :::* 1398/ntpd
udp 0 0 :::123 :::* 1398/ntpd
udp 0 0 :::903 :::* 1152/rpcbind
8. Modificare il file originale di Iptables:
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
-A INPUT -j REJECT –reject-with icmp-host-prohibited
-A FORWARD -j REJECT –reject-with icmp-host-prohibited
COMMIT

Notate che due regole sono state aggiunte alle regole standard di Iptables:

-A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT

Buon lavoro e buon divertimento con il vostro nuovo Firewall !

Scansiona il QR Code

Navigazione articolo

Precedente: Installare SSH su linux CentOS
Successivo: Verificare il Trim su dischi SSD

Storie correlate

hqdefault.jpg
  • NO-TOP
  • Blog
  • Tecnologia
  • Ultime

HDMI SENZA FILI fino a 400 METRI?! 😱 Test BDFFLY Wireless HDMI 5GHz: Funziona Davvero?

Lex G 21 Settembre 2026
hqdefault
  • NO-TOP
  • Blog
  • Notizie
  • Tecnologia
  • Ultime

JUOVI SOUND J1 | La Cassa Bluetooth Impermeabile Definitiva

Lex G 21 Settembre 2026
aosu T2 Ultra Kit telecamere di sicurezza 4K
  • Blog
  • Cronaca
  • Notizie
  • Spettacolo
  • Tecnologia
  • Ultime

aosu T2 Ultra System le mie telecamere di sicurezza da oggi!

Lex G 15 Settembre 2026

Le mie recensioni

KKTICK TANK T6 🔥 GPS + MAPPE OFFLINE: è DAVVERO così BUONO? TEST & RECENSIONE

I Tutorials

Ho ELIMINATO Adobe | Ecco perché sono passato a UPDF (MEGLIO e più ECONOMICO?)

I video di Matilda

legami UNBOXING MAGIC! 🎃 Matilda scopre le BLIND BOX HALLOWEEN

Ultimi Articoli

  • HDMI SENZA FILI fino a 400 METRI?! 😱 Test BDFFLY Wireless HDMI 5GHz: Funziona Davvero?
  • JUOVI SOUND J1 | La Cassa Bluetooth Impermeabile Definitiva
  • aosu T2 Ultra System le mie telecamere di sicurezza da oggi!
  • XPPen Pilot Pro: il joystick che può cambiare il modo di fare video editing
  • 🦶 OK TAPE KINESIO TAPE: LA SOLUZIONE CHE NON TI ASPETTI PER IL PIEDE!

Ma questi articoli li hai già visti?

hqdefault.jpg
  • NO-TOP
  • Blog
  • Tecnologia
  • Ultime

HDMI SENZA FILI fino a 400 METRI?! 😱 Test BDFFLY Wireless HDMI 5GHz: Funziona Davvero?

Lex G 21 Settembre 2026
hqdefault
  • NO-TOP
  • Blog
  • Notizie
  • Tecnologia
  • Ultime

JUOVI SOUND J1 | La Cassa Bluetooth Impermeabile Definitiva

Lex G 21 Settembre 2026
aosu T2 Ultra Kit telecamere di sicurezza 4K
  • Blog
  • Cronaca
  • Notizie
  • Spettacolo
  • Tecnologia
  • Ultime

aosu T2 Ultra System le mie telecamere di sicurezza da oggi!

Lex G 15 Settembre 2026
Bende kinesitherapie una soluzione naturale per i dolori
  • NO-TOP
  • Blog
  • Ultime

🦶 OK TAPE KINESIO TAPE: LA SOLUZIONE CHE NON TI ASPETTI PER IL PIEDE!

Lex G 9 Agosto 2026
© copyright ΛG dal 1997 - tutti i diritti e contenuti riservati | MoreNews di AF themes.
ΛG
  • ⏎
  • BLOG
  • ARTICOLI
    • Tecnologia
    • Giochi
    • Pensieri
    • Apple Mac
    • Windows
    • Linux
    • Raspberry-Pi
    • Software
  • RECENSIONI
    • LE MIE RECENSIONI
    • RECENSIONI FILMS
  • I VIDEO
    • I MIEI ULTIMI VIDEO
    • LE CREAZIONI DI MATILDA
  • TUTORIALS
  • CHI SONO?
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy

Questo sito Web utilizza i cookie per migliorare la tua esperienza durante la navigazione nel sito Web. Di questi, i cookie classificati come necessari vengono memorizzati nel browser in quanto sono essenziali per il funzionamento delle funzionalità di base del sito web. Utilizziamo anche cookie di terze parti che ci aiutano ad analizzare e comprendere come utilizzi questo sito web. Questi cookie verranno memorizzati nel tuo browser solo con il tuo consenso. Hai anche la possibilità di disattivare questi cookie. Tuttavia, la disattivazione di alcuni di questi cookie potrebbe influire sulla tua esperienza di navigazione.
Necessary
Sempre abilitato
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
ACCETTA E SALVA
ΛG
  • ⏎
  • BLOG
  • ARTICOLI
    • Tecnologia
    • Giochi
    • Pensieri
    • Apple Mac
    • Windows
    • Linux
    • Raspberry-Pi
    • Software
  • RECENSIONI
    • LE MIE RECENSIONI
    • RECENSIONI FILMS
  • I VIDEO
    • I MIEI ULTIMI VIDEO
    • LE CREAZIONI DI MATILDA
  • TUTORIALS
  • CHI SONO?

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin