IPTables » Historique » Version 27
Laurent GUERBY, 25/08/2014 19:35
1 | 1 | Laurent GUERBY | {{>toc}} |
---|---|---|---|
2 | 1 | Laurent GUERBY | |
3 | 1 | Laurent GUERBY | h1. IPTables |
4 | 1 | Laurent GUERBY | |
5 | 22 | Laurent GUERBY | h2. iptables links |
6 | 22 | Laurent GUERBY | |
7 | 1 | Laurent GUERBY | * http://www.bortzmeyer.org/dns-netfilter-u32.html |
8 | 1 | Laurent GUERBY | * http://www.stearns.org/doc/iptables-u32.current.html |
9 | 1 | Laurent GUERBY | * http://ebtables.sourceforge.net/br_fw_ia/PacketFlow.png |
10 | 1 | Laurent GUERBY | * http://ebtables.sourceforge.net/ |
11 | 6 | Laurent GUERBY | * http://www.inetdoc.net/guides/iptables-tutorial/traversingoftables.html |
12 | 11 | Laurent GUERBY | * http://upload.wikimedia.org/wikipedia/commons/3/37/Netfilter-packet-flow.svg |
13 | 10 | Laurent GUERBY | * https://en.wikipedia.org/wiki/List_of_router_or_firewall_distributions |
14 | 2 | Laurent GUERBY | |
15 | 2 | Laurent GUERBY | DHCP ? |
16 | 3 | Laurent GUERBY | sysctl -w net.bridge.bridge-nf-call-iptables=1 |
17 | 3 | Laurent GUERBY | sysctl -w net.bridge.bridge-nf-call-ip6tables=1 |
18 | 3 | Laurent GUERBY | iptables -A INPUT -p udp --sport 68 --dport 67 -j DROP |
19 | 2 | Laurent GUERBY | |
20 | 4 | Laurent GUERBY | https://bugzilla.redhat.com/show_bug.cgi?id=512206 |
21 | 4 | Laurent GUERBY | |
22 | 7 | Laurent GUERBY | * libnml |
23 | 7 | Laurent GUERBY | ** http://www.spinics.net/lists/netfilter/msg52868.html |
24 | 7 | Laurent GUERBY | ** http://1984.lsi.us.es/~pablo/docs/spae.pdf |
25 | 22 | Laurent GUERBY | |
26 | 22 | Laurent GUERBY | h2. iptables hairpin |
27 | 22 | Laurent GUERBY | |
28 | 22 | Laurent GUERBY | Hair pin / hairpin / hairpinning / NAT reflection |
29 | 22 | Laurent GUERBY | |
30 | 22 | Laurent GUERBY | http://serverfault.com/questions/205040/accessing-the-dnatted-webserver-from-inside-the-lan |
31 | 22 | Laurent GUERBY | |
32 | 25 | Laurent GUERBY | Avec : |
33 | 25 | Laurent GUERBY | * PUB_IP = ip publique sur le host et interface eth0 |
34 | 25 | Laurent GUERBY | * LXC_IP = l'ip privee de la VM dans 192.168.100.0/24 |
35 | 25 | Laurent GUERBY | * PORT_LIST = 80,443 (et d'autres) la liste des ports a transferer a la VM |
36 | 22 | Laurent GUERBY | |
37 | 1 | Laurent GUERBY | <pre> |
38 | 24 | Laurent GUERBY | iptables -t nat -A POSTROUTING -s 192.168.100.0/24 -o eth0 -j MASQUERADE |
39 | 25 | Laurent GUERBY | iptables -t nat -A PREROUTING -d ${PUB_IP}/32 -p tcp -m multiport --dports ${PORT_LIST} -j DNAT --to-destination ${LXC_IP} |
40 | 24 | Laurent GUERBY | iptables -t nat -A POSTROUTING -s 192.168.100.0/24 -d ${LXC_IP}/32 -p tcp -m multiport --dports ${PORT_LIST} -j MASQUERADE |
41 | 24 | Laurent GUERBY | iptables -t nat -A OUTPUT -d ${PUB_IP} -p tcp -m multiport --dports ${PORT_LIST} -j DNAT --to-destination ${LXC_IP} |
42 | 22 | Laurent GUERBY | </pre> |
43 | 7 | Laurent GUERBY | |
44 | 26 | Laurent GUERBY | * ligne 1 : pour que la VM puisse acceder a l'internet il faut le NAT |
45 | 26 | Laurent GUERBY | * ligne 2 : redirection des ports de l'ip publique vers la VM |
46 | 26 | Laurent GUERBY | * ligne 3 : si la VM veut parler a l'IP publique il faut faire un reflection NAT vers la VM |
47 | 27 | Laurent GUERBY | * ligne 4 : si le host veut parler a l'IP publique sur un port géré par la VM il faut diriger vers la VM |
48 | 26 | Laurent GUERBY | |
49 | 2 | Laurent GUERBY | h1. ebtables |
50 | 2 | Laurent GUERBY | |
51 | 9 | Laurent GUERBY | ebtables -A FORWARD -d ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff -p IPv4 --ip-prot udp --ip-dport 67:68 -j DROP |
52 | 9 | Laurent GUERBY | |
53 | 2 | Laurent GUERBY | * http://serverfault.com/questions/284290/two-dhcp-servers-block-clients-for-one-of-them |
54 | 5 | Laurent GUERBY | |
55 | 5 | Laurent GUERBY | ebtables -A INPUT --in-interface br0 --protocol ipv4 --ip-protocol udp --ip-source-port 67:68 -j DROP |
56 | 5 | Laurent GUERBY | ebtables -A INPUT --in-interface br0 --protocol ipv4 --ip-protocol udp --ip-destination-port 67:68 -j DROP |
57 | 5 | Laurent GUERBY | ebtables -A FORWARD --in-interface br0 --protocol ipv4 --ip-protocol udp --ip-destination-port 67:68 -j DROP |
58 | 5 | Laurent GUERBY | ebtables -A FORWARD --in-interface br0 --protocol ipv4 --ip-protocol udp --ip-source-port 67:68 -j DROP |
59 | 8 | Laurent GUERBY | |
60 | 8 | Laurent GUERBY | h1. ipset |
61 | 8 | Laurent GUERBY | |
62 | 8 | Laurent GUERBY | http://ipset.netfilter.org/ |