Page 1 of 1
Re: Raspberry pi + UMTS(3g) as OpenVPN Client not working
Posted: Sat Jun 18, 2016 6:27 pm
by darellon
Hmm, seems i cant ping any domain name (eg. google.com) but i can ping IP addresses.
I've pinged:
Code: Select all
(google-public-dns-a.google.com) 8.8.8.8
(google-public-dns-b.google.com) 8.8.4.4
(ns1.telstra.net) 139.130.4.5
also tried another of my servers ip address, getting a response from all four.
Am i correct in assuming it has something to do with the DNS settings?
Re: Raspberry pi + UMTS(3g) as OpenVPN Client not working
Posted: Sun Jun 19, 2016 3:58 pm
by darellon
In case someone else encounters the same problem:
I've solved the problem using the
update-resolv-conf script, which comes with OpenVPN and added the script lines provided by TinCanTech (
viewtopic.php?f=4&t=21844)
Added the following two lines to my client config file:
Code: Select all
up update-resolv-conf-up
down update-resolv-conf-down
Were
update-resolv-conf-up is:
Code: Select all
#!/bin/bash
#Added the following two lines
umts_gateway=$(/sbin/ifconfig ppp0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
/sbin/ip route add $trusted_ip/32 via $umts_gateway
[ -x /sbin/resolvconf ] || exit 0
[ "$script_type" ] || exit 0
[ "$dev" ] || exit 0
split_into_parts()
{
part1="$1"
part2="$2"
part3="$3"
}
case "$script_type" in
up)
NMSRVRS=""
SRCHS=""
for optionvarname in ${!foreign_option_*} ; do
option="${!optionvarname}"
echo "$option"
split_into_parts $option
if [ "$part1" = "dhcp-option" ] ; then
if [ "$part2" = "DNS" ] ; then
NMSRVRS="${NMSRVRS:+$NMSRVRS }$part3"
elif [ "$part2" = "DOMAIN" ] ; then
SRCHS="${SRCHS:+$SRCHS }$part3"
fi
fi
done
R=""
[ "$SRCHS" ] && R="search $SRCHS
"
for NS in $NMSRVRS ; do
R="${R}nameserver $NS
"
done
echo -n "$R" | /sbin/resolvconf -a "${dev}.openvpn"
;;
down)
/sbin/resolvconf -d "${dev}.openvpn"
;;
esac
and
update-resolv-conf-down is:
Code: Select all
#!/bin/bash
#Added the line below
/sbin/ip route delete $trusted_ip
[ -x /sbin/resolvconf ] || exit 0
[ "$script_type" ] || exit 0
[ "$dev" ] || exit 0
split_into_parts()
{
part1="$1"
part2="$2"
part3="$3"
}
case "$script_type" in
up)
NMSRVRS=""
SRCHS=""
for optionvarname in ${!foreign_option_*} ; do
option="${!optionvarname}"
echo "$option"
split_into_parts $option
if [ "$part1" = "dhcp-option" ] ; then
if [ "$part2" = "DNS" ] ; then
NMSRVRS="${NMSRVRS:+$NMSRVRS }$part3"
elif [ "$part2" = "DOMAIN" ] ; then
SRCHS="${SRCHS:+$SRCHS }$part3"
fi
fi
done
R=""
[ "$SRCHS" ] && R="search $SRCHS
"
for NS in $NMSRVRS ; do
R="${R}nameserver $NS
"
done
echo -n "$R" | /sbin/resolvconf -a "${dev}.openvpn"
;;
down)
/sbin/resolvconf -d "${dev}.openvpn"
;;
esac
Finally connected by typing:
Code: Select all
sudo openvpn --config client.ovpn --script-security 2
Thanks again for all the help

Re: Raspberry pi + UMTS(3g) as OpenVPN Client not working
Posted: Sun Jun 19, 2016 7:14 pm
by TinCanTech
Thanks for letting us know your solution
