Hello,
i have been trying to redirect the traffic of a few computers from my lan trough the openvpn client running on my ubuntu server, but the server configuration uses redirect-gateway and all the traffic was tunnel and i wasn't able to reach my server through the external Ip.
I added some routes to my client.conf to solve this. The normal traffic is now routed to eth0 (Internet) but i can't forward any traffic to tun0.
I can ping the openvpn server from all clients in my lan but all the traffic goes directly to eth0.
I guess one of my iptable rules or routes is wrong.
my setup:
eth0 --> Internet
p1p1 --> Lan 1
p1p2 --> Lan 2
Only one computer from lan 1 (192.168.1.11) should route all the traffic through the vpn connection.
client.conf
client
dev tun
proto udp
remote ...
resolv-retry infinite
remote-cert-tls server
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
ca ca.crt
auth-user-pass
comp-lzo
fast-io
ping-restart 0
route-delay 2
route-method exe
script-security 3 system
mute-replay-warnings
verb 3
route 0.0.0.0 192.0.0.0 net_gateway
route 64.0.0.0 192.0.0.0 net_gateway
route 128.0.0.0 192.0.0.0 net_gateway
route 192.0.0.0 192.0.0.0 net_gateway
routes
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default ip1f107dfe.dyna 192.0.0.0 UG 0 0 0 eth0
default 10.9.0.41 128.0.0.0 UG 0 0 0 tun0
default ip1f107dfe.dyna 0.0.0.0 UG 0 0 0 eth0
10.9.0.1 10.9.0.41 255.255.255.255 UGH 0 0 0 tun0
10.9.0.41 * 255.255.255.255 UH 0 0 0 tun0
31.16... * 255.255.255.0 U 0 0 0 eth0
64.0.0.0 ip1f107dfe.dyna 192.0.0.0 UG 0 0 0 eth0
ecstasyservers. ip1f107dfe.dyna 255.255.255.255 UGH 0 0 0 eth0
128.0.0.0 ip1f107dfe.dyna 192.0.0.0 UG 0 0 0 eth0
128.0.0.0 10.9.0.41 128.0.0.0 UG 0 0 0 tun0
192.0.0.0 ip1f107dfe.dyna 192.0.0.0 UG 0 0 0 eth0
localnet * 255.255.255.128 U 0 0 0 p1p1
192.168.2.0 * 255.255.255.128 U 0 0 0 p1p2
nat
Chain PREROUTING (policy ACCEPT 4339 packets, 637K bytes)
pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 318 packets, 22777 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 1662 packets, 137K bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 1420 packets, 118K bytes)
pkts bytes target prot opt in out source destination
87 5622 MASQUERADE all -- * tun0 192.168.1.11 0.0.0.0/0
2159 141K MASQUERADE all -- * eth0 0.0.0.0/0 0.0.0.0/0
FORWARD
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 192.168.1.11 anywhere ctstate NEW
ACCEPT all -- 192.168.0.0/16 anywhere ctstate NEW
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
Thanks in advance!