Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am currently trying to route all incoming and outgoing network traffic to/from applications listening on an OpenVPN tunnel tun1 through said tunnel.

Here are my devices: tun0 is an OpenVPN server running on the machine that provides access to the machine's local network to remote machines. tun1 is an OpenVPN client to a remote server.

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1c:c0:d7:98:1c  
          inet addr:192.168.178.9  Bcast:192.168.178.255  Mask:255.255.255.0
          inet6 addr: fe80::21c:c0ff:fed7:981c/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:103987444 errors:0 dropped:0 overruns:0 frame:0
          TX packets:161412265 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:583178850 (556.1 MiB)  TX bytes:1006632339 (959.9 MiB)
          Interrupt:43 Base address:0x8000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:505197 errors:0 dropped:0 overruns:0 frame:0
          TX packets:505197 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:91836367 (87.5 MiB)  TX bytes:91836367 (87.5 MiB)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.9.8.1  P-t-P:10.9.8.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:272 (272.0 B)  TX bytes:960 (960.0 B)

tun1      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.8.0.10  P-t-P:10.8.0.9  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:7 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:588 (588.0 B)  TX bytes:588 (588.0 B)

Here are the currently active routes:

# ip route show table main
default via 192.168.178.1 dev eth0 
10.8.0.1 via 10.8.0.9 dev tun1 
10.8.0.9 dev tun1  proto kernel  scope link  src 10.8.0.10 
10.9.8.0/24 via 10.9.8.2 dev tun0 
10.9.8.2 dev tun0  proto kernel  scope link  src 10.9.8.1 
192.168.178.0/24 dev eth0  proto kernel  scope link  src 192.168.178.9 

After some research, I learned that I had to use "policy routing" to direct all traffic on tun1 through another gateway (10.8.0.1). So I created a new table "tun1" and tried to configure it.

# echo "1 tun1tbl" >> /etc/iproute2/rt_tables
# ip route add 10.8.0.0/24 dev tun1 src 10.8.0.10 table tun1tbl
# ip route add default via 10.8.0.1 dev tun1 table tun1tbl
RTNETLINK answers: No such process

Why can't I set the default route for this device/table?

-- edit: I just found another potential solution, using only route, but it fails with a similar error:

# route add default gw 10.8.0.1 dev tun1
SIOCADDRT: No such process
share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.