- Cortafuegos FreeBSD PF
- FreeBSD. Filtrado del tráfico PF
- FreeBSD. flujos, etiquetas y anclajes en PF
- FreeBSD. Enrutamiento condicional PF
- FreeBSD. La ruta del paquete de red dentro del kernel. <- Estás aquí
En artículos anteriores, discutimos PF, sus principales características, e intentamos aplicar este firewall en varias situaciones. Sin embargo, el simple conocimiento de qué reglas y en qué secuencia deben colocarse en la configuración no siempre es suficiente para lograr el objetivo. Mucho queda claro solo si miras un poco más a fondo: en el nivel del kernel del sistema operativo y cómo interactúan los firewalls con él.
No analizaremos los niveles del controlador de la tarjeta de red (nivel 2 del modelo OSI), sino que subiremos inmediatamente al nivel 3, donde funciona la pila del kernel tcp / ip.
mbuf. , , : a , (next hop), ttl, , . . . mbuf .
ip_input()
ip_input().
- ttl .
- ALTQ ( ), .
- IPSEC_CAPS(), ipsec, , , , . ipsec ip_input(), .
- pfil. . , , . rc.conf PF, .
- . — IP, ip_forward(). .
- (reassemble), .
- IPSEC_INPUT().
- , . — icmp error ip_output().
, .
ip_forward()
.
- ipsec — IPSEC_FORWARD().
- . , net.inet.ip.forwarding 1. - , icmp error ip_output().
- , , icmp_redirect, .
- ttl.
- ip_output().
ip_output()
.
- . , .
- ipsec — IPSEC_OUTPUT().
- pfil — .
- , (dst), (fib) . , . , .
- , .
- .
, . , . , . , , , . mbuf.
, pf in out.
pass in on re0 inet...
ip_input. out — ip_output.
pass out quick on $ExtIf2 ...
anchors .
route-to reply-to next hop :
pass in quick on $ExtIf2 reply-to ($ExtIf2 $ExtIf2Gw ) tagged DSTNAT pass in quick on $IntIf1 route-to ( $Tun1 $Tun1Gw ) from ($IntIf1:network)
rtable:
pass in quick on $IntIf2 from { $IntIf2Net } rtable 1 tag PASS
FreeBSD, , , , .
— . , , , , , VPN , , ftp-, web- jabber-, IP-… , . 35 , 9 .