Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to execute a bash script after a TUN driver (e.g. tun0) is up under ubuntu 9.04/9.10. I need it to use the assigned VPN IP in some configuration scripts. Do you have any suggestion?

Thanks in advance,


share|improve this question
up vote 3 down vote accepted

Look in the manual page for the --up cmd configuration entry. The script cmd is passed a whole lot of environment variables that tell it what is going on, and anything you might want to do is covered by those.

share|improve this answer
Thanks Andrew! That's exactly what I was looking for. Sorry for not looking at the man page first. In ubuntu 9.04, a init.d script named openvpn uses .conf files in /etc/openvpn to start a vpn process. I can edit edit that script and set OPTARGS with --up and --down directives. – Humber Jan 6 '10 at 15:24

You can try the --up switch (on command lien) or the up directive (in config file). See the OpenVPN MAN page.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.