



Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Prepara i tuoi esami
Studia grazie alle numerose risorse presenti su Docsity
Prepara i tuoi esami con i documenti condivisi da studenti come te su Docsity
Trova i documenti specifici per gli esami della tua università
Preparati con lezioni e prove svolte basate sui programmi universitari!
Rispondi a reali domande d’esame e scopri la tua preparazione
Riassumi i tuoi documenti, fagli domande, convertili in quiz e mappe concettuali
Studia con prove svolte, tesine e consigli utili
Togliti ogni dubbio leggendo le risposte alle domande fatte da altri studenti come te
Esplora i documenti più scaricati per gli argomenti di studio più popolari
Ottieni i punti per scaricare
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Appunti firewall iptables, utilizzo e sintassi
Tipologia: Appunti
1 / 7
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!




iptables -COMMAND CHAIN_NAME matches -j TARGET Table Command CHAIN matches Target/Jump filter (default) -A (append) INPUT -s source_ip ACCEPT nat -I (insert) OUTPUT -d dest_ip DROP mangle -D (delete) FORWARD -p protocol REJECT -R (replace) PREROUTING —sport source_p LOG -F (flush) POSTROUTING —dport dest_p SNAT -Z (zero) USER_DEFINED -i incoming_int DNAT -L (list) -o outgoing_int MASQUERADE -S (snow) -m mac LIMIT -N -m time RETURN -X -m quota TEE -m limit TOS -m recent TTL examples
iptables -A OUTPUT -p tcp --dport 443 -j DROP
iptables -I OUTPUT -p tcp --dport 443 -d www.linux.com -j ACCEPT
iptables -t filter -F OUTPUT
iptables -t filter -Z
iptables -D OUTPUT 2
iptables -P INPUT ACCEPT
iptables -N TCP_TRAFFIC
iptables -X TCP_TRAFFIC Structure of commands
raw: mark packets that should no be handled by the connection tracking system (PREROUTING and OUTPUT).
iptables -t nat -vnL
iptables -t nat -vnL POSTROUTING
Policy can be changed only for INPUT, OUTPUT and FORWARD chains. Policy can be changed using - P option.
set to drop, all traffic will be dropped.
iptables -P FORWARD DROP
iptables -P OUTPUT ACCEPT
iptables -P INPUT DROP
Delete all rules in chains and flush all tables from all chains. #1. Set the ACCEPT POLICY an all CHAINS iptables -P INPUT ACCEPT iptables -P OUTPUT ACCEPT iptables -P FORWARD ACCEPT #2. Flush all tables from all CHAINS iptables -t filter -F
iptables -t nat -F iptables -t mangle -F #3. Delete user-defined CHAINS (if there is any) iptables -X Matches
Match by Source IP or Network Address Match: -s IP Example : iptables -A INPUT -s 100.0.0.0/16 -j DROP Match by Destination IP or Network Address Match: -d IP Example : iptables -A OUTPUT -d www.ubuntu.com -j DROP
iptables -F
iptables -A INPUT -s 100.0.0.1 -j DROP
iptables -A INPUT -s 80.0.0.0/16 -p tcp --dport 22 -j ACCEPT
traffic must be permitted) iptables -A OUTPUT -p tcp --dport 443 -d www.ubuntu.com -j DROP
Match by Source IP Range Match: -m iprange —src-range ip_start-ip_end -m iprange —dst-range ip_start-ip_end
100.0.0.1 (management station) iptables -A INPUT -p tcp --dport 22! -s 100.0.0.1 -j DROP
iptables -A OUTPUT -p tcp --dport 443! -d www.linux.com -j DROP
gateway (mac is b4:6d:83:77:85:f4) iptables -A INPUT -m mac! --mac-source b4:6d:83:77:85:f4 -j DROP TODO: TARGET CONNTRACK FILTER BY INTERFACE