if_ipsec(4)

πŸ’– if_ipsec(4) β€” IPsec virtual tunneling interface πŸ’–

okay bestie, welcome to the if_ipsec page from the Kernel Interfaces Manual πŸŽ€ she's giving route-based VPN realness and honestly? iconic. let's get into it ✨


✨ NAME ✨

if_ipsec β€” the IPsec virtual tunneling interface πŸ¦‹


🌸 SYNOPSIS 🌸

so the if_ipsec network interface is literally part of the FreeBSD IPsec implementation, no cap. if you wanna compile it straight into the kernel, you drop this line into the kernel config file:

options IPSEC

and it can ALSO be loaded as part of the ipsec kernel module, but only if the kernel was compiled with:

options IPSEC_SUPPORT

so yeah, pick your fighter πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

if_ipsec is built for creating route-based VPNs, periodt. she can tunnel IPv4 and IPv6 traffic over either IPv4 or IPv6, and lock it all down with ESP πŸ”₯

these interfaces are dynamically created and destroyed with the ifconfig(8) create and destroy subcommands β€” so cute, so flexible πŸŽ€ the administrator (that's you, main character) has to configure the IPsec tunnel endpoint addresses. those addresses get used for the outer IP header of ESP packets. you can also configure the protocol and addresses for the inner IP header with ifconfig(8), and then go modify the routing table so packets actually route through the if_ipsec interface. routing table said "this way please" 🧚

when the if_ipsec interface is configured, it automatically creates special security policies ✨ those policies can be used to acquire security associations from the IKE daemon, which you need for establishing an IPsec tunnel. you can also just create the security associations manually with the setkey(8) utility if that's your vibe πŸ’…

every if_ipsec interface has an extra numeric configuration option: reqid id. this id is how you tell traffic and security policies apart between several if_ipsec interfaces πŸ‘‘ the reqid can be specified when the interface is created, and changed later too. if you don't specify it, it gets automatically assigned. but heads up bestie β€” changing reqid will lead to generation of new security policies, and that may require creating new security associations 😭 so like, know what you're doing.


🌈 EXAMPLES 🌈

the example below shows manual configuration of an IPsec tunnel between two FreeBSD hosts 🫢 Host A has the IP address 192.168.0.3, and host B has the IP address 192.168.0.5.

On host A πŸ’–

ifconfig ipsec0 create reqid 100
ifconfig ipsec0 inet tunnel 192.168.0.3 192.168.0.5
ifconfig ipsec0 inet 172.16.0.3/16 172.16.0.5
setkey -c
add 192.168.0.3 192.168.0.5 esp 10000 -m tunnel -u 100 -E rijndael-cbc "VerySecureKey!!1";
add 192.168.0.5 192.168.0.3 esp 10001 -m tunnel -u 100 -E rijndael-cbc "VerySecureKey!!2";
^D

On host B πŸ’–

ifconfig ipsec0 create reqid 200
ifconfig ipsec0 inet tunnel 192.168.0.5 192.168.0.3
ifconfig ipsec0 inet 172.16.0.5/16 172.16.0.3
setkey -c
add 192.168.0.3 192.168.0.5 esp 10000 -m tunnel -u 200 -E rijndael-cbc "VerySecureKey!!1";
add 192.168.0.5 192.168.0.3 esp 10001 -m tunnel -u 200 -E rijndael-cbc "VerySecureKey!!2";
^D
note that the value 100 on host A and the value 200 on host B are used as reqid. the same value must be used as the identifier of the policy entry in the setkey(8) command ⭐ don't mix them up, bestie, that's a vibe check you don't wanna fail πŸ™ˆ

πŸ¦‹ SEE ALSO πŸ¦‹


πŸ‘‘ AUTHORS πŸ‘‘

Andrey V. Elsukov <ae@FreeBSD.org> πŸ’œ


and that's the whole page, bestie!! πŸŽ€ this one comes to you from Debian, dated February 6, 2017, and yeah the page is literally called if_ipsec(4) β€” go configure your tunnel, you've got this βœ¨πŸ’…πŸŒΈ

πŸ“¦ where this page comes from