Creating an OpenVPN Remote Access Client-to-Site VPN without Routing All Traffic

Abstract: Configure OpenVPN to route only specific subnets through the tunnel while keeping internet traffic on the local network.

Created: 2026-10-23 by

To configure an OpenVPN client-to-site connection without routing all traffic through the tunnel, you must disable the default push of a default gateway on the server and manually specify only the specific subnets that should traverse the VPN. This approach ensures that general internet traffic continues to use your local network interface while internal corporate resources are securely accessed via the encrypted tunnel.

Understanding the Default Behavior

By default, when a client connects to an OpenVPN server, the server pushes a configuration directive called redirect-gateway def1 bypass-dns. This directive forces the client's operating system to change its default route, sending all outbound internet traffic through the VPN tunnel. While this provides privacy, it often results in slower performance for non-corporate websites and can cause issues with services that require a stable local IP address. To achieve a split-tunnel or selective routing setup, we need to override this behavior by explicitly defining which networks should be routed through the virtual private network.

The Role of Pushed Routes

OpenVPN operates by pushing configuration options from the server to the connecting clients. The most critical option for routing is the push "route" directive. When you omit the redirect-gateway command entirely, the client will not establish a default route through the VPN interface. Instead, it will maintain its existing default route pointing to its local router. You then add specific push "route" lines for every subnet that resides behind the VPN server. For example, if your office network uses the 192.168.10.0/24 subnet, you would push that specific route. The client will then add a static route to its routing table, directing packets destined for that subnet into the tun0 interface, while all other traffic follows the normal path. For more details on troubleshooting connectivity issues within the server LAN after making these changes, see our guide on OpenVPN: Can't Connect Computers Inside the Server LAN? Troubleshooting Guide.

Configuring the OpenVPN Server

The first step involves editing the main server configuration file, typically located at /etc/openvpn/server.conf or within a specific server profile directory depending on your distribution. You must locate any existing line that contains redirect-gateway and comment it out or remove it completely. This prevents the automatic hijacking of the client's default gateway. Next, you need to define the networks that should be accessible via the VPN. Use the push directive followed by the route keyword. The syntax is as follows:
push "route 192.168.10.0 255.255.255.0"
This tells the client that any packet destined for the 192.168.10.0 network with a subnet mask of 255.255.255.0 should be sent through the VPN tunnel. If you have multiple subnets, such as a guest network or a database VLAN, add additional push lines for each one. Ensure that the IP addresses and masks match the actual network topology of your remote site. After making these changes, restart the OpenVPN service to apply the new configuration.

Configuring the Client

On the client side, the configuration depends on whether you are using a manual client configuration or a management tool like OpenVPN Connect. If you are using a manual .ovpn file, ensure that the file does not contain any redirect-gateway directives. Most modern client configurations inherit these settings from the server push, so removing it from the server is usually sufficient. However, if your client configuration file explicitly includes redirect-gateway, you must remove or comment out that line to prevent local overrides. You may also need to adjust DNS settings. By default, some setups push DNS servers located inside the VPN. If you want to keep using your local ISP's DNS for general browsing but resolve internal names via the VPN, you can push specific DNS servers for internal domains or use split-DNS configurations. For standard setups where you simply want internet traffic to remain local, leaving DNS settings unmodified or pushing your local DNS server is often the best approach. If you encounter issues where applications fail to connect despite the VPN being active, check our article on Program won't connect through OpenVPN to diagnose potential firewall or binding issues.

Verifying Routing Tables

Once connected, verify that the routing is working as intended. On Linux or macOS, use the ip route or netstat -rn command. You should see your default route still pointing to your local gateway (e.g., default via 192.168.1.1 dev eth0). Additionally, you should see specific routes for the pushed subnets pointing to the VPN interface (e.g., 192.168.10.0/24 dev tun0). On Windows, open the Command Prompt and run route print. Look for entries under the IPv4 Route Table that correspond to your internal subnets with the VPN adapter listed as the interface. To test connectivity, try pinging a device on the internal network and then a public website like google.com. Both should succeed. To confirm that internet traffic is not going through the VPN, visit a "what is my IP" website. The IP address displayed should match your local public IP, not the IP address assigned by the OpenVPN provider or server.

Advanced Considerations for Traffic Management

In some complex environments, you might need to route traffic in the reverse direction or handle asymmetric routing scenarios. It is important to ensure that your firewall rules on the server allow return traffic from the VPN subnet back to the client. If you find that specific traffic is not flowing correctly, review our guide on How to Route Traffic in the Reverse Direction in VPN Tunnels for deeper insights into bidirectional flow control. Additionally, always verify that the tun interface created by OpenVPN is properly configured and not inadvertently blocking internet access due to misconfigured kernel parameters. Checking the interface status helps rule out basic connectivity failures before diving into complex routing tables. See Verify whether a tun interface (created by OpenVPN) offers access to the Internet for verification steps. Finally, remember that while OpenVPN encrypts traffic between the client and server, the security of the exposed ports remains a concern. Understanding how your VPN port is protected against external threats is crucial for maintaining a secure remote access infrastructure. Refer to Is an Open Port for VPN Protected from Hackers? for best practices on securing your entry points.

Frequently Asked Questions

Will disabling redirect-gateway break my internet connection?

No, disabling redirect-gateway simply restores your computer's default routing behavior. Your internet traffic will continue to flow through your local router and ISP as it did before connecting to the VPN, ensuring full-speed access to global websites.

How do I add multiple subnets to the VPN route?

You can add multiple subnets by including multiple push "route" lines in your server configuration file. Each line should specify a different network address and subnet mask corresponding to the internal networks you wish to access remotely.

Can I use this method with OpenVPN Access Server?

Yes, OpenVPN Access Server provides a web-based administration panel where you can toggle the "Redirect All Traffic" option off. This achieves the same result as manually editing the configuration files, allowing you to select specific networks for routing through the tunnel.

What if I need to access a device on a subnet that isn't pushed?

If you need to access a device on a subnet that was not included in the pushed routes, you must add a new push "route" line for that specific subnet on the server and reconnect the client. Alternatively, you can manually add a static route on the client machine, though this requires administrative privileges and persistence management.

Does this setup affect DNS resolution for internal sites?

Standard routing configurations do not automatically change DNS settings unless you also push DNS directives. If internal sites rely on internal DNS servers, you may need to push those specific DNS servers or configure split-DNS on your client to ensure name resolution works correctly for both internal and external resources.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More