Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

My VPN filters port 25 (to prevent spam) but my ISP doesn't. The VPN takes over all traffic and changes the default gateway? How can I bypass the VPN to send mail? I want all outgoing traffic except on port 25 to continue using the VPN.

My setup:

router (this is the default gateway when VPN is not connected)

I tried to use iptables to do something with --dport 25 but I don't really know my way around the firewall.

I am using Ubuntu 12.10.

Another thing is that runs several servers (web, mail, ssh, ...). The router forwards requests on those ports (80, 443, ...) to To stop the VPN from interfering with this, I run:

ip rule add from table 10
ip route add default via table 10

All of my servers started working except mail (because of the same issue with port 25?) so I changed postfix to run on 2525 (and had the router forward port 25 there) and that got it working.

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface       UG    0      0        0 tun0         UG    0      0        0 eth0 UGH   0      0        0 tun0 UH    0      0        0 tun0 UGH   0      0        0 eth0       UG    0      0        0 tun0     U     1000   0        0 eth0   U     1      0        0 eth0
share|improve this question

closed as not a real question by Falcon Momot, Ward, growse, gWaldo, Dave M May 24 '13 at 15:48

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Does your VPN really block outbound port 25 or simply ask that you relay all mail through their mail servers instead (like many home ISPs do)? Big difference. – TheCleaner May 24 '13 at 18:03

Two possibilities come to mind:

  1. Add a static route to your external mail server's IP address which is explicitly routed via the Ethernet interface instead of the default route.

  2. Send out your outgoing mail to the external mail server on the submission port (587).

The best answer, though, is to run the mail server on a different (virtual) machine than the VPN, so that you can route its traffic appropriately. Routes can only be specified by IP address/network, not by port number.

share|improve this answer
1. I don't know how to do that. The mail server is, the machine connected to the VPN itself. 2. The question is about how postfix itself can deliver messages. For example, if I send an e-mail to, it's going to try to talk to on port 25. – Jason May 24 '13 at 17:41
Hm, you should fix that first. – Michael Hampton May 24 '13 at 17:42

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