Ethernet Bridging | OpenVPN (2024)

Ethernet bridgingessentially involves combining an ethernet interface with one or more virtual TAP interfaces and bridging them together under the umbrella of a single bridge interface. Ethernet bridges represent the software analog to a physical ethernet switch. The ethernet bridge can be thought of as a kind of software switch which can be used to connect multiple ethernet interfaces (either physical or virtual) on a single machine while sharing a single IP subnet.

By bridging a physical ethernet NIC with an OpenVPN-driven TAP interface at two separate locations, it is possible to logically merge both ethernet networks, as if they were a single ethernet subnet.

Bridging Setup

This example will guide you in configuring an OpenVPN server-side ethernet bridge. Multiple clients will be able to connect to the bridge, and each client's TAP interface will be assigned an IP address that is part of the server's LAN.

There are two methods for handling client IP address allocation:

  • Let OpenVPN manage its own client IP address pool using theserver-bridgedirective, or
  • configure the DHCP server on the LAN to also grant IP address leases to VPN clients.

In this example, we will use the first method where the OpenVPN server manages its own IP address pool on the LAN subnet, separate from the pool used by the DHCP server (if one exists). Both methods are described more fully in thisFAQ item.

For our example, we will use these bridge settings:

Settingbridge-startparameterValue
Ethernet Interfaceetheth0
Local IP Addressip192.168.8.4
Local Netmasketh_netmask255.255.255.0
Local Broadcast Addresseth_broadcast192.168.8.255
VPN client address pool192.168.8.128 to 192.168.8.254
Virtual Bridge Interfacebrbr0
Virtual TAP Interfacetaptap0

The first step is to follow theHOWTOup to the "Starting up the VPN and testing for initial connectivity" section. Next, proceed below according to whether you are setting up the bridge on Linux or Windows.

Bridge Server on Linux

First, make sure you have thebridge-utilspackage installed.

Edit thebridge-startscript below. Set thebr,tap,eth,eth_ip,eth_netmask, andeth_broadcastparameters according to the physical ethernet interface you would like to bridge. Make sure to use an interface which is private and which is connected to a LAN which is protected from the internet by a firewall. You can use the Linuxifconfigcommand to get the necessary information about your network interfaces to fill in thebridge-startparameters.

Now run thebridge-startscript. It will create a persistenttap0interface and bridge it with the active ethernet interface.

Next, we will edit theOpenVPN server configuration fileto enable a bridging configuration.

Comment out the line which saysdev tunand replace it instead with:

dev tap0

Comment out the line that begins withserverand replace it with:

server-bridge 192.168.8.4 255.255.255.0 192.168.8.128 192.168.8.254
Now set up the Linux firewall to permit packets to flow freely over the newly createdtap0andbr0interfaces:
iptables -A INPUT -i tap0 -j ACCEPTiptables -A INPUT -i br0 -j ACCEPTiptables -A FORWARD -i br0 -j ACCEPT

The OpenVPN bridge can now be started and stopped using this sequence::

  • runbridge-start
  • run openvpn
  • stop openvpn
  • runbridge-stop

At this point, the bridging-specific aspects of the configuration are complete, and you cancontinue where you left off in the HOWTO.

Bridge Server on Windows XP

This configuration requires Windows XP or higher on the bridge side. To my knowledge, Windows 2000 does not support bridging, however a Windows 2000 machine can be a client on a bridged network, where the other end of the OpenVPN connection where the bridging is occurring is a Linux or Windows XP machine.

When OpenVPN is installed on Windows, it automatically creates a single TAP-Win32 adapter which will be assigned a name like "Local Area Connection 2". Go to the Network Connections control panel and rename it to "tap-bridge".

Next selecttap-bridgeand your ethernet adapter with the mouse, right click, and selectBridge Connections. This will create a newbridge adaptericon in the control panel.

Set the TCP/IP properties on the bridge adapter to an IP of 192.168.8.4 and a subnet mask of 255.255.255.0.

Next, edit theOpenVPN server configuration fileto enable a bridging configuration.

Comment out the line which saysdev tunand replace it instead with:

dev tapdev-node tap-bridge

Comment out the line that begins withserverand replace it with:

server-bridge 192.168.8.4 255.255.255.0 192.168.8.128 192.168.8.254
If you are running XP SP2, go to the firewall control panel, and disable firewall filtering on the bridge and TAP adapters.

At this point, the bridging-specific aspects of the configuration are complete, and you cancontinue where you left off in the HOWTO.

Bridge Client configuration

Use thesample OpenVPN client configurationas a starting point. Comment out the line which saysdev tunand replace it instead with:

dev tap

Finally, ensure that the client configuration file is consistent with the directives used in the server configuration. The major thing to check for is that theproto(udp or tcp) directives are consistent. Also make sure thatcomp-lzoandfragment, if used, are present in both client and server config files.

Ethernet Bridging Notes

When using an ethernet bridging configuration, the first step is to construct the ethernet bridge -- a kind of virtual network interface which is a container for other ethernet interfaces, either real as in physical NICs or virtual as in TAP interfaces. The ethernet bridge interface must be set up before OpenVPN is actually started.

There is no portable method for generating an ethernet bridge interface -- each OS has its own method (see below for examples).

Once the bridge interface has been created, and appropriate ethernet interfaces have been added to it, OpenVPN may be started.

  • A bridge interface is a kind of virtual network interface which is formed by combining one or more ethernet interfaces, each of which may be a physical NIC or a virtual TAP interface used for VPN tunneling.
  • When you set up an ethernet bridge, you should manually set the IP address and subnet of the bridge interface and not use anifconfigdirective in the OpenVPN config. This is because unlike a TUN/TAP interface, OpenVPN cannot programmatically set the IP address and netmask of a bridge interface.
  • The OpenVPN config should specify the TAP interface component of the bridge interface in itsdevdirective, not the name of the bridge interface itself.
  • On Windows, use thedev-nodedirective to name the TAP-Win32 adapter which was added to the bridge (thedev-nodename refers to the adapter name as shown in the Network Connections panel).
  • On Linux/BSD/Unix, for thedev tapdirective, use the explicit TUN/TAP unit number which you added to the bridge such asdev tap0.
  • If you are running OpenVPN in point-to-point mode, omit anifconfigdirective, and if you are using client/server mode, use theserver-bridgedirective on the server.
  • When bridging, you must manually set the TCP/IP settings on the bridge interface. For example on Linux, this can be done with anifconfigcommand while on Windows XP it can be done by setting the TCP/IP properties of the bridge interface in the Network Connections panel (the Network Connections panel on Windows XP and higher allows for point-and-click bridging).
  • Make sure to only bridge TAP interfaces with private ethernet interfaces which are protected behind a firewall. Never bridge a TAP interface with the same ethernet interface you use to connect to the internet, as that would create a potential security hole.
  • The addresses used forlocalandremoteshould not be part of the bridged subnet -- otherwise you will end up with a routing loop.
  • An important point to understand with Ethernet bridging is that each network interface which is added to the bridge will lose its individual identity in terms of specific settings such as IP address and netmask. Only the TCP/IP settings of the bridge interface itself will be relevent.
  • A common mistake that people make when manually configuring an Ethernet bridge is that they add their primary ethernet adapter to the bridge before they have set the IP and netmask of the bridge interface. The result is that the primary ethernet interface "loses" its settings, but the equivalent bridge interface settings have not yet been defined, so the net effect is a loss of connectivity on the ethernet interface.
  • In most cases, it is possible to set up a usable bridge configuration with the ethernet-bridge itself only configured on the server side, not the client side. If this is done, the client machines will becomemulti-homedwhen they connect to the server, i.e. they will still have their regular ethernet interface, but upon connection to the OpenVPN server, they will now have a new TAP interface which is bridged with the server's ethernet interface (and possibly all of the TAP interfaces of other connecting clients as well if theclient-to-clientdirective is used on the server).

Notes -- Ethernet Bridging on Windows

TheWindows Notespage has additional information on ethernet bridging.

Notes -- Ethernet Bridging on Linux, Setup Scripts

These scripts will handle bridge setup and shutdown on Linux. They are available in thesample-scriptssubdirectory of the OpenVPN tarball.

sample-scripts/bridge-start

#!/bin/bash################################## Set up Ethernet bridge on Linux# Requires: bridge-utils################################## Define Bridge Interfacebr="br0"# Define list of TAP interfaces to be bridged,# for example tap="tap0 tap1 tap2".tap="tap0"# Define physical ethernet interface to be bridged# with TAP interface(s) above.eth="eth0"eth_ip="192.168.8.4"eth_netmask="255.255.255.0"eth_broadcast="192.168.8.255"for t in $tap; do openvpn --mktun --dev $tdonebrctl addbr $brbrctl addif $br $ethfor t in $tap; do brctl addif $br $tdonefor t in $tap; do ifconfig $t 0.0.0.0 promisc updoneifconfig $eth 0.0.0.0 promisc upifconfig $br $eth_ip netmask $eth_netmask broadcast $eth_broadcast

sample-scripts/bridge-stop

#!/bin/bash##################################### Tear Down Ethernet bridge on Linux##################################### Define Bridge Interfacebr="br0"# Define list of TAP interfaces to be bridged togethertap="tap0"ifconfig $br downbrctl delbr $brfor t in $tap; do openvpn --rmtun --dev $tdone
Ethernet Bridging | OpenVPN (2024)

FAQs

What is the Ethernet bridging protocol? ›

An important point to understand with Ethernet bridging is that each network interface which is added to the bridge will lose its individual identity in terms of specific settings such as IP address and netmask. Only the TCP/IP settings of the bridge interface itself will be relevent.

What is bridged VPN? ›

A local bridge connection can be configured between the "BRIDGE" Virtual Hub on VPN Bridge and a physical network adapter on the computer running VPN Bridge. This function allows you to connect the Virtual Hub of VPN Bridge to a network on an existing base using Layer 2, using this function as a bridge.

Is WireGuard better than OpenVPN? ›

SUMMARY: OpenVPN offers greater freedom when it comes to encryption and security, but WireGuard is easier to audit and has a smaller attack surface. Both protocols are very secure, but less tech-savvy users may prefer to trust the experts at WireGuard, rather than take matters into their own hands.

What is tap mode in OpenVPN? ›

What is TAP Mode in OpenVPN? TAP mode, short for "Ethernet Bridging" is a network technology that enables the bridging of two or more network segments into one virtual network.

What does bridging Ethernet connections do? ›

A bridge connection is a network connection that allows several devices to communicate with each other as if they were on the same physical network, even if they are connected to separate networks.

What is the difference between bridged and switched Ethernet? ›

Switches handle a larger number of connections, and that means that more information has to be sorted in order to effectively route traffic through the switch. This process takes time, and it introduces latency. On average, bridges experience far lower latency than switches.

Is bridged network safe? ›

However, bridged networking also has some disadvantages that you should consider before using it. One of the main drawbacks is that it exposes the guest VMs to the same risks and vulnerabilities as the host network. If the host network is compromised, the guest VMs could also be attacked or infected by malware.

Does bridge mode disable Wi-Fi? ›

Bridge mode is a setting within a router that turns off the router's Wi-Fi broadcast, turning it into a bridge between the network and another Wi-Fi router.

What is the benefit of bridge mode? ›

Bridge Mode in a Nutshell

It is most effective when you're moving farther away from your router and need extended WiFi coverage. Also, it helps devices connected to the private network communicate with each other without any performance issues.

Can WireGuard be detected? ›

Yes, WireGuard can be detected. It doesn't do VPN obfuscation, mostly because of the insistence on UDP transmission mode.

Is WireGuard free? ›

WireGuard is a communication protocol and free and open-source software that implements encrypted virtual private networks (VPNs), and was designed with the goals of ease of use, high speed performance, and low attack surface.

Should I use IKEv2 or WireGuard? ›

Based on these findings, if you're looking for the fastest secure tunneling protocol, you should go with NordLynx (or WireGuard). The second fastest will be IKEv2, which can confidently hold its own even when connecting to the other side of the world.

What is TUN mode? ›

TUN, short for network TUNnel, is a virtual interface that implements a software-based abstraction of a network by emulating the behavior of physical devices like Ethernet or Wi-Fi interface cards. It operates on layer 3 of the OSI model, handling the transmission and reception of IP packets.

Which is faster, TUN or tap? ›

Those protocols include DHCP, PXE boot, IPX, ZeroConf, Avahi, mDNS and DLNA. So to summarize: TUN is slightly faster and TAP is more flexible concerning supported protocols and setups.

What is a ZeroTier bridge? ›

ZeroTier emulates a true Ethernet switch. This includes the ability to L2 bridge other Ethernet networks (wired LAN, WiFi, virtual backplanes, etc.) to virtual networks using conventional Ethernet bridging. To act as a bridge a network member must be designated as such by the controller.

What is a bridge protocol? ›

Bridge Protocol is an open source multi-chain platform to manage the issuance, distribution, transfers, compliance and corporate actions of digital securities on EVM blockchains.

What is bridge protocol in router? ›

In Bridge Mode, one router is designated as the primary router and is responsible for assigning IP addresses to devices on the network. The second router is connected to the primary router and acts as a bridge, allowing devices on the network to communicate with each other and access the internet.

Does Ethernet still work in bridge mode? ›

Does bridge mode disable Ethernet ports? No, bridge mode does not disable Ethernet ports on the routers. The Ethernet ports can still connect devices and enable wired connections.

What does port bridging do? ›

Multiport bridging

A multiport bridge connects multiple networks and operates transparently to decide on a frame-by-frame basis whether to forward traffic. Additionally, a multiport bridge must decide where to forward traffic.

References

Top Articles
Understanding Plasma Styles
Development/Tutorials/Plasma4/ThemeDetails - KDE TechBase
Pet For Sale Craigslist
Time in Baltimore, Maryland, United States now
Fat Hog Prices Today
Mrh Forum
Algebra Calculator Mathway
Robot or human?
Tj Nails Victoria Tx
What are Dietary Reference Intakes?
Poe Pohx Profile
Sprague Brook Park Camping Reservations
Puretalkusa.com/Amac
Soap2Day Autoplay
AB Solutions Portal | Login
Crime Scene Photos West Memphis Three
Baseball-Reference Com
Unit 1 Lesson 5 Practice Problems Answer Key
What Is A Good Estimate For 380 Of 60
Https E24 Ultipro Com
Cbs Trade Value Chart Fantasy Football
Trac Cbna
Jellyfin Ps5
Aris Rachevsky Harvard
Happy Life 365, Kelly Weekers | 9789021569444 | Boeken | bol
Rs3 Eldritch Crossbow
The Many Faces of the Craigslist Killer
Construction Management Jumpstart 3Rd Edition Pdf Free Download
D2L Brightspace Clc
1145 Barnett Drive
How often should you visit your Barber?
Citibank Branch Locations In Orlando Florida
Life Insurance Policies | New York Life
2430 Research Parkway
Justin Mckenzie Phillip Bryant
How to Destroy Rule 34
Tmka-19829
D3 Boards
Why Gas Prices Are So High (Published 2022)
Philadelphia Inquirer Obituaries This Week
Pensacola Cars Craigslist
About My Father Showtimes Near Amc Rockford 16
Gregory (Five Nights at Freddy's)
Fatal Accident In Nashville Tn Today
Skyward Cahokia
Colin Donnell Lpsg
Bedbathandbeyond Flemington Nj
Research Tome Neltharus
Osrs Vorkath Combat Achievements
Hy-Vee, Inc. hiring Market Grille Express Assistant Department Manager in New Hope, MN | LinkedIn
Elizabethtown Mesothelioma Legal Question
Latest Posts
Article information

Author: Roderick King

Last Updated:

Views: 5870

Rating: 4 / 5 (51 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Roderick King

Birthday: 1997-10-09

Address: 3782 Madge Knoll, East Dudley, MA 63913

Phone: +2521695290067

Job: Customer Sales Coordinator

Hobby: Gunsmithing, Embroidery, Parkour, Kitesurfing, Rock climbing, Sand art, Beekeeping

Introduction: My name is Roderick King, I am a cute, splendid, excited, perfect, gentle, funny, vivacious person who loves writing and wants to share my knowledge and understanding with you.