Q:

How to avoid IP packets leaking when openvpn connection drops

I have a laptop running Ubuntu 12.04 (still waiting for the 14.04.1)
I have set an openvpn network with the network manager.
If the vpn drops the network manager set back its route through the available network interface and the packet are routed through the other networks.
I there a simple way to avoid that ?

After some testing :
A VPN gateway can have many different addresses, you can check that using command 
nslookup VPN_gateway_name

If it is the case, each new request to establish a VPN will use randomly one IP in the address pool. To not change the IP filter at each new connection, one can use the DNS name of the gateway; iptables will set one rule for each IP. 
second rule will looks like
 sudo iptables -A OUTPUT -d your_vpn_gateway_dns_name -j ACCEPT

A:

Iptables will do this
sudo iptables -A OUTPUT -o tun0 -j ACCEPT
sudo iptables -A OUTPUT -d your_vpn_gateway_ip -j ACCEPT
sudo iptables -A OUTPUT -d 127.0.0.0/8 -j ACCEPT
sudo iptables -A OUTPUT -j REJECT

Assuming all output is going to the VPN. Note: Depending on your network, you traffic can be monitored via various tools such as wireshark, sort, etc.

