Skip to contentSkip to conversation

multi-homed udp-based OpenVPN Server

Openvpn-devel Kate Kretz 5 participants 6 messages Oct 27, 2007 – Jan 22, 2008

lore
Share & tools
lore

Kate Kretz

author
#0 lore raw

Dear Sirs,

we tried to use OpenVPN Server on two-nic (both are internet-connected) server.
udp packets always go out on default gateway, even if they came from another nic.

are we doing something wrong with configuration ? or OpenVPN just cannot work on
two-nic server ?

if so, we'd probably collaborate in rewriting code.
as far as I remember, other udp services, say BIND, works well on two-nic server.

Cheers,
Kate

#1 lore raw

Hi

Quoted 4 lines · Kate Kretz
Quoted 4 lines

we tried to use OpenVPN Server on two-nic (both are internet-connected) server.
udp packets always go out on default gateway, even if they came from another nic.

I have the same problem.
Was not able to go more in depth into this problem, but i will (need to) soon.
In the meantime, i thought about using --float on the clients. This should work.

peter

Signature · 5 lines
:: e n d i a n
:: open source - open minds

:: peter warasin
:: http://www.endian.com   :: [email protected]...

begin:vcard
fn:Peter Warasin
n:;Peter Warasin
org:Endian GmbH/Srl
adr:;;Pillhof 47;Frangart/Frangarto;BZ;I-39010;Italien/Italia email;internet:[email protected]...
tel;work:+39 0471 631763
tel;fax:+39 0471 631764
x-mozilla-html:FALSE
url:http://www.endian.com
version:2.1
end:vcard

#2 lore raw

Hiyas,

Quoted 11 lines · On Monday 21 January 2008 11:32:34 Peter Warasin wrote:
Quoted 4 lines · Kate Kretz
Quoted 4 lines

we tried to use OpenVPN Server on two-nic (both are internet-connected) server.
udp packets always go out on default gateway, even if they came from another nic.

I have the same problem.
Was not able to go more in depth into this problem, but i will (need to) soon.
In the meantime, i thought about using --float on the clients. This should work.

here it works with iptables connection marking and iproute2. iptables marks incomming connections for each uplink and based on the mark it is decided which device should be used to send the answer.
Here is some pseudo code:

# mark the connections for each interface (does also work with stateful 
# filtering, but I omitted it here
iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark
iptables -t mangle -A OUTPUT -j CONNMARK --restore-mark
iptables -t mangle -A PREROUTING -i eth0 -j MARK  --set-mark 1
iptables -t mangle -A PREROUTING -i eth0 -j CONNMARK --save-mark
iptables -t mangle -A PREROUTING -i eth1 -j MARK  --set-mark 2
iptables -t mangle -A PREROUTING -i eth1 -j CONNMARK --save-mark
# give names to the iproute tables 1, 2 and 3
echo -e "1 eth0.uplink\n2 eth1.uplink\n3 loopback.default" 
Quoted 1 line
Quoted 1 line

/etc/iproute2/rt_tables

# packets with mark 1 should go out via eth0.uplink
ip rule add prio 40001 fwmark 1 lookup eth0.uplink
# mark2 -> eth1
ip rule add prio 40002 fwmark 2 lookup eth1.uplink

# In case only the routing table is queried but not package

# really send, this provides still a dummy route
ip rule add prio 60000 dev lo lookup loopback.default

# Information about the different gateways for the different uplinks ip route add table eth0.uplink default via XXX.XXX.XXX.XXX ip route add table eth1.uplink default via XXX.XXX.ZZZ.XXX ip route table loopback.default to default via 127.0.0.1

OpenVPN runs on a separate dummy device and the traffic from all interfaces where it should listen on is forwarded via a DNAT and also for every outgoing device SNAT is done with iptables. Maybe this is useful for you, too.

Regards,
Till

#3 lore raw
In reply to Peter Warasin

Hi,

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

we tried to use OpenVPN Server on two-nic (both are internet-connected) server.
udp packets always go out on default gateway, even if they came from another nic.

In the meantime, i thought about using --float on the clients. This should work.

I run in the same situation and tried to work around the problem by using the "local" configuration option in order to force the OpenVPN process to bind on each outgoing interface instead of the default wildcard bind.

This way, OpenVPN UDP packets are replied on the interface they came from. Unfortunately, for two outgoing interfaces this means having two separate OpenVPN instances running.
If your requirement is just high availability rather than load balancing, combining the mentioned setup with heartbeat works just fine.

However, i was not able to SNAT outgoing connections to their respective interface address by using iproute/iptables and connection marks. But the trick using a dummy interface and bind OpenVPN to it like Till Maas suggested looks promising.

regards,
Robert

#4 lore raw

Are you aware of the ./configure --multihome option in the 2.1 beta series?

James

Quoted 43 lines · triton

Hi,

Quoted 10 lines
Quoted 5 lines
Quoted 5 lines

we tried to use OpenVPN Server on two-nic (both are internet-connected) server.
udp packets always go out on default gateway, even if they came from another nic.

In the meantime, i thought about using --float on the clients. This should work.

I run in the same situation and tried to work around the problem by using the "local" configuration option in order to force the OpenVPN process to bind on each outgoing interface instead of the default wildcard bind.

This way, OpenVPN UDP packets are replied on the interface they came from. Unfortunately, for two outgoing interfaces this means having two separate OpenVPN instances running.
If your requirement is just high availability rather than load balancing, combining the mentioned setup with heartbeat works just fine.

However, i was not able to SNAT outgoing connections to their respective interface address by using iproute/iptables and connection marks. But the trick using a dummy interface and bind OpenVPN to it like Till Maas suggested looks promising.

regards,
Robert

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Openvpn-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

#5 lore raw
Quoted 1 line · James Yonan

Are you aware of the ./configure --multihome option in the 2.1 beta series?

No, I wasn't. Thank you very much for pointing that out.

Best regards,
Robert