Ade Malsasa Akbar contact
Senior author, Open Source enthusiast.
Wednesday, September 9, 2015 at 01:00

One problem when you use OpenVPN is you can not bind OpenVPN connection to mobile broadband ppp0 interface. This ppp0 interface is commonly used when you are using USB modem. To bind OpenVPN into ppp0 interface, you must configure it manually. This is a routing for all connection to your ISP gateway via ppp0 interface. Don't be afraid, you will need only two commands. Here for example.

1. Connect to Internet


Connect to the internet from your USB modem (mobile broadband). Don't connect your OpenVPN first. You may use wvdial here.

2. Know Your Gateway

/sbin/ip addr show ppp0 | grep peer | awk ' { print $4 } ' | sed 's/\/32//'
Explanation: this command will find out your gateway address. First, it will invoke ip command to show ppp0 information, then it grabs a line contains "peer" word, then it grabs fourth word from left (which is IP address of the gateway), and finally remove "/32" notation from the address. For example, my gateway address is 10.20.31.30.

3. Bind Connection into ppp0


ip route replace default via 10.20.31.30 dev ppp0
Explanation: this command will route all connections to 10.20.31.30 gateway through ppp0 device interface. Later, any OpenVPN connection will go through this route. Of course you must change gateway address with your own.

4. Connect OpenVPN


Finally, connect your OpenVPN. Now you should have your connection go through ppp0 (mobile broadband) correctly.

Reference


http://askubuntu.com/questions/580014/how-to-bind-openvpn-to-ppp0-from-mobile-broadband