Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have set up a separate routing table (tovpn)

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

Now I assign routes to it.

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

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

Some network 172.20.20.0/24 has traffic forwarded to the table

#ip rule add from 172.22.22.0/24 table tovpn  
#iptables -t nat -A POSTROUTING -s 172.22.22.0/24 -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 8.8.4.4 over the tunnel.

#ip rule add to 8.8.4.4/32 table tovpn  

alternatively

#ip rule add to 8.8.4.4/32 lookup tovpn  

Any assistance would be greatly appreciated, thank you.

share|improve this question
2  
Hi, answers go in the Answer section, not as an edit to the question. –  Michael Hampton Mar 22 '13 at 15:42
add comment

1 Answer

up vote 0 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 8.8.8.8/32 -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
add comment

Your Answer

 
discard

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.