About software, technology and random things


Using OpenVPN For All Network Traffic Except For LAN


Recently I noticed that my Android smartphone was not able to connect to YouTube via third-party apps. I narrowed it down to the issue with it being able to resolve hostnames to the correct IPv6 addresses but not being able to connect to them (somehow the IPv6 part of my internet connection is broken. A problem for a different time).

In order to work around the problem I am using an OpenVPN connection which automatically forces all outgoing connections to use IPv4, not IPv6. The only problem was that internal LAN connections did not work any more.

In the .ovpn configuration file I am using

redirect-gateway local def1

(because it is a WiFi connection), but I was also using

redirect-gateway def1

before that, which did not make any difference in that regard.

If add a route directive like the following one after the redirect-gateway directive, you can add a route to the routing table, directing all traffic for the specified route to the WiFi connection instead of the VPN connection:

redirect-gateway local def1
route net_gateway

You will probably have to adjust the network address and maybe even the subnet mask to match your network.

The routing table is basically a prioritized table which lets the operating system decide which network adapter it should use for a specific connection. With the above entry you add a rule with a higher priority, overriding the generic one(s) from the OpenVPN connection configuration. These ones are added because of redirect-gateway def1 and tell the operating system to send all traffic via the virtual VPN network adapter, effectively sending it all over the VPN.

If you are configuring this from the OpenVPN server side, of course you can still use these directives, but in the context of the push directive. I am not doing that, however, so I saved both directives in the client configuration.

Now I can watch / listen to YouTube videos with third-party apps AND connect to LAN devices!

I hope this was helpful to you.

Thank you for reading!


CountSMS – iPhone SMS Counter (Updated: unnecessary)

Update (2011-06-02):
Of course it's been quite some time (I believe with iOS 4.0) since this has been rendered unnecessary. The official Messages app now lets you view the currently used characters. Good job, Apple!

If you ever attempted to send a text message on your iPhone, you will probably have noticed that it is kind of hard to estimate the amount of letters you have entered. Which is quite annoying though, seeing as a miscalculation might cost you money.

When I dug around the internet in order to find a capable app that could replace Apple's standard Messages app, I could only find solutions for jailbroken phones ("BiteSMS", I believe). My iPhone however isn't, and it won't be (at least not for a long time), so that wasn't an option.

A nice little application that doesn't integrate with your standard Messages app (sadly 🙁 ) but however does the job quite well (as in: count the characters AND have a landscape mode keyboard) is CountSMS (iTunes link). It is for free and you can use it with the clipboard of course without any problems whatsoever. It even has nice Copy and Paste buttons on the top corners! 🙂

I know it's not an absolute amazing app, but it gets the job done (a lot better than Apple's standard Messages app! Shame on you, if I might say so 🙂 )

Thanks for reading and I hope you can benefit from that.


iPhone Mail Push Notification without App and for free

Hey guys!

It's been a little while and I've come to own an iPhone now 🙂

One thing that frankly bothered me a little was the fact that apparently you can't have your mail show up automatically (especially with that nifty little badge with the number of new mails in the main menu) if you

  • have a mail account on a server that doesn't bring Apple Push Notifications
  • and you don't want to let your Mail app check on your mails periodically.

The best solution would of course be Push Notifications. But how would you do that without having to buy an extra app (and risking a trust-wise questionable third party to get your login details) and/or registering on such a website that creates an e-mail address for you, maybe even in exchange for subscription fees?

Actually, the latter part gave me the solution itself. As it says on the Wikipedia page for Push e-mail (iPhone/iPod touch section), Yahoo! Mail supports Push Notification - even for free accounts!

So what can we do with that?

We can set up a separate account at Yahoo Mail that will exclusively handle the e-mails we want to be Push Notified about. And in conjunction with appropriate mail filter rules we can redirect e-mails to our actual e-mail account(s) to the new Yahoo Mail address.

On the iPhone/iPod touch we keep the actual, old e-mail account as it is and create a new one (Setting => Mail, Contacts, Calendars => Add Account) for the Yahoo Mail address. We choose of course Yahoo Mail and enter the correct details. You can leave the Outgoing Mail Server settings as they are.

Now, why do we keep the actual account on the phone and why would we leave the Outgoing Mail Server settings on Yahoo settings if we wanted to keep that Yahoo address hidden from everyone else (and also replying with another e-mail address would be mildly confusing to the person who wrote to you).

Well, personally, I just use the Yahoo account as a pure Push Notification service. I see the number of new mails in the badge on the top right corner of the Mail app icon, I navigate to the Yahoo inbox folder, delete the mails (maybe clear it altogether), navigate back to my main mail account and read (and reply to) the new mails from there.

You get my point?

Hopefully that's of good use to you. For me, it saves me the trouble of having to buy an app which I'm probably not going to like completely 🙂

PS: If you run into trouble on Yahoo Mail with having all your forwarded mail dumped into the spam folder, set up some rules to move mails with "To: [email protected]" into the inbox folder. That should take care of it.