Score:0

OpenVPN Layer 2 Ethernet Bridging

cn flag

I have an OpenVPN server running on an Ubuntu 18.04 machine and I want to connect to the server using an Ubuntu 20.04 machine through ethernet bridging (layer 2).

I have successfully created the OpenVPN, but i cannot seem to connect to it.

The tap0 in my client side does not receive an IP.

I would also like to state that I am new to networking and such.

My end goal would be having a STATIC IP ADDRESS for both the server and client. I do not want to use DHCP.

The following are my configs:

Server.conf

port 1194
proto udp
dev tap0
ca ca.crt
cert server.crt
key server.key  # This file should be kept secret
dh dh2048.pem

up "/etc/openvpn/up.sh br0 tap0 1500"
down "/etc/openvpn/down.sh br0 tap0"

# Configure server mode for ethernet bridging.
# You must first use your OS's bridging capability
# to bridge the TAP interface with the ethernet
# NIC interface.  Then you must manually set the
# IP/netmask on the bridge interface, here we
# assume 10.8.0.4/255.255.255.0.  Finally we
# must set aside an IP range in this subnet
# (start=10.8.0.50 end=10.8.0.100) to allocate
# to connecting clients.  Leave this line commented
# out unless you are ethernet bridging.
;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100

# Configure server mode for ethernet bridging
# using a DHCP-proxy, where clients talk
# to the OpenVPN server-side DHCP server
# to receive their IP address allocation
# and DNS server addresses.  You must first use
# your OS's bridging capability to bridge the TAP
# interface with the ethernet NIC interface.
# Note: this mode only works on clients (such as
# Windows), where the client-side TAP adapter is
# bound to a DHCP client.
server-bridge

keepalive 10 120
tls-auth ta.key 0 # This file is secret
cipher AES-256-CBC
persist-key
persist-tun
status /var/log/openvpn/openvpn-status.log
verb 3
explicit-exit-notify 1

Client.ovpn

client
dev tap
proto udp
remote hidden 1194
resolv-retry infinite
nobind
user nobody
group nogroup
persist-key
persist-tun

<ca>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</ca>

<cert>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</cert>

<key>
-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----
</key>

remote-cert-tls server

key-direction 1
<tls-auth>
-----BEGIN OpenVPN Static key V1-----
-----END OpenVPN Static key V1-----
</tls-auth>

cipher AES-256-CBC
verb 4
in flag
Please include logs from both sides, try adding verbose mode
Score:0
cn flag

I apologize for not being able to update immediately. I have actually finished this task. I successfully connected the client to the server. Both are connecting like a normal LAN and can also connect to other boards that are connected to either PCs. Thank you for everyone who checked over my Questions.

My solution:

I kept all the configs for both the server and client the same. All I had to do was assign an IP to my tap0 interface on my CLIENT side (and dont forget to 'sudo ip link set up tap0'). Then the tap0 interface can communicate to each other from client to server and vice versa.

FYI: Since I want the server to be able to communicate with one of the boards in the client side, I attached the physical interface and tap interface to a bridge. Then I assign the bridge the IP that was in the physical interface. Make sure the IP that is assigned in the client is in the same subnet as the server. For example: 192.168.x.25 and 192.168.x.26.

This setup allowed both of my PCs to communicate to each other and even the boards connected to the PC.

Once again, thank you everyone who helped out!

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.