IPsec a routovani

linux na edoras.cz linux na edoras.cz
Čtvrtek Listopad 3 01:28:17 CET 2005


Snazim se rozebehnout tunel mezi dvemi sitemi, zalozeny na IPsec. 
Postupoval jsem podle tohoto navodu: 
http://www.ipsec-howto.org/x299.html . Jediny rozdil je v tom, ze 
routery, ktere se snazim propojit, jsou na internetu na zcela odlisnych 
subnetech:

(192.168.111.0/24) - 212.65.25.1 <----------> 193.179.44.25 - 
(192.168.1.0/24)

A dalsi rozdil je v tom, ze jsem pouzil distribucni jadro z fedora core 
4 a pouze dohral moduly (seznam viz nize)

Jde mi o to, aby se pocitace ze site 192.168.111.0/24 dostali do site 
192.168.1.0/24 a opacne.
Kofiguraky prikladam nize. Pote, co jsem oba routery nastavil podle 
navodu, ocekaval jsem, ze vznikne nejake zarizeni, nebo jako ipsec0, 
kteremu priradim IPcka a nastavim je do routovaci tabulky. nic takoveho 
se ale nestalo.
Pingy z routeru z jedne strany a ipcko v druhe siti nejdou do tohoto 
tunelu (pochopitelne, kdyz nemaji routu) a padaji na default gw.
Vyse uvedeny manual, podle ktereho jsem postupoval, dodava: "If you 
tunnel is not working, please check your routing. Your hosts need to 
know that they should send the packets for the opposite network to you 
vpn gateway.". to je sice hezke, nicmene nechapu jak mam routeru 
vysvetlit, kam ma posilat pakety pro druhou sit, kdyz mi zadny 
interface, kam bych mohl pakety routovat, nevznikl.
Poradte prosim, co delam spatne.

diky, Jirka M.


Jadro: 2.6.12-1.1398_FC4

dohrane moduly:
modprobe af_key
modprobe ipt_ah
modprobe ah4
modprobe ah6
modprobe ip6t_ah
modprobe libipt_ah
modprobe ipt_esp
modprobe esp4
modprobe ip6t_esp
modprobe esp6
modprobe libipt_esp
modprobe xfrm4_tunnel
modprobe xfrm6_tunnel
modprobe crypto_null
modprobe md5
modprobe sha512
modprobe sha256
modprobe des
modprobe aes-i586

konfigurak routeru 212.65.25.1: ------------------------------

#!/sbin/setkey -f

# Flush the SAD and SPD
flush;
spdflush;

# ESP SAs doing encryption using 192 bit long keys (168 + 24 parity)
# and authentication using 128 bit long keys
add 212.65.25.1 193.179.44.25 esp 0x201 -m tunnel -E 3des-cbc
0x<sifra>
-A hmac-md5 0x<sifra>;

add 193.179.44.25 212.65.25.1 esp 0x301 -m tunnel -E 3des-cbc
0x<sifra>
-A hmac-md5 0x<sifra>;

# Security policies
spdadd 192.168.111.0/24 192.168.1.0/24 any -P out ipsec
           esp/tunnel/212.65.25.1-193.179.44.25/require;

spdadd 192.168.1.0/24 192.168.111.0/24 any -P in ipsec
           esp/tunnel/193.179.44.25-212.65.25.1/require;

spdadd 192.168.1.0/24 192.168.111.0/24 any -P fwd ipsec
           esp/tunnel/193.179.44.25-212.65.25.1/require;

---------------------------------------------------------------

konfigurak 193.179.44.25: ------------------------------------
#!/sbin/setkey -f

# Flush the SAD and SPD
flush;
spdflush;

# ESP SAs doing encryption using 192 bit long keys (168 + 24 parity)
# and authentication using 128 bit long keys
add 212.65.25.1 193.179.44.25 esp 0x201 -m tunnel -E 3des-cbc
0x<sifra>
-A hmac-md5 0x<sifra>;

add 193.179.44.25 212.65.25.1 esp 0x301 -m tunnel -E 3des-cbc
0x<sifra>
-A hmac-md5 0x<sifra>;

# Security policies
spdadd 192.168.1.0/24 192.168.111.0/24 any -P out ipsec
           esp/tunnel/193.179.44.25-212.65.25.1/require;

spdadd 192.168.111.0/24 192.168.1.0/24 any -P in ipsec
           esp/tunnel/212.65.25.1-193.179.44.25/require;

spdadd 192.168.111.0/24 192.168.1.0/24 any -P fwd ipsec
           esp/tunnel/212.65.25.1-193.179.44.25/require;
---------------------------------------------------------------------


Další informace o konferenci Linux