brouillon_ipsec
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
brouillon_ipsec [2009/06/30 00:15] – thierry | brouillon_ipsec [2009/07/04 21:46] (Version actuelle) – thierry | ||
---|---|---|---|
Ligne 32: | Ligne 32: | ||
2 modes de fonctionnement: | 2 modes de fonctionnement: | ||
*transport : authentifier/ | *transport : authentifier/ | ||
- | *tunnel : authentifier/ | + | *tunnel : authentifier/ |
Ligne 371: | Ligne 371: | ||
===== Tips ===== | ===== Tips ===== | ||
- | ==== ike-scan | + | ==== Route et MTU ==== |
+ | On doit parfois jouer avec les routes... | ||
- | # aptitude install ike-scan | + | Mais aussi avec la MTU. |
- | # /etc/init.d/ipsec stop | + | |
- | # ike-scan -M 172.16.0.33 | + | |
- | Starting ike-scan 1.9 with 1 hosts (http:// | + | |
- | 172.16.0.33 | + | |
- | HDR=(CKY-R=46746e295468b2d5) | + | |
- | SA=(Enc=3DES Hash=SHA1 Auth=PSK Group=2: | + | |
- | VID=4f45606c50487c5662707575 | + | |
- | VID=afcad71368a1f1c96b8696fc77570100 (Dead Peer Detection v1.0) | + | |
- | ===== Openswan ===== | + | Pour mémoire, on peut utiliser ce format de commande par exemple: |
+ | # ip route add < | ||
+ | Par exemple: | ||
+ | # ip route add 192.168.1.0/ | ||
+ | Ainsi, ce qui est a destination de la classe " | ||
- | Lien: http:// | ||
- | Malgré tout les tutorials, aucun ne fonctionne comme voulu.\\ | + | ==== iptables ==== |
- | Donc, j' | + | $IPTABLES -A INPUT -i eth0 -p esp -j ACCEPT |
+ | $IPTABLES -A INPUT -i eth0 -p ah -j ACCEPT | ||
+ | $IPTABLES -A INPUT -i eth0 -p udp --dport 500 -j ACCEPT | ||
- | ==== Test sur le même LAN ==== | + | Faire des bizarreries, |
- | === exemple === | + | ==== ike-scan |
- | + | ||
- | Soit 2 becannes sur le même LAN, mais souhaitant partagé " | + | |
- | + | ||
- | PC-A (" | + | |
- | IP: 172.16.0.33 | + | |
- | LAN SECRET: 192.168.50/ | + | |
- | + | ||
- | PC-B (" | + | |
- | IP: 172.16.0.39 | + | |
- | LAN SECRET: aucun | + | |
- | + | ||
- | Sur PC-A: | + | |
- | # cat / | + | |
- | 172.16.0.33 172.16.0.39 : PSK " | + | |
- | + | ||
- | # cat / | + | |
- | version 2.0 # conforms to second version of ipsec.conf specification | + | |
- | + | ||
- | config setup | + | |
- | nhelpers=0 | + | |
- | + | ||
- | conn mynet | + | |
- | authby=secret | + | |
- | left=172.16.0.33 | + | |
- | leftsubnet=192.168.50.0/ | + | |
- | right=172.16.0.39 | + | |
- | auto=start | + | |
- | + | ||
- | include / | + | |
- | + | ||
- | Copier **'' | + | |
- | + | ||
- | Inverser les IP dans le fichier **'' | + | |
- | 172.16.0.39 172.16.0.33 : PSK " | + | |
- | + | ||
- | Puis, sur chacun des PC: | + | |
- | # / | + | |
- | + | ||
- | Un test montre que les requetes ARP passent aussi !? | + | |
- | + | ||
- | === explications === | + | |
- | + | ||
- | (sous réserve d' | + | |
- | + | ||
- | *" | + | |
- | *" | + | |
- | *" | + | |
- | *" | + | |
- | + | ||
- | Les 2 ne sont pas obligés de partager... | + | |
- | + | ||
- | + | ||
- | === pluto === | + | |
- | # cat / | + | |
- | Jun 24 11:43:29 xxxxxx ipsec__plutorun: | + | |
- | Jun 24 11:43:29 xxxxxx ipsec__plutorun: | + | |
- | + | ||
- | === ike-scan === | + | |
# aptitude install ike-scan | # aptitude install ike-scan | ||
Ligne 463: | Ligne 403: | ||
VID=afcad71368a1f1c96b8696fc77570100 (Dead Peer Detection v1.0) | VID=afcad71368a1f1c96b8696fc77570100 (Dead Peer Detection v1.0) | ||
- | ==== Test sur 2 IP Public | + | ===== Openswan ===== |
- | Faire partager un reseau local, entre 2 IP public. | + | Lien: http://wiki.debian.org/ |
- | === conf === | + | Malgré tout les tutoriaux, rien ne fonctionne comme voulu.\\ |
- | + | ||
- | " | + | |
- | + | ||
- | Sur " | + | |
- | + | ||
- | # cat ipsec.secrets | + | |
- | IP_PUBLIC_20 IP_PUBLIC_15 : PSK " | + | |
- | + | ||
- | # cat ipsec.conf | + | |
- | version 2.0 # conforms to second version of ipsec.conf specification | + | |
- | + | ||
- | config setup | + | |
- | nat_traversal=yes | + | |
- | nhelpers=0 | + | |
- | + | ||
- | conn mynet | + | |
- | authby=secret | + | |
- | left=IP_PUBLIC_20 | + | |
- | leftsubnet=192.168.1.0/ | + | |
- | leftnexthop=IP_PUBLIC_15 | + | |
- | right=IP_PUBLIC_15 | + | |
- | rightnexthop=IP_PUBLIC_20 | + | |
- | auto=start | + | |
- | + | ||
- | include / | + | |
- | + | ||
- | Sur IP_PUBLIC_15 : \\ | + | |
- | (Simple inversion) | + | |
- | # cat ipsec.secrets | + | |
- | IP_PUBLIC_15 IP_PUBLIC_20 : PSK " | + | |
- | Et " | + | |
- | + | ||
- | === detaillons === | + | |
- | Au niveau IP, c'est un peu étrange... | + | |
- | + | ||
- | Sur IP_PUBLIC_A : | + | |
- | # route -n | + | |
- | Table de routage IP du noyau | + | |
- | Destination | + | |
- | IP_PUBLIC_15 | + | |
- | 192.168.1.0 | + | |
- | ... | + | |
- | + | ||
- | Sur IP_PUBLIC_B : | + | |
- | # route -n | + | |
- | Table de routage IP du noyau | + | |
- | Destination | + | |
- | 192.168.1.0 | + | |
- | ... | + | |
- | + | ||
- | Au niveau du firewall IP_PUBLIC_A : | + | |
- | WAN_IF=eth0 | + | |
- | WIFI_IF=eth1 | + | |
- | + | ||
- | # ipsec test | + | |
- | + | ||
- | $IPTABLES -A INPUT -i $WAN_IF -p 50 -s IP_PUBLIC_15 -j ACCEPT | + | |
- | $IPTABLES -A INPUT -i $WAN_IF -p 51 -s IP_PUBLIC_15 -j ACCEPT | + | |
- | + | ||
- | $IPTABLES -A INPUT -i $WAN_IF -s IP_PUBLIC_15 -d 192.168.1.0/ | + | |
- | $IPTABLES -A OUTPUT -o $WAN_IF -d IP_PUBLIC_15 -s 192.168.1.0/ | + | |
- | + | ||
- | $IPTABLES -A FORWARD -i $WAN_IF -o $WIFI_IF -j ACCEPT | + | |
- | $IPTABLES -A FORWARD -i $WIFI_IF -o $WAN_IF -j ACCEPT | + | |
+ | Donc, j' | ||
+ | Et finalement, " |
brouillon_ipsec.1246320907.txt.gz · Dernière modification : 2009/06/30 00:15 de thierry