To answer your question
- Yes, you can run Remote Access (aka. Roadwarrior) and Site-to-site Tunnel on the same StrongSwan instance.
- You can differentiate the Site-to-site connection and Remote Access connections by the authentication method.
Here is a working setup
connections {
site {
pools = ipv4, ipv6
local {
auth = pubkey
certs = site1.example.com.pem
id = site1.example.com
}
remote {
auth = pubkey
cacerts = MyCA.cer
id = "CN=site2.example.com"
}
children {
site {
local_ts = 10.218.2.0/24, ::/0
remote_ts = 10.218.1.0/24, 2001:470:ffff::/64
}
}
}
win {
pools = ipv4, ipv6
local {
auth = pubkey
certs = site1.example.com.pem
id = site1.example.com
}
remote {
auth = pubkey
cacerts = LloydsCertificateAuthorityG2.cer
}
children {
win {
local_ts = 0.0.0.0/0, ::/0, 10.218.1.0/24, 2001:470:ffff::/64
}
}
}
}
pools {
ipv4 {
addrs = 10.218.2.3-10.218.2.254
dns = 10.218.1.99
netmask = 255.255.255.0
subnet = 10.218.2.0/24,10.218.1.0/24
}
ipv6 {
addrs = 2001:470:ffff:2::3-2001:470:ffff:2::ffff
dns = 2001:470:ffff::99/64
subnet = 2001:470:ffff:2::/64,2001:470:ffff::/64
}
}
Site 2 connects with IKEv2 Protocol and Machine Certificate CN=site2.example.com
Certificates are stored on site 1 at
/etc/swanctl/rsa/site1.example.com.pem (private key)
/etc/swanctl/x509/site1.example.com.pem (public key)
/etc/swanctl/x509ca/MyCa.cer (Root CA)
Reload configuration with swanctl --load-all
To enable NAT for Remote Access clients
iptables -t nat -A POSTROUTING -s 10.218.2.0/24,10.218.1.0/24 -o eth0 -m policy --dir out --pol ipsec -j ACCEPT
iptables -t nat -A POSTROUTING -s 10.218.2.0/24,10.218.1.0/24 -o eth0 -j MASQUERADE