I have an existing Openvpn setup with 4 network. I'm running them on routers (server : ddwrt, clients: tomato+ddwrt) and I am bridging the networks together.
The idea is that each network should access the internet via it's own gateway, only the network traffic between the clietns goes through the VPN.
Suddenly one of them fails to connect to the server any more
I've traced down and it looks like it's not working any more over UDP. I've tried with TCP, it connects successfully, but I can't ping anything.
What I want to achieve is to connect the 3rd computer via TCP and the others via UDP (as UDP is faster)
Here's the setup:
Server:
Code: Select all
openvpn --mktun --dev tap0
brctl addif br0 tap0
ifconfig tap0 0.0.0.0 promisc up
sleep 5
ln -s /usr/sbin/openvpn /tmp/myvpn
/tmp/myvpn --config openvpn.conf
/tmp/myvpn --config openvpntcp.conf
route add -net 192.168.1.0/24 dev br0
server config1 (UDP)
openvpn.conf
Code: Select all
# Tunnel options
mode server # Set OpenVPN major mode
proto udp # Setup the protocol (server)
port 1194 # TCP/UDP port number
dev tap0 # TUN/TAP virtual network device
keepalive 15 60 # Simplify the expression of --ping
daemon # Become a daemon after all initialization
verb 3 # Set output verbosity to n
#comp-lzo # Use fast LZO compression
# OpenVPN server mode options
client-to-client # tells OpenVPN to internally route client-to-client traffic
duplicate-cn # Allow multiple clients with the same common name
# TLS Mode Options
tls-server # Enable TLS and assume server role during TLS handshake
ca ca.crt # Certificate authority (CA) file
dh dh1024.pem # File containing Diffie Hellman parameters
#cipher AES-192-CBC
cipher none
tls-cipher AES256-SHA
cert server.crt # Local peer's signed certificate
key server.key # Local peer's private key
openvpntcp.conf
Code: Select all
# Tunnel options
mode server # Set OpenVPN major mode
proto tcp-server # Setup the protocol (server)
port 1195 # TCP/UDP port number
dev tap # TUN/TAP virtual network device
keepalive 15 60 # Simplify the expression of --ping
daemon # Become a daemon after all initialization
verb 3 # Set output verbosity to n
#comp-lzo # Use fast LZO compression
# OpenVPN server mode options
client-to-client # tells OpenVPN to internally route client-to-client traffic
duplicate-cn # Allow multiple clients with the same common name
# TLS Mode Options
tls-server # Enable TLS and assume server role during TLS handshake
ca ca.crt # Certificate authority (CA) file
dh dh1024.pem # File containing Diffie Hellman parameters
#cipher AES-192-CBC
cipher none
tls-cipher AES256-SHA
cert server.crt # Local peer's signed certificate
key server.key # Local peer's private key
Code: Select all
insmod ipt_mark
insmod xt_mark
iptables -t mangle -A PREROUTING -i ! `get_wanface` -d `nvram get wan_ipaddr` -j MARK --set-mark 0xd001
iptables -t mangle -A PREROUTING -j CONNMARK --save-mark
iptables -t nat -A POSTROUTING -m mark --mark 0xd001 -j MASQUERADE
# Open firewall holes
iptables -I INPUT 2 -p tcp --dport 1195 -j ACCEPT
iptables -I FORWARD -i br0 -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -o br0 -j ACCEPT
the clients which use UDP are working:
client.confsleep 5
ln -s /usr/sbin/openvpn /tmp/myvpn
/tmp/myvpn --mktun --dev tap0
brctl addif br0 tap0
ifconfig tap0 0.0.0.0 promisc up
sleep 5
/tmp/myvpn --config /tmp/client.conf
route add -net 192.168.1.0/24 dev br0
sleep 15 ; insmod /lib/modules/2.4.37/ebtables ; insmod /lib/modules/2.4.37/ebtable_filter ; insmod /lib/modules/2.4.37/ebt_ip.o &
sleep 25 ; /usr/sbin/ebtables -I INPUT -i tap0 -p IPv4 --ip-protocol udp --ip-destination-port 67:68 -j DROP &
sleep 5 ; /usr/sbin/ebtables -I OUTPUT -o tap0 -p IPv4 --ip-protocol udp --ip-destination-port 67:68 -j DROP &
Code: Select all
client
daemon
float
dev tap0
proto udp
remote barney.ro 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca /tmp/ca.crt
cert /tmp/client.crt
key /tmp/client.key
ns-cert-type server
#cipher AES-192-CBC
cipher none
tls-cipher AES256-SHA
#comp-lzo adaptive
verb 3
Code: Select all
Automatically generated configuration
daemon
client
dev tap11
proto udp
remote barney.ro 1194
resolv-retry infinite
nobind
persist-key
persist-tun
cipher none
verb 3
script-security 2
up updown.sh
down updown.sh
ca ca.crt
cert client.crt
key client.key
status-version 2
status status
# Custom Configuration
float
ns-cert-type server
tls-cipher AES256-SHA