/usr/local/etc/swanctl/swanctl.conf
connections { 077f479a-9c8e-4b15-ae35-8f1d2fb1c4ad { proposals = aes256-sha256-modp2048 unique = no aggressive = no version = 2 mobike = yes local_addrs = vpn1.example.com encap = yes rekey_time = 2400 dpd_delay = 30 pools = pool-roadwarrior send_certreq = yes send_cert = always keyingtries = 0 local-7f316b87-b8cc-4788-b6f3-3ee20a05811e { round = 0 auth = pubkey id = vpn1.example.com certs = 64f6fcdf57ea7.crt } remote-d15c8d9d-7396-4642-b6ba-9d1f94625297 { round = 0 auth = eap-mschapv2 eap_id = %any } children { 1371f735-5424-47fb-b564-b8b9e459e77b { esp_proposals = aes256-sha256-modp2048 sha256_96 = no start_action = trap close_action = none dpd_action = clear mode = tunnel policies = yes local_ts = 192.168.1.0/24 rekey_time = 600 updown = /usr/local/opnsense/scripts/ipsec/updown_event.py --con nection_child 1371f735-5424-47fb-b564-b8b9e459e77b } } }pools { pool-roadwarrior { addrs = 172.16.203.0/24 }}secrets { eap-36e3e573-2a1b-4837-bd35-7bfb8a17cb2a { id-0 = john@vpn1.example.com secret = 0sw435w34trgjftu4e6435t534t }}
Add-VpnConnection -Name "vpn1.example.com" -ServerAddress vpn1.example.com -TunnelType "Ikev2"Set-VpnConnectionIPsecConfiguration -ConnectionName "vpn1.example.com" -AuthenticationTransformConstants SHA256 -CipherTransformConstants AES256 -EncryptionMethod AES256 -IntegrityCheckMethod SHA256 -PfsGroup PFS2048 -DHGroup Group14 -PassThru -ForceSet-VpnConnection -Name "vpn1.example.com" -SplitTunneling $true
Server: vpn1.example.comVPN Typ: IKEv2 EAPUsername: john@vpn1.example.comPassword: 48o72g3h4ro8123g8rCA-Certificate: choose the imported CA certificate- Activate advanced mode:DNS Server: Add your DNS server, for example the Unbound of your OPNsense firewall. Make sure you allow port53 tcp udp to "this firewall" in Firewall:Rules:IPsec.IKEv2 Algorithms: aes256-sha256-modp2048IPsec/ESP Algorithms: aes256-sha256-modp2048
connections { 077f479a-9c8e-4b15-ae35-8f1d2fb1c4ad { proposals = aes256-sha256-modp2048 unique = no aggressive = no version = 2 mobike = yes local_addrs = vpn1.example.com encap = yes rekey_time = 2400 dpd_delay = 30 pools = pool-roadwarrior-john send_certreq = yes send_cert = always keyingtries = 0 local-7f316b87-b8cc-4788-b6f3-3ee20a05811e { round = 0 auth = pubkey id = vpn1.example.com certs = 64f6fcdf57ea7.crt } remote-d15c8d9d-7396-4642-b6ba-9d1f94625297 { round = 0 auth = eap-mschapv2 eap_id = john@vpn1.example.com } children { 1371f735-5424-47fb-b564-b8b9e459e77b { esp_proposals = aes256-sha256-modp2048 sha256_96 = no start_action = trap close_action = none dpd_action = clear mode = tunnel policies = yes local_ts = 192.168.1.0/24 rekey_time = 600 updown = /usr/local/opnsense/scripts/ipsec/updown_event.py --con nection_child 1371f735-5424-47fb-b564-b8b9e459e77b } } 077f479a-9c8e-4b15-ae35-1213234abe121 { proposals = aes256-sha256-modp2048 unique = no aggressive = no version = 2 mobike = yes local_addrs = vpn1.example.com encap = yes rekey_time = 2400 dpd_delay = 30 pools = pool-roadwarrior-laura send_certreq = yes send_cert = always keyingtries = 0 local-7f316b87-b8cc-4788-b6f3-3ee20a05811e { round = 0 auth = pubkey id = vpn1.example.com certs = 64f6fcdf57ea7.crt } remote-d15c8d9d-7396-4642-b6ba-9d1f94625297 { round = 0 auth = eap-mschapv2 eap_id = laura@vpn1.example.com } children { 1371f735-5424-47fb-b564-25242b3b23123b { esp_proposals = aes256-sha256-modp2048 sha256_96 = no start_action = trap close_action = none dpd_action = clear mode = tunnel policies = yes local_ts = 192.168.1.0/24 rekey_time = 600 updown = /usr/local/opnsense/scripts/ipsec/updown_event.py --con nection_child 1371f735-5424-47fb-b564-b8b9e459e77b } } }pools { pool-roadwarrior-john { addrs = 172.16.203.1/32 } pool-roadwarrior-laura { addrs = 172.16.203.2/32 }}secrets { eap-36e3e573-2a1b-4837-bd35-7bfb8a17cb2a { id-0 = john@vpn1.example.com secret = 0sw435w34trgjftu4e6435t534t } eap-44e3e573-2a1b-4837-bd35-7625bca17231 { id-0 = laura@vpn1.example.com secret = 0s324389z67dsfb3b234xcv }}
[GENERAL]Export=1Product=NCP Secure Entry ClientVersion=13.14 Build 29669Date=11.09.2023 09:30:42[PROFILE1]Name=vpn1.example.comConnMedia=21UseForAuto=0SeamRoaming=1NotKeepVpn=0BootProfile=0UseRAS=0SavePw=0PhoneNumber=DialerPhone=ScriptFile=HttpName=HttpPw=HttpScript=Modem=ComPort=1Baudrate=57600RelComPort=1InitStr=DialPrefix=3GApnSrc=23GProvider=APN=3GPhone=3GAuth=0GprsATCmd=AT+CPIN=GprsPin=""BiometricAuth=0PreAuthEap=0PreAuthHttp=0ConnMode=0Timeout=0TunnelTrafficMonitoring=0TunnelTrafficMonitoringAddr=0.0.0.0QoS=nonePkiConfig=ExchMode=34TunnelIpVersion=1IKEv2Auth=3IKE-Policy=automatic modeIKEv2Policy=aes256-sha256IkeDhGroup=14IkeLTSec=000:00:40:00IPSec-Policy=aes256-sha256PFS=14IPSecLTType=1IpsecLTSec=000:00:10:00IPSecLTKb=50000UseComp=0IkeIdType=3IkeIdStr=john@vpn1.example.comGateway=vpn1.example.comConnType=1UsePreShKey=0XAUTH-Src=0SplitOptionV4=1UseTunnel=1SplitOptionV6=1VpnBypass=noneUseXAUTH=1UseUdpEnc=500UseUdpEncTmp=4500DisDPD=0DPDInterval=30DPDRetrys=8AntiReplay=0PathFinder=0UseRFC7427=1RFC7427Padding=2Ikev2AuthPrf=0CertReqWithData=0IpAddrAssign=0IPAddress=SubnetMask=DNS1=DNS2=DomainName=DomainInTunnel=SubjectCert=IssuerCert=FingerPrint=UseSHA1=0Firewall=0OnlyTunnel=0RasOnlyTunnel=0DNSActiv=1DNS1Tmp=DNS2Tmp=[IKEV2POLICY1]Ikev2Name=aes256-sha256Ikev2Crypt=6Ikev2PRF=5Ikev2IntAlgo=12[IPSECPOLICY1]IPSecName=aes256-sha256IpsecCrypt=6IpsecAuth=5