------
* http://openskill.info/topic.php?ID=124
-* http://iptables-tutorial.frozentux.net/iptables-tutorial.html
+* http://www.frozentux.net/iptables-tutorial/chunkyhtml/c962.html
Ipfilter
----------
Percorso dei pacchetti tra tabelle e catene
-------------------------------------------
-link: http://iptables-tutorial.frozentux.net/iptables-tutorial.html#TRAVERSINGOFTABLES
+E importante conoscere il percorso che i paccheti seguono passando tra le varie catene, l'ordine infatti puo' cambiare il riusultato ottenuto (che il pacchetto raggiunga o meno l'host, oppure modificare il pachetto stesso).
+
+link: http://www.frozentux.net/iptables-tutorial/chunkyhtml/c962.html
Concetti di base
~~~~~~~~~~~~~~~~~~~~
Per attivare la network address translation (in questo caso un SNAT) per la rete locale privata sull'indirizzo ip del *modem*::
- iptables -A POSTROUTING -s 192.168.0.0/255.255.255.0 -o ppp0 -j MASQUERADE
+ iptables -t nat -A POSTROUTING -s 192.168.0.0/255.255.255.0 -o ppp0 -j MASQUERADE
Il *Masquerading* a differenza dello *SNAT* puro (``-j SNAT --to-source proprio_ip_pubblico ) legge l'indirizzo ip del device ``ppp0``. In questo modo se l'IP cambia automaticamente si aggiorna anche il source natting. Se avete un indirizzo IP statico assegnato al vostro gateway potete invece usare lo SNAT semplice.
iptables -A INPUT -i ppp0 -p tcp -m tcp --dport 22 -m state --state NEW -m recent --set --name DEFAULT --rsource
+
+Proc filesystem
+---------------------
+
+Tramite il filesystem virtuale **proc** possiamo monitorare talvolta anche modificarei, a seconda dei casi, alcuni parametri utili per il networking. La parte di proc che ci interessa si riconduce al percorso: ``/proc/sys/net/ipv4`` : vediamo alcuni dei parametri fondamentali.
+
+ip_forward
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Questa variabile determine se l'instradamento dei pacchetti e' attvo, in caso positivo il kernel instradera' i pacchetti (routing). Con ip_forward settato a ``0`` la nostra macchina continuera' a vedere le varie reti su cui eventualmente si trova (gateway) ma non instradera' i pacchetti da parte di altri host.
+
+Questo parametro determina tutti gli instradamenti che il nostro host puo' fare, quindi e' determinante anche per NAT, firewall, masquerading.
+
+E' possibile settarlo per le singole interfacce, ad esempio per eth0: ``/proc/sys/net/ipv4/conf/eth0/forwarding`` .
+
+Per approfondimenti su cosa si intenda per instradamento: rfc1812.txt sezione 2.3::
+
+ In the Internet model, constituent networks are connected together by
+ IP datagram forwarders which are called routers or IP routers. In
+ this document, every use of the term router is equivalent to IP
+ router. Many older Internet documents refer to routers as gateways.
+
+ A router connects to two or more logical interfaces, represented by
+ IP subnets or unnumbered point to point lines (discussed in section
+ [2.2.7]). Thus, it has at least one physical interface. Forwarding
+ an IP datagram generally requires the router to choose the address
+ and relevant interface of the next-hop router or (for the final hop)
+ the destination host. This choice, called relaying or forwarding
+ depends upon a route database within the router. The route database
+ is also called a routing table or forwarding table. The term
+ "router" derives from the process of building this route database;
+ routing protocols and configuration interact in a process called
+ routing.
+
+ Routers provide datagram transport only, and they seek to minimize
+ the state information necessary to sustain this service in the
+ interest of routing flexibility and robustness.
+
+
+
+ip_default_ttl
+~~~~~~~~~~~~~~~~
+
+*Time to leave* di default usato dal nostro host: in genere ``64``.
+
+
+ip_local_port_range
+~~~~~~~~~~~~~~~~~~~~~
+
+Il range di porte usato dal nostro host quando si connette come client ad altri host. Puo' essere utile modificarlo per poi intercettare piu' facilmente i pacchetti provenienti da qusto host, oppupure quel qualunqe limitazione vogliamo imporre sul range da usarsi. Si ricorda che solo root puo' aprire porte sotto la ``1024``.
+
+
FTP Server
===========