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 value100on host A and the value200on host B are used asreqid. the same value must be used as the identifier of the policy entry in thesetkey(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
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2017 Andrey V. Elsukov <ae@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms