Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a few interfaces: wlan0, eth0, lo, and sometimes tun0. When I connect to the Juniper VPN, creating a tun0 interface, my existing connections on other interfaces (perhaps with the exception of lo) are interrupted, and they reconnect using the tun0 interface.

I only want to use tun0 on particular connections of my choosing, not all of them, and not by default. How can I ensure that the default interface is eth0 or wlan0? The output of ip addr is here:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether d4:be:d9:65:c1:45 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 24:77:03:ab:a6:dc brd ff:ff:ff:ff:ff:ff
    inet 10.23.4.5/24 brd 10.23.4.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 2601:d:a780:2c3:f803:d084:a01f:f156/64 scope global temporary dynamic 
       valid_lft 86397sec preferred_lft 14397sec
    inet6 2601:d:a780:2c3:2677:3ff:feab:a6dc/64 scope global dynamic 
       valid_lft 86397sec preferred_lft 14397sec
    inet6 fe80::2677:3ff:feab:a6dc/64 scope link 
       valid_lft forever preferred_lft forever
5: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1400 qdisc pfifo_fast state UNKNOWN group default qlen 500
    link/none 
    inet 140.182.72.57/32 scope global tun0
       valid_lft forever preferred_lft forever

Source: http://sprunge.us/KKGP

I noticed that tun0 is on the bottom, so I would think it's bottom priority, too?

NOTE: For what it's worth, I don't know how to modify the priority of the other interfaces either (eth0, wlan0, lo).

share|improve this question

1 Answer 1

up vote 3 down vote accepted

It not about interface priority. The routing table determines what path your traffic will take. See ip route show and ip route get ipaddress

Most VPNs push a default route via themselves. In my OpenVPN setup I've configured it to only push routes to the internal IP space, however that is a server-side option.

Your client may offer the option of ignoring the pushed routes and specifying your own.

share|improve this answer

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.