Hi,
I was able to set up an IPSec/strongswan VPN tunnel and it works great so far (Forum: 67850).
Now, I'd like to forward traffic from my bhyve VM's through the tunnel but I am having problems with it. The picture looks like that: (all done on FreeBSD 11.2p4)
I can successfully connect (from VPN Client) with strongswan and reach 172.16.55.1, and i can also route all traffic through the VPN Server by using strongswan and pf (the vpn server is using NAT). This works fine.
When bringing up the ipsec tunnel, strongswan creates a
But when i am trying to NAT the 192.168.4 network to the tun0 interface, I can't ping other hosts (i.e. inside a VM, i cant ping any hosts). I do see the ping request on the bridge0 (with tcpdump) device but nothing comes back.
I also noticed that I do not see a ping request on the tun0 device when using the "VPN Client" itself (and not a VM). Does anyone know why?
I also can't add the tun0 device to the bridge0 since it either would need a gre or gif interface.
Is it possible to set up strongswan in a way it is using gif(4) or are there any alternatives? Perhaps I have to setup a second subnet within the strongswan config?
VPN Server:
VPN Client:
The pf.conf on the client:
Thanks!
I was able to set up an IPSec/strongswan VPN tunnel and it works great so far (Forum: 67850).
Now, I'd like to forward traffic from my bhyve VM's through the tunnel but I am having problems with it. The picture looks like that: (all done on FreeBSD 11.2p4)
Code:
(*) normal DSL Router with 192.168.2.1
___ dynamic (wlan0: x.x.x.x)
/ tun0: 172.16.55.200 (autogenerated by ipsec up home)
|
|
[VPN Client]---*---------[VPN Server]
| \_ ext: y.y.y.y
| \_ lo1: 172.16.55.1
|tun0: 172.16.55.200
|
|
|
bridge0 192.168.4/24
tap0: vm1
tap1: vm2
I can successfully connect (from VPN Client) with strongswan and reach 172.16.55.1, and i can also route all traffic through the VPN Server by using strongswan and pf (the vpn server is using NAT). This works fine.
When bringing up the ipsec tunnel, strongswan creates a
tun0
device with the 172.16.55.200 ipaddr. But when i am trying to NAT the 192.168.4 network to the tun0 interface, I can't ping other hosts (i.e. inside a VM, i cant ping any hosts). I do see the ping request on the bridge0 (with tcpdump) device but nothing comes back.
I also noticed that I do not see a ping request on the tun0 device when using the "VPN Client" itself (and not a VM). Does anyone know why?
I also can't add the tun0 device to the bridge0 since it either would need a gre or gif interface.
Is it possible to set up strongswan in a way it is using gif(4) or are there any alternatives? Perhaps I have to setup a second subnet within the strongswan config?
VPN Server:
Code:
config setup
# strictcrlpolicy=yes
uniqueids = no
conn %default
keyexchange=ikev2
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
authby=secret
conn rw
left=y.y.y.y.y
leftsubnet=0.0.0.0/0
right=%any
rightsourceip=172.16.55.200
auto=add
VPN Client:
Code:
config setup
conn %default
ikelifetime=60m
keylife=20m
rekeymargin=3m
keyingtries=1
keyexchange=ikev2
authby=secret # psk or secret
conn home # name used in ipsec(1) commands
leftfirewall=yes
right=y.y.y.y
rightsubnet=0.0.0.0/0
auto=add
leftsourceip=%config
The pf.conf on the client:
Code:
# VPN Client
ext_if="wlan0"
set skip on lo0
virt_net="192.168.4.1/24"
scrub all
#Works: nat on $ext_if from $virt_net to any -> (wlan0)
#not working: nat on $ext_if from $virt_net to any -> 172.16.55.1
nat from 192.168.4.1/24 to any -> (tun0) # not working
pass log all
Code:
# netstat -rn
Routing tables
Internet:
Destination Gateway Flags Netif Expire
0.0.0.0/1 192.168.2.1 US tun0
default 172.16.55.1 UGS tun0
127.0.0.1 link#2 UH lo0
128.0.0.0/1 192.168.2.1 US tun0
172.16.55.200 link#5 UH tun0
Thanks!