0

I've got some problems with my OpenVPN setup.

The Setup: -> Ubuntu Server 12.04 -> Two active NIC's: eth0 (default): 192.168.1.0/24 eth1: x.x.x.x (external ip)

I've managed to get the routing to work so i can connect to the outside world with the eth1 NIC.

holmen@filserver:~$ ping -I eth1 -c 3 www.linuxquestions.org
PING www.linuxquestions.org (75.126.162.205) from 192.168.1.2 eth1: 56(84) bytes of data.
64 bytes from www.linuxquestions.org (75.126.162.205): icmp_req=1 ttl=50 time=133 ms
64 bytes from www.linuxquestions.org (75.126.162.205): icmp_req=2 ttl=50 time=133 ms
64 bytes from www.linuxquestions.org (75.126.162.205): icmp_req=3 ttl=50 time=133 ms

--- www.linuxquestions.org ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 133.281/133.336/133.379/0.423 ms
One curious thing is that the "from ip #". It says "from 192.168.1.2 eth1" but that ip is the servers ip on the eth0 iface.

Netstat:

holmen@filserver:~$ netstat -anr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
x.x.x.x     0.0.0.0         255.255.128.0   U         0 0          0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0

But here comes the real problem: When setting up openvpn with the option "local x.x.x.x (eth1 ext ip)" it still tunnels the eth0 interface. And i cant understand why.

OpenVPN settings:

client

dev tap

proto udp

local x.x.x.x

remote openvpn.anonine.net 1194
remote openvpn.anonine.net 1195
remote openvpn-2.anonine.net 1196
remote openvpn-2.anonine.net 1197
remote openvpn-3.anonine.net 1198
remote openvpn-3.anonine.net 1199
remote openvpn-4.anonine.net 1200
remote openvpn-4.anonine.net 1201

remote-random

resolv-retry infinite

auth-user-pass

persist-key
persist-tun

ca anonine.ca.crt

ns-cert-type server

comp-lzo

reneg-sec 0

verb 3

Netstat (tunnel active):

holmen@filserver:~$ netstat -anr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         46.246.20.129   128.0.0.0       UG        0 0          0 tap0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
5.150.128.0     0.0.0.0         255.255.128.0   U         0 0          0 eth1
46.246.20.128   0.0.0.0         255.255.255.128 U         0 0          0 tap0
80.67.8.222     192.168.1.1     255.255.255.255 UGH       0 0          0 eth0
128.0.0.0       46.246.20.129   128.0.0.0       UG        0 0          0 tap0
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0

Anyone got any ideas?

2 Answers 2

1

Your netstat shows that the VPN server provider is redirecting your client gateway (which is standard practice for VPN anonymizer services). This means it will tunnel all traffic, regardless of what interface is the source. What you need is route-nopull in your client config, which will stop the server changing your routing table, allowing you to manually create the routes you require.

1

If I understand you correctly you want OpenVPN client’s to follow a certain route, correct? If so, try adding it to the server config. I have included the server config of one of my test labs below, I added local <ext eth1 ip> to the server config:

local xxx.xxx.xxx.xxx
port 443
proto tcp
dev tap1
ca cacert.pem
cert servercert.pem
key servercert-unencr.key
dh dh1024.pem
persist-key
persist-tun
keepalive 20 120
tun-mtu 1500
server-bridge 192.168.200.1 255.255.255.0 192.168.200.10 192.168.200.15
ifconfig-pool-persist ipp-generic.txt
comp-lzo
duplicate-cn
daemon
verb 3
#redirect-gateway def1
push "route 192.168.100.0 255.255.255.0"
log-append /etc/openvpn/logs/ovpn-generic.log
up /etc/openvpn/ifconfig-tap1.sh
cd /etc/openvpn
push "dhcp-option DOMAIN lab.test"
push "dhcp-option NBT 2"
push "dhcp-option DNS 192.168.100.1"
push "dhcp-option DNS 4.2.2.2"
script-security 3 system

I will update if you have questions.

UPDATE: You have an entry in your routing table that's pointing all your traffic through your eth0 interface:

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0

That should either be changed to eth1 Iface and eth1’s IP for the gateway or removed entirely since you already have a route for your local network, and it’s conflicting with your other default route:

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         46.246.20.129   128.0.0.0       UG        0 0          0 tap0

My educated guess is the destination is the same, but the 2nd entry is taking precedence.

3
  • I'm not the one hosting the server since it's a anonymizer service.
    – junkyhlm
    Commented Jan 11, 2013 at 18:06
  • So the Ubuntu machine you mentioned above is not the OpenVPN server, but the OpenVPN client?
    – MDMoore313
    Commented Jan 11, 2013 at 20:21
  • Thats correct. I'm trying to connect to the anonymizer.
    – junkyhlm
    Commented Jan 11, 2013 at 20:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .