I want to force the use of VPN using iptables, therefore while VPN is disabled no outgoing traffic shall be allowed (except maybe some DHCP stuff...). Now i guess I could just block everything not going to the address of the VPN server? But then I still want to do another thing: I don't want to allow all traffic for some application, e.g. some shall have no internet access, some shall have only access to specific IP addresses. Is something like "application level" possible using iptables? Does iptables recognize, from which application traffic originates? And I guess when using VPN I can't filter for the real destination that comes behind the vpn server as it is probably encrypted in the vpn packets?

1 Answer 1



use iptables -m owner. This lets you setup OUTPUT chain rules based on UID, GID, PID, SID and command name.

  • 1
    Note that when you create a VPN connection, another interfaces is generally created and used. The traffic for the VPN can be routed to just that interface, as in the link.
    – Arcege
    Apr 7, 2012 at 1:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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