OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • English Forums »
  • Virtual private networks »
  • Vpn site to site Opnsense - Ubuntu
« previous next »
  • Print
Pages: [1]

Author Topic: Vpn site to site Opnsense - Ubuntu  (Read 294 times)

sandman

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Certified Lamer :)
    • View Profile
Vpn site to site Opnsense - Ubuntu
« on: February 23, 2021, 11:04:18 am »
Sorry if this post is already solved by a FAQ, if so, drop it.

I am trying to set up a site to site vpn between two networks using opnsense and Ubuntu linux as edges of the connection.
The documentation is clear so the opensense side is ready, but what shall i do now on the ubuntu side to connect to the opnsense to estabilish the vpn ?
May i create a config file through opnsense web interface, load it into the linux box and run openvpn with the configuration file switch ?

Thank you very much for your attention.
Logged

Gauss23

  • Hero Member
  • *****
  • Posts: 722
  • Karma: 36
    • View Profile
    • BackendMedia
Re: Vpn site to site Opnsense - Ubuntu
« Reply #1 on: February 23, 2021, 01:12:00 pm »
VPN: OpenVPN: Client Export
is not what you want?
Logged
„The S in IoT stands for Security!“ :)

System 1: ESXi, i3-9100F (2 Cores), 4GB RAM, 4x NIC
System 2: ESXi, Xeon E3-1220 V2 (2 Cores), 4GB RAM, 4x NIC
System 3: KVM, Xeon Skylake (2 Cores), 4GB RAM, 2x NIC
System 4: KVM, AMD EPYC 7702P (2 Cores), 8GB RAM, 1x NIC (Datacenter VPN Hub)

pmhausen

  • Sr. Member
  • ****
  • Posts: 485
  • Karma: 41
    • View Profile
Re: Vpn site to site Opnsense - Ubuntu
« Reply #2 on: February 23, 2021, 01:13:51 pm »
For site to site the client config will hardly do.

But why don't you copy the config file from your OPNsense and reverse the roles before you put it onto your Ubuntu box?
Logged
APU4D4, 4GB RAM, 128 GB SSD, OPNsense 21.1
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Gauss23

  • Hero Member
  • *****
  • Posts: 722
  • Karma: 36
    • View Profile
    • BackendMedia
Re: Vpn site to site Opnsense - Ubuntu
« Reply #3 on: February 23, 2021, 01:20:29 pm »
Quote from: pmhausen on February 23, 2021, 01:13:51 pm
For site to site the client config will hardly do.

But why don't you copy the config file from your OPNsense and reverse the roles before you put it onto your Ubuntu box?

Yes, you're right :).
Logged
„The S in IoT stands for Security!“ :)

System 1: ESXi, i3-9100F (2 Cores), 4GB RAM, 4x NIC
System 2: ESXi, Xeon E3-1220 V2 (2 Cores), 4GB RAM, 4x NIC
System 3: KVM, Xeon Skylake (2 Cores), 4GB RAM, 2x NIC
System 4: KVM, AMD EPYC 7702P (2 Cores), 8GB RAM, 1x NIC (Datacenter VPN Hub)

sandman

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Certified Lamer :)
    • View Profile
Re: Vpn site to site Opnsense - Ubuntu
« Reply #4 on: February 23, 2021, 04:22:52 pm »
Quote from: pmhausen on February 23, 2021, 01:13:51 pm
For site to site the client config will hardly do.

But why don't you copy the config file from your OPNsense and reverse the roles before you put it onto your Ubuntu box?

First of all, thank you all for answering me so quickly, I really appreciate.

I already discarded the client config as it didn't solve my issue or i am not enough smart to use it in the right way :).
I agree, using a reverse config file is the key, but my new problem is my lack of knowledge about Opnsense and its filesystem tree, where should i search for ithe config file ?

Again thank you in advance for your patience.
Logged

sandman

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Certified Lamer :)
    • View Profile
Re: Vpn site to site Opnsense - Ubuntu
« Reply #5 on: March 03, 2021, 06:55:37 pm »
I keep on writing as i went on with the task and i found both some solutions and many issues i didn't expect.

post removed, things aren't working at all. I realized  i simply pinged myself and ssh'd myself... i only succeeded in having tun interfaces up and with an ip address, nothing more. My apologies. From the logs i can see the server receives a connection and then reports a quit command. The client believes to be up and running.

About reverting the situation to have the ubuntu box to act as a server. I can't, the linux network hasn't any nat to internet and rules are set up to work this way. I have no power on it.
I have to start as the linux box to act as "client" and the opnsense to be the "server".
« Last Edit: March 05, 2021, 12:04:34 am by sandman »
Logged

sandman

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
  • Certified Lamer :)
    • View Profile
Re: Vpn site to site Opnsense - Ubuntu
« Reply #6 on: March 05, 2021, 05:14:12 pm »
I am at  a stale point.

Using a vm emulating the net configuration of the linux box i could create a client conf and certificate to upload on
ubuntu.

I removed the "odd" switches which ubuntu didn't like.
I started everything and something is going on as opnsense logs activity, but i have no link between the two parts.

Linux client.conf:

verb 4
dev-type tun
dev tun
writepid /var/run/openvpn_client1.pid
script-security 3
daemon
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
proto udp4
cipher AES-256-CBC
auth SHA1
#multihome
lport 11940
#management /var/etc/openvpn/client1.sock unix
remote ipv4_opnsense_box port
ifconfig tunnel_ip_2 tunnel_ip_1
route opnsense_lan 255.255.255.0
# pre shared secret
secret /root/test_vpn/pd1/client1.secret
comp-lzo adaptive

opnsense server.conf

dev ovpns1
verb 4
dev-type tun
dev-node /dev/tun1
writepid /var/run/openvpn_server1.pid
script-security 3
daemon
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
proto udp4
cipher AES-256-CBC
auth SHA1
up /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkup
down /usr/local/etc/inc/plugins.inc.d/openvpn/ovpn-linkdown
local wan_ip_address
client-connect "/usr/local/etc/inc/plugins.inc.d/openvpn/ovpn_setup_cso.php server1"
tls-server
server tunnel_network 255.255.255.0
client-config-dir /var/etc/openvpn-csc/1
ifconfig tunnel_ip_1 tunnel_ip_2
tls-verify "/usr/local/etc/inc/plugins.inc.d/openvpn/ovpn_auth_verify tls 'OPNsense.localdomain' 1"
lport local_port_number (same as client remote_port_number)
management /var/etc/openvpn/server1.sock unix
max-clients 2
push "route lan_net 255.255.255.0"
route remote_lan_linux 255.255.255.0
ca /var/etc/openvpn/server1.ca
cert /var/etc/openvpn/server1.cert
key /var/etc/openvpn/server1.key
dh /usr/local/etc/dh-parameters.2048.sample
tls-auth /var/etc/openvpn/server1.tls-auth 0
comp-lzo adaptive

Logs from the opnsense when i start from linux the connecrion:

MANAGEMENT: Client disconnected   
MANAGEMENT: CMD 'quit'   
MANAGEMENT: CMD 'status 2'   
MANAGEMENT: Client connected from /var/etc/openvpn/server1.sock

Any hint would be really appreciated.
Thank you.
« Last Edit: March 05, 2021, 05:36:03 pm by sandman »
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • English Forums »
  • Virtual private networks »
  • Vpn site to site Opnsense - Ubuntu
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2021 All rights reserved
  • SMF 2.0.18 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2