OpenVPN tun0 routing on server

Tibby

I have an OpenVPN tun0 10.8.0.0 255.255.255.0

There is an interface on the server eth1 for 192.168.0.0 255.255.255.0

I would like to route the OpenVPN connections to access the 192.168.0.0 network.

I can connect to the VPN from my client, I get an ip of 10.8.0.6 but on the server it will not route the traffic from tun0 to eth1. When I do a tracerout for 192.168.0.1 it shows going out towards 10.8.0.1 but stops right there.

If I try to ping 192.168.0.1 on the server from tun0 I get no response. ping 192.168.0.1 -I tun0

Anyone can please help me what do I need to add on the server to get the routing and the NAT working?

Thanks!

ob2

it seems you need to update two part of your configuration.

Push route from your server conf file, just add the following line

 push "route 192.168.0.0 255.255.255.0 10.8.0.1"

Then you need to NAT all traffic coming from 10.8.0.0 so then your device on 192.168.0.0 will know where to route back the paquet to VPN client. Just run this command on your server.

iptables -A POSTROUTING -s 10.8.0.0/24 -o eth1 -j MASQUERADE

Also double check you have ip forwarding enable on the server by commented out the line net.ipv4.ip_forward=1 from the file /etc/sysctl.conf. Then run the command sysctl -p to enable the rule.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Understanding tun0 addresses

From Dev

Problems configuring OpenVPN Server

From Dev

Understanding tun0 addresses

From Dev

Wireguard server and openvpn client - Forward traffic from wg0 to tun0 (openvpn tunnel)

From Dev

Problems configuring OpenVPN Server

From Dev

openvpn connected, but not routing. (ping test fails)

From Dev

troubleshooting OpenVPN not connecting to the server

From Dev

openvpn routing

From Dev

Routing a LAN through OpenVPN on OpenBSD 5.5

From Dev

Kubuntu network-manager-openvpn not routing traffic via VPN server

From Dev

Routing Problem OpenVPN / KVM

From Dev

DNS with OpenVPN on a linux server with routing enabled

From Dev

Is an OpenVPN client able to read the OpenVPN server configuration

From Dev

OpenVPN - SSH into OpenVPN client from OpenVPN server

From Dev

Redirect secondary network interface traffic along with port forwarding to tun0 (OpenVPN) using iptables

From Dev

et0 vs tun0 with OpenVPN

From Dev

openvpn routing script failing to execute when called by openvpn

From Dev

Routing problems with IPv6 over OpenVPN

From Dev

Policy routing for OpenVPN server & client on the same router?

From Dev

Fail to start openvpn server

From Dev

OpenVPN not starting tun0

From Dev

Connect headless server to OpenVPN

From Dev

OpenVPN server configuration

From Dev

Openvpn issues with routing and config pushing

From Dev

How does an OpenVPN tune in all the traffic going into tun0?

From Dev

Openvpn client on local server

From Dev

OpenVPN tun0 routing on server

From Dev

How do I forward all packets from wlan0 to tun0 (OpenVPN)?

From Dev

Routing and OpenVPN