doc:appunti:linux:sa:ipsec_strongswan
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:appunti:linux:sa:ipsec_strongswan [2021/02/05 16:31] – [Fine di configurazione] niccolo | doc:appunti:linux:sa:ipsec_strongswan [2024/05/06 16:02] (current) – [Host remoto (right) dietro NAT] niccolo | ||
|---|---|---|---|
| Line 11: | Line 11: | ||
| In alternativa al pacchetto **strongswan** è possibile installare **[[# | In alternativa al pacchetto **strongswan** è possibile installare **[[# | ||
| - | ===== Fine di configurazione ===== | + | ===== File di configurazione ===== |
| + | |||
| + | Qesti gli indirizzi IP coinvolti: | ||
| + | |||
| + | * **Lato Left (host locale)** | ||
| + | * IP pubblico: **132.82.168.98** | ||
| + | * Classe IP privata: **172.17.48.96/ | ||
| + | * **Lato Right (host remoto)** | ||
| + | * IP pubblico: **134.191.21.5** | ||
| + | * Classe IP privata: **172.17.48.80/ | ||
| **/ | **/ | ||
| < | < | ||
| + | config setup | ||
| + | # strictcrlpolicy=yes | ||
| + | # uniqueids = no | ||
| + | charondebug=" | ||
| + | # More control on Charon debug. Default level is 1 " | ||
| + | # level 2 is " | ||
| + | # | ||
| + | uniqueids = yes | ||
| + | |||
| include / | include / | ||
| </ | </ | ||
| + | |||
| + | **/ | ||
| + | |||
| + | < | ||
| + | include / | ||
| + | </ | ||
| + | |||
| **/ | **/ | ||
| Line 28: | Line 53: | ||
| authby=secret | authby=secret | ||
| left=132.82.168.98 | left=132.82.168.98 | ||
| - | leftsubnet=172.16.48.97/29 | + | leftsubnet=172.17.48.97/29 |
| right=134.191.21.5 | right=134.191.21.5 | ||
| - | rightsubnet=172.16.48.81/28 | + | rightsubnet=172.17.48.81/28 |
| ike=aes256-sha256-modp1536 | ike=aes256-sha256-modp1536 | ||
| esp=aes256-sha256-modp1536 | esp=aes256-sha256-modp1536 | ||
| Line 40: | Line 65: | ||
| dpdtimeout=120s | dpdtimeout=120s | ||
| dpdaction=restart | dpdaction=restart | ||
| + | closeaction=restart | ||
| + | </ | ||
| + | |||
| + | L' | ||
| + | |||
| + | < | ||
| + | charon: 07[IKE] received DELETE for IKE_SA office1-office2[5] | ||
| + | charon: 07[IKE] deleting IKE_SA office1-office2[5] | ||
| + | between 132.82.168.98[213.182.68.98]...134.191.21.5[134.191.21.5] | ||
| + | ipsec[30830]: | ||
| + | ipsec[30830]: | ||
| + | between 132.82.168.98[213.182.68.98]...134.191.21.5[134.191.21.5] | ||
| + | </ | ||
| + | |||
| + | **/ | ||
| + | |||
| + | < | ||
| + | # ------- Site 1 Gateway (office1-office2) ------- | ||
| + | 132.82.168.98 134.191.21.5 : PSK " | ||
| + | |||
| + | # ------- Site 2 Gateway (office2-office1) ------- | ||
| + | 134.191.21.5 132.82.168.98 : PSK " | ||
| + | </ | ||
| + | |||
| + | ===== Host remoto (right) dietro NAT ===== | ||
| + | |||
| + | Se l'host remoto è dietro NAT è necessario cambiare la configurazione, | ||
| + | |||
| + | < | ||
| + | ipsec[21090]: | ||
| + | ipsec[21090]: | ||
| + | ipsec[21090]: | ||
| + | ipsec[21090]: | ||
| + | ipsec[21090]: | ||
| + | ipsec[21090]: | ||
| + | </ | ||
| + | |||
| + | Si vede che l'host remoto ha indirizzo IP 10.151.252.18, | ||
| + | |||
| + | Anche questo messaggio è esplicativo: | ||
| + | |||
| + | < | ||
| + | ipsec[21090]: | ||
| + | ipsec[21090]: | ||
| + | </ | ||
| + | |||
| + | Nel file di configurazione **office1-office2.conf** va aggiunta l' | ||
| + | |||
| + | < | ||
| + | ... | ||
| + | right=134.191.21.5 | ||
| + | rightid=10.151.252.18 | ||
| + | ... | ||
| + | </ | ||
| + | |||
| + | e quindi nel file delle PSK si deve identificare l'host remoto con il suo IP privato: | ||
| + | |||
| + | < | ||
| + | # ------- Site 1 Gateway (office1-office2) ------- | ||
| + | 132.82.168.98 10.151.252.18 : PSK " | ||
| + | |||
| + | # ------- Site 2 Gateway (office2-office1) ------- | ||
| + | 10.151.252.18 132.82.168.98 : PSK " | ||
| + | </ | ||
| + | |||
| + | In alternativa si dovrebbe poter specificare **%%rightid=%any%%** in modo che un qualunque IP privato venga accettato. La PSK dovrebbe potersi selezionare in quel caso tramite l'IP pubblico. | ||
| + | |||
| + | ===== Configurazione Shorewall ===== | ||
| + | |||
| + | **/ | ||
| + | |||
| + | < | ||
| + | ACCEPT | ||
| + | ACCEPT | ||
| + | ACCEPT | ||
| + | </ | ||
| + | |||
| + | **ATTENZIONE**: | ||
| + | |||
| + | **/ | ||
| + | |||
| + | < | ||
| + | ipsec net 134.191.21.5 | ||
| + | </ | ||
| + | |||
| + | **/ | ||
| + | |||
| + | < | ||
| + | sec ipv4 | ||
| + | </ | ||
| + | |||
| + | **/ | ||
| + | |||
| + | < | ||
| + | sec eth0: | ||
| </ | </ | ||
| Line 109: | Line 229: | ||
| office1-office2: | office1-office2: | ||
| office1-office2: | office1-office2: | ||
| - | office1-office2: | + | office1-office2: |
| Security Associations (1 up, 0 connecting): | Security Associations (1 up, 0 connecting): | ||
| office1-office2[1]: | office1-office2[1]: | ||
| Line 117: | Line 237: | ||
| office1-office2{1}: | office1-office2{1}: | ||
| office1-office2{1}: | office1-office2{1}: | ||
| - | office1-office2{1}: | + | office1-office2{1}: |
| </ | </ | ||
doc/appunti/linux/sa/ipsec_strongswan.1612539084.txt.gz · Last modified: by niccolo
