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 have set up a separate routing table (tovpn)

#echo 200 tovpn >> /etc/iproute2/rt_tables  

Now I assign routes to it.

Where is the tun2 P-t-P and is the inet

#ip route add dev tun2 table tovpn  
#ip route add default via dev tun2 table tovpn  

Some network has traffic forwarded to the table

#ip rule add from table tovpn  
#iptables -t nat -A POSTROUTING -s -o tun2 -j MASQUERADE  

Great, everything works.

How do I specify traffic additional traffic to pass through the tunnel by specifying the host ip?

The following does not work, if I would like to route, for example, traffic to over the tunnel.

#ip rule add to table tovpn  


#ip rule add to lookup tovpn  

Any assistance would be greatly appreciated, thank you.

share|improve this question
Hi, answers go in the Answer section, not as an edit to the question. – Michael Hampton Mar 22 '13 at 15:42
up vote 1 down vote accepted

My routing table was incorrectly setup. Correct setup as follows:

# ip route add $PTPADDR src $INETADDR proto kernel dev tun1 table tovpn  
# ip route add default dev tun1 table tovpn  

Now mark packets with

# iptables -t mangle -A PREROUTING -i $LANINTERFACE -d -j MARK --set-mark 300
share|improve this answer
Please be sure to mark your answer accepted when you're able. – jscott Apr 9 '13 at 12:51

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.