Is it possible to stop using VPN on some application?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Currently i am using VPN (done by bitmask) to go only the internet. But i would like to set it up so that two applications access the internet directly. Is there a way to do that?
$ sudo ip6tables --list-rules
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-N bitmask
-A OUTPUT -j bitmask
-A bitmask -d fe80::/64 -o wlp3s0 -j ACCEPT
-A bitmask -d ff05::c/128 -o wlp3s0 -p udp -m udp --dport 1900 -j RETURN
-A bitmask -d ff02::fb/128 -o wlp3s0 -p udp -m udp --dport 5353 -j RETURN
-A bitmask -p tcp -j REJECT --reject-with icmp6-port-unreachable
-A bitmask -p udp -j REJECT --reject-with icmp6-port-unreachable
$ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 303190 bytes 23045786 (23.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 303190 bytes 23045786 (23.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.41.0.18 netmask 255.255.248.0 destination 10.41.0.18
inet6 fe80::7b5f:9d91:701e:c55 prefixlen 64 scopeid 0x20<link>
inet6 2001:db8:123::1010 prefixlen 64 scopeid 0x0<global>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 2419226 bytes 2916699759 (2.9 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1562458 bytes 208828031 (208.8 MB)
TX errors 0 dropped 107 overruns 0 carrier 0 collisions 0
wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.147 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::b43f:cba:ab11:d9a8 prefixlen 64 scopeid 0x20<link>
ether 24:0a:64:da:d6:eb txqueuelen 1000 (Ethernet)
RX packets 6908650 bytes 3525833381 (3.5 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7751152 bytes 7915813822 (7.9 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
$ iwconfig
tun0 no wireless extensions.
lo no wireless extensions.
enp4s0 no wireless extensions.
wlp3s0 IEEE 802.11 ESSID:"ZTE_C5959A"
Mode:Managed Frequency:2.462 GHz Access Point: FC:2D:5E:C5:95:9A
Bit Rate=52 Mb/s Tx-Power=15 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=47/70 Signal level=-63 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:6 Invalid misc:62 Missed beacon:0
networking vpn
add a comment |
Currently i am using VPN (done by bitmask) to go only the internet. But i would like to set it up so that two applications access the internet directly. Is there a way to do that?
$ sudo ip6tables --list-rules
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-N bitmask
-A OUTPUT -j bitmask
-A bitmask -d fe80::/64 -o wlp3s0 -j ACCEPT
-A bitmask -d ff05::c/128 -o wlp3s0 -p udp -m udp --dport 1900 -j RETURN
-A bitmask -d ff02::fb/128 -o wlp3s0 -p udp -m udp --dport 5353 -j RETURN
-A bitmask -p tcp -j REJECT --reject-with icmp6-port-unreachable
-A bitmask -p udp -j REJECT --reject-with icmp6-port-unreachable
$ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 303190 bytes 23045786 (23.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 303190 bytes 23045786 (23.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.41.0.18 netmask 255.255.248.0 destination 10.41.0.18
inet6 fe80::7b5f:9d91:701e:c55 prefixlen 64 scopeid 0x20<link>
inet6 2001:db8:123::1010 prefixlen 64 scopeid 0x0<global>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 2419226 bytes 2916699759 (2.9 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1562458 bytes 208828031 (208.8 MB)
TX errors 0 dropped 107 overruns 0 carrier 0 collisions 0
wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.147 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::b43f:cba:ab11:d9a8 prefixlen 64 scopeid 0x20<link>
ether 24:0a:64:da:d6:eb txqueuelen 1000 (Ethernet)
RX packets 6908650 bytes 3525833381 (3.5 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7751152 bytes 7915813822 (7.9 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
$ iwconfig
tun0 no wireless extensions.
lo no wireless extensions.
enp4s0 no wireless extensions.
wlp3s0 IEEE 802.11 ESSID:"ZTE_C5959A"
Mode:Managed Frequency:2.462 GHz Access Point: FC:2D:5E:C5:95:9A
Bit Rate=52 Mb/s Tx-Power=15 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=47/70 Signal level=-63 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:6 Invalid misc:62 Missed beacon:0
networking vpn
Split Tunneling is covered by most VPN Providers.
– EODCraft Staff
Mar 31 at 10:59
@EODCraftStaff I do not want split tunneling, i wish to have an application that doesn't tunnel through the VPN interface at all.
– v010dya
Apr 7 at 4:52
add a comment |
Currently i am using VPN (done by bitmask) to go only the internet. But i would like to set it up so that two applications access the internet directly. Is there a way to do that?
$ sudo ip6tables --list-rules
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-N bitmask
-A OUTPUT -j bitmask
-A bitmask -d fe80::/64 -o wlp3s0 -j ACCEPT
-A bitmask -d ff05::c/128 -o wlp3s0 -p udp -m udp --dport 1900 -j RETURN
-A bitmask -d ff02::fb/128 -o wlp3s0 -p udp -m udp --dport 5353 -j RETURN
-A bitmask -p tcp -j REJECT --reject-with icmp6-port-unreachable
-A bitmask -p udp -j REJECT --reject-with icmp6-port-unreachable
$ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 303190 bytes 23045786 (23.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 303190 bytes 23045786 (23.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.41.0.18 netmask 255.255.248.0 destination 10.41.0.18
inet6 fe80::7b5f:9d91:701e:c55 prefixlen 64 scopeid 0x20<link>
inet6 2001:db8:123::1010 prefixlen 64 scopeid 0x0<global>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 2419226 bytes 2916699759 (2.9 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1562458 bytes 208828031 (208.8 MB)
TX errors 0 dropped 107 overruns 0 carrier 0 collisions 0
wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.147 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::b43f:cba:ab11:d9a8 prefixlen 64 scopeid 0x20<link>
ether 24:0a:64:da:d6:eb txqueuelen 1000 (Ethernet)
RX packets 6908650 bytes 3525833381 (3.5 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7751152 bytes 7915813822 (7.9 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
$ iwconfig
tun0 no wireless extensions.
lo no wireless extensions.
enp4s0 no wireless extensions.
wlp3s0 IEEE 802.11 ESSID:"ZTE_C5959A"
Mode:Managed Frequency:2.462 GHz Access Point: FC:2D:5E:C5:95:9A
Bit Rate=52 Mb/s Tx-Power=15 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=47/70 Signal level=-63 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:6 Invalid misc:62 Missed beacon:0
networking vpn
Currently i am using VPN (done by bitmask) to go only the internet. But i would like to set it up so that two applications access the internet directly. Is there a way to do that?
$ sudo ip6tables --list-rules
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-N bitmask
-A OUTPUT -j bitmask
-A bitmask -d fe80::/64 -o wlp3s0 -j ACCEPT
-A bitmask -d ff05::c/128 -o wlp3s0 -p udp -m udp --dport 1900 -j RETURN
-A bitmask -d ff02::fb/128 -o wlp3s0 -p udp -m udp --dport 5353 -j RETURN
-A bitmask -p tcp -j REJECT --reject-with icmp6-port-unreachable
-A bitmask -p udp -j REJECT --reject-with icmp6-port-unreachable
$ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 303190 bytes 23045786 (23.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 303190 bytes 23045786 (23.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 10.41.0.18 netmask 255.255.248.0 destination 10.41.0.18
inet6 fe80::7b5f:9d91:701e:c55 prefixlen 64 scopeid 0x20<link>
inet6 2001:db8:123::1010 prefixlen 64 scopeid 0x0<global>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 2419226 bytes 2916699759 (2.9 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1562458 bytes 208828031 (208.8 MB)
TX errors 0 dropped 107 overruns 0 carrier 0 collisions 0
wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.147 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::b43f:cba:ab11:d9a8 prefixlen 64 scopeid 0x20<link>
ether 24:0a:64:da:d6:eb txqueuelen 1000 (Ethernet)
RX packets 6908650 bytes 3525833381 (3.5 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7751152 bytes 7915813822 (7.9 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
$ iwconfig
tun0 no wireless extensions.
lo no wireless extensions.
enp4s0 no wireless extensions.
wlp3s0 IEEE 802.11 ESSID:"ZTE_C5959A"
Mode:Managed Frequency:2.462 GHz Access Point: FC:2D:5E:C5:95:9A
Bit Rate=52 Mb/s Tx-Power=15 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:off
Link Quality=47/70 Signal level=-63 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:6 Invalid misc:62 Missed beacon:0
networking vpn
networking vpn
edited Apr 7 at 4:51
v010dya
asked Mar 31 at 6:15
v010dyav010dya
7022929
7022929
Split Tunneling is covered by most VPN Providers.
– EODCraft Staff
Mar 31 at 10:59
@EODCraftStaff I do not want split tunneling, i wish to have an application that doesn't tunnel through the VPN interface at all.
– v010dya
Apr 7 at 4:52
add a comment |
Split Tunneling is covered by most VPN Providers.
– EODCraft Staff
Mar 31 at 10:59
@EODCraftStaff I do not want split tunneling, i wish to have an application that doesn't tunnel through the VPN interface at all.
– v010dya
Apr 7 at 4:52
Split Tunneling is covered by most VPN Providers.
– EODCraft Staff
Mar 31 at 10:59
Split Tunneling is covered by most VPN Providers.
– EODCraft Staff
Mar 31 at 10:59
@EODCraftStaff I do not want split tunneling, i wish to have an application that doesn't tunnel through the VPN interface at all.
– v010dya
Apr 7 at 4:52
@EODCraftStaff I do not want split tunneling, i wish to have an application that doesn't tunnel through the VPN interface at all.
– v010dya
Apr 7 at 4:52
add a comment |
2 Answers
2
active
oldest
votes
This is possible using network namespaces.
network namespaces allows separate ip,routing table, socket listing, connection tracking table firewall and other network-related resources.
At least for VPN solutions like Layer3 SSH, OpenVPN and Wireguard since they are using a virtual interface to route VPN traffic.
In this simplified example the computer has two interfaces eth0 & eth1 both with
DHCP internet access.
Connect to VPN.
in a terminal:
sudo ip netns add not-vpn
# create new network namespacesudo ip link set eth1 netns not-vpn
# put eth1 in new namespacesudo ip netns exec not-vpn bash
# enter new namespace with a shelldhclient eth1
# get an DHCP IP for the moved interfacecurl icanhazip.com
# curl application will return your non-vpn public IPIn a another terminal:
curl icanhazip.com
curl application will return your VPN public IP
assuming that your VPN is configured to route all traffic through it by default.
I assume thateth1
is meant to be the interface i use to connect to the network, i'm using wireless, so i try to substitute it withwlp3s0
, however, i getRTNETLINK answers: Invalid argument
error.
– v010dya
Apr 5 at 4:24
If eth1 is wireless in this example iw phy phy0 set netns name not-vpn
– tomodachi
Apr 5 at 7:24
Doing that completely removed wireless from my machine making it impossible to even connect to a wireless network.
– v010dya
Apr 5 at 11:23
Let's refine the answer once we get it working. Could you try attempt to do the opposite? put enp4s0 in the name space while using wifi for VPN. Your enp4s0 needs to be connected to Internet also
– tomodachi
Apr 5 at 13:22
1
You should run dhclient enp4s0 , since that's the name of the interface you moved into the namespace
– tomodachi
Apr 13 at 13:55
|
show 1 more comment
You can add a route for those two applications so they directly connect to the IP address you want (with wireless card as an interface and your router as a Gateway) and all other traffics go through VPN (add a default route the interface is set to your vpn interface that is shown in ifconfig
and set your Gateway to your router and remove the previous one
You can simply add a new route with this instruction
PS: After you turn off your VPN because of your new default route you can't access to the internet so your VPN should always be on or you have to write the previous default route that you removed before
In those instructions i see how to add routes, but i do not understand how it is relating to make them application specific.
– v010dya
Apr 7 at 17:27
you have to find out which ip address or addresses those two applications connect , for doing this you can simply run wireshark or tcpdump and when you are running those applications look at destination address and when you find out you can add a new route to that network or specefic host and tell your system when the destination address is these , send data from your wireless card and your router ip address as a Gateway @v010dya
– Afshin
Apr 8 at 5:20
For testing it , first remove the default route in your routing table and just add routes to destination of those two application , if you are doing in the right way , you should just be able to connect to those applications and nothing else like google etc @v010dya
– Afshin
Apr 8 at 5:23
The IP addresses that those applications connect to will change all the time. So i guess this approach does not suit me.
– v010dya
Apr 8 at 5:45
As far as I know it can't have changeable IP address , they just have multi IP address for redundancy purpose and etc , so you can find all of IP addresses of a specific applications by searching (if it is well known app) or asking from support team and write multiple route for an app , but if you say so ..
– Afshin
Apr 8 at 14:22
|
show 1 more comment
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1130068%2fis-it-possible-to-stop-using-vpn-on-some-application%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is possible using network namespaces.
network namespaces allows separate ip,routing table, socket listing, connection tracking table firewall and other network-related resources.
At least for VPN solutions like Layer3 SSH, OpenVPN and Wireguard since they are using a virtual interface to route VPN traffic.
In this simplified example the computer has two interfaces eth0 & eth1 both with
DHCP internet access.
Connect to VPN.
in a terminal:
sudo ip netns add not-vpn
# create new network namespacesudo ip link set eth1 netns not-vpn
# put eth1 in new namespacesudo ip netns exec not-vpn bash
# enter new namespace with a shelldhclient eth1
# get an DHCP IP for the moved interfacecurl icanhazip.com
# curl application will return your non-vpn public IPIn a another terminal:
curl icanhazip.com
curl application will return your VPN public IP
assuming that your VPN is configured to route all traffic through it by default.
I assume thateth1
is meant to be the interface i use to connect to the network, i'm using wireless, so i try to substitute it withwlp3s0
, however, i getRTNETLINK answers: Invalid argument
error.
– v010dya
Apr 5 at 4:24
If eth1 is wireless in this example iw phy phy0 set netns name not-vpn
– tomodachi
Apr 5 at 7:24
Doing that completely removed wireless from my machine making it impossible to even connect to a wireless network.
– v010dya
Apr 5 at 11:23
Let's refine the answer once we get it working. Could you try attempt to do the opposite? put enp4s0 in the name space while using wifi for VPN. Your enp4s0 needs to be connected to Internet also
– tomodachi
Apr 5 at 13:22
1
You should run dhclient enp4s0 , since that's the name of the interface you moved into the namespace
– tomodachi
Apr 13 at 13:55
|
show 1 more comment
This is possible using network namespaces.
network namespaces allows separate ip,routing table, socket listing, connection tracking table firewall and other network-related resources.
At least for VPN solutions like Layer3 SSH, OpenVPN and Wireguard since they are using a virtual interface to route VPN traffic.
In this simplified example the computer has two interfaces eth0 & eth1 both with
DHCP internet access.
Connect to VPN.
in a terminal:
sudo ip netns add not-vpn
# create new network namespacesudo ip link set eth1 netns not-vpn
# put eth1 in new namespacesudo ip netns exec not-vpn bash
# enter new namespace with a shelldhclient eth1
# get an DHCP IP for the moved interfacecurl icanhazip.com
# curl application will return your non-vpn public IPIn a another terminal:
curl icanhazip.com
curl application will return your VPN public IP
assuming that your VPN is configured to route all traffic through it by default.
I assume thateth1
is meant to be the interface i use to connect to the network, i'm using wireless, so i try to substitute it withwlp3s0
, however, i getRTNETLINK answers: Invalid argument
error.
– v010dya
Apr 5 at 4:24
If eth1 is wireless in this example iw phy phy0 set netns name not-vpn
– tomodachi
Apr 5 at 7:24
Doing that completely removed wireless from my machine making it impossible to even connect to a wireless network.
– v010dya
Apr 5 at 11:23
Let's refine the answer once we get it working. Could you try attempt to do the opposite? put enp4s0 in the name space while using wifi for VPN. Your enp4s0 needs to be connected to Internet also
– tomodachi
Apr 5 at 13:22
1
You should run dhclient enp4s0 , since that's the name of the interface you moved into the namespace
– tomodachi
Apr 13 at 13:55
|
show 1 more comment
This is possible using network namespaces.
network namespaces allows separate ip,routing table, socket listing, connection tracking table firewall and other network-related resources.
At least for VPN solutions like Layer3 SSH, OpenVPN and Wireguard since they are using a virtual interface to route VPN traffic.
In this simplified example the computer has two interfaces eth0 & eth1 both with
DHCP internet access.
Connect to VPN.
in a terminal:
sudo ip netns add not-vpn
# create new network namespacesudo ip link set eth1 netns not-vpn
# put eth1 in new namespacesudo ip netns exec not-vpn bash
# enter new namespace with a shelldhclient eth1
# get an DHCP IP for the moved interfacecurl icanhazip.com
# curl application will return your non-vpn public IPIn a another terminal:
curl icanhazip.com
curl application will return your VPN public IP
assuming that your VPN is configured to route all traffic through it by default.
This is possible using network namespaces.
network namespaces allows separate ip,routing table, socket listing, connection tracking table firewall and other network-related resources.
At least for VPN solutions like Layer3 SSH, OpenVPN and Wireguard since they are using a virtual interface to route VPN traffic.
In this simplified example the computer has two interfaces eth0 & eth1 both with
DHCP internet access.
Connect to VPN.
in a terminal:
sudo ip netns add not-vpn
# create new network namespacesudo ip link set eth1 netns not-vpn
# put eth1 in new namespacesudo ip netns exec not-vpn bash
# enter new namespace with a shelldhclient eth1
# get an DHCP IP for the moved interfacecurl icanhazip.com
# curl application will return your non-vpn public IPIn a another terminal:
curl icanhazip.com
curl application will return your VPN public IP
assuming that your VPN is configured to route all traffic through it by default.
edited Apr 13 at 13:52
answered Apr 4 at 0:34
tomodachitomodachi
9,74242343
9,74242343
I assume thateth1
is meant to be the interface i use to connect to the network, i'm using wireless, so i try to substitute it withwlp3s0
, however, i getRTNETLINK answers: Invalid argument
error.
– v010dya
Apr 5 at 4:24
If eth1 is wireless in this example iw phy phy0 set netns name not-vpn
– tomodachi
Apr 5 at 7:24
Doing that completely removed wireless from my machine making it impossible to even connect to a wireless network.
– v010dya
Apr 5 at 11:23
Let's refine the answer once we get it working. Could you try attempt to do the opposite? put enp4s0 in the name space while using wifi for VPN. Your enp4s0 needs to be connected to Internet also
– tomodachi
Apr 5 at 13:22
1
You should run dhclient enp4s0 , since that's the name of the interface you moved into the namespace
– tomodachi
Apr 13 at 13:55
|
show 1 more comment
I assume thateth1
is meant to be the interface i use to connect to the network, i'm using wireless, so i try to substitute it withwlp3s0
, however, i getRTNETLINK answers: Invalid argument
error.
– v010dya
Apr 5 at 4:24
If eth1 is wireless in this example iw phy phy0 set netns name not-vpn
– tomodachi
Apr 5 at 7:24
Doing that completely removed wireless from my machine making it impossible to even connect to a wireless network.
– v010dya
Apr 5 at 11:23
Let's refine the answer once we get it working. Could you try attempt to do the opposite? put enp4s0 in the name space while using wifi for VPN. Your enp4s0 needs to be connected to Internet also
– tomodachi
Apr 5 at 13:22
1
You should run dhclient enp4s0 , since that's the name of the interface you moved into the namespace
– tomodachi
Apr 13 at 13:55
I assume that
eth1
is meant to be the interface i use to connect to the network, i'm using wireless, so i try to substitute it with wlp3s0
, however, i get RTNETLINK answers: Invalid argument
error.– v010dya
Apr 5 at 4:24
I assume that
eth1
is meant to be the interface i use to connect to the network, i'm using wireless, so i try to substitute it with wlp3s0
, however, i get RTNETLINK answers: Invalid argument
error.– v010dya
Apr 5 at 4:24
If eth1 is wireless in this example iw phy phy0 set netns name not-vpn
– tomodachi
Apr 5 at 7:24
If eth1 is wireless in this example iw phy phy0 set netns name not-vpn
– tomodachi
Apr 5 at 7:24
Doing that completely removed wireless from my machine making it impossible to even connect to a wireless network.
– v010dya
Apr 5 at 11:23
Doing that completely removed wireless from my machine making it impossible to even connect to a wireless network.
– v010dya
Apr 5 at 11:23
Let's refine the answer once we get it working. Could you try attempt to do the opposite? put enp4s0 in the name space while using wifi for VPN. Your enp4s0 needs to be connected to Internet also
– tomodachi
Apr 5 at 13:22
Let's refine the answer once we get it working. Could you try attempt to do the opposite? put enp4s0 in the name space while using wifi for VPN. Your enp4s0 needs to be connected to Internet also
– tomodachi
Apr 5 at 13:22
1
1
You should run dhclient enp4s0 , since that's the name of the interface you moved into the namespace
– tomodachi
Apr 13 at 13:55
You should run dhclient enp4s0 , since that's the name of the interface you moved into the namespace
– tomodachi
Apr 13 at 13:55
|
show 1 more comment
You can add a route for those two applications so they directly connect to the IP address you want (with wireless card as an interface and your router as a Gateway) and all other traffics go through VPN (add a default route the interface is set to your vpn interface that is shown in ifconfig
and set your Gateway to your router and remove the previous one
You can simply add a new route with this instruction
PS: After you turn off your VPN because of your new default route you can't access to the internet so your VPN should always be on or you have to write the previous default route that you removed before
In those instructions i see how to add routes, but i do not understand how it is relating to make them application specific.
– v010dya
Apr 7 at 17:27
you have to find out which ip address or addresses those two applications connect , for doing this you can simply run wireshark or tcpdump and when you are running those applications look at destination address and when you find out you can add a new route to that network or specefic host and tell your system when the destination address is these , send data from your wireless card and your router ip address as a Gateway @v010dya
– Afshin
Apr 8 at 5:20
For testing it , first remove the default route in your routing table and just add routes to destination of those two application , if you are doing in the right way , you should just be able to connect to those applications and nothing else like google etc @v010dya
– Afshin
Apr 8 at 5:23
The IP addresses that those applications connect to will change all the time. So i guess this approach does not suit me.
– v010dya
Apr 8 at 5:45
As far as I know it can't have changeable IP address , they just have multi IP address for redundancy purpose and etc , so you can find all of IP addresses of a specific applications by searching (if it is well known app) or asking from support team and write multiple route for an app , but if you say so ..
– Afshin
Apr 8 at 14:22
|
show 1 more comment
You can add a route for those two applications so they directly connect to the IP address you want (with wireless card as an interface and your router as a Gateway) and all other traffics go through VPN (add a default route the interface is set to your vpn interface that is shown in ifconfig
and set your Gateway to your router and remove the previous one
You can simply add a new route with this instruction
PS: After you turn off your VPN because of your new default route you can't access to the internet so your VPN should always be on or you have to write the previous default route that you removed before
In those instructions i see how to add routes, but i do not understand how it is relating to make them application specific.
– v010dya
Apr 7 at 17:27
you have to find out which ip address or addresses those two applications connect , for doing this you can simply run wireshark or tcpdump and when you are running those applications look at destination address and when you find out you can add a new route to that network or specefic host and tell your system when the destination address is these , send data from your wireless card and your router ip address as a Gateway @v010dya
– Afshin
Apr 8 at 5:20
For testing it , first remove the default route in your routing table and just add routes to destination of those two application , if you are doing in the right way , you should just be able to connect to those applications and nothing else like google etc @v010dya
– Afshin
Apr 8 at 5:23
The IP addresses that those applications connect to will change all the time. So i guess this approach does not suit me.
– v010dya
Apr 8 at 5:45
As far as I know it can't have changeable IP address , they just have multi IP address for redundancy purpose and etc , so you can find all of IP addresses of a specific applications by searching (if it is well known app) or asking from support team and write multiple route for an app , but if you say so ..
– Afshin
Apr 8 at 14:22
|
show 1 more comment
You can add a route for those two applications so they directly connect to the IP address you want (with wireless card as an interface and your router as a Gateway) and all other traffics go through VPN (add a default route the interface is set to your vpn interface that is shown in ifconfig
and set your Gateway to your router and remove the previous one
You can simply add a new route with this instruction
PS: After you turn off your VPN because of your new default route you can't access to the internet so your VPN should always be on or you have to write the previous default route that you removed before
You can add a route for those two applications so they directly connect to the IP address you want (with wireless card as an interface and your router as a Gateway) and all other traffics go through VPN (add a default route the interface is set to your vpn interface that is shown in ifconfig
and set your Gateway to your router and remove the previous one
You can simply add a new route with this instruction
PS: After you turn off your VPN because of your new default route you can't access to the internet so your VPN should always be on or you have to write the previous default route that you removed before
answered Apr 7 at 14:14
AfshinAfshin
11510
11510
In those instructions i see how to add routes, but i do not understand how it is relating to make them application specific.
– v010dya
Apr 7 at 17:27
you have to find out which ip address or addresses those two applications connect , for doing this you can simply run wireshark or tcpdump and when you are running those applications look at destination address and when you find out you can add a new route to that network or specefic host and tell your system when the destination address is these , send data from your wireless card and your router ip address as a Gateway @v010dya
– Afshin
Apr 8 at 5:20
For testing it , first remove the default route in your routing table and just add routes to destination of those two application , if you are doing in the right way , you should just be able to connect to those applications and nothing else like google etc @v010dya
– Afshin
Apr 8 at 5:23
The IP addresses that those applications connect to will change all the time. So i guess this approach does not suit me.
– v010dya
Apr 8 at 5:45
As far as I know it can't have changeable IP address , they just have multi IP address for redundancy purpose and etc , so you can find all of IP addresses of a specific applications by searching (if it is well known app) or asking from support team and write multiple route for an app , but if you say so ..
– Afshin
Apr 8 at 14:22
|
show 1 more comment
In those instructions i see how to add routes, but i do not understand how it is relating to make them application specific.
– v010dya
Apr 7 at 17:27
you have to find out which ip address or addresses those two applications connect , for doing this you can simply run wireshark or tcpdump and when you are running those applications look at destination address and when you find out you can add a new route to that network or specefic host and tell your system when the destination address is these , send data from your wireless card and your router ip address as a Gateway @v010dya
– Afshin
Apr 8 at 5:20
For testing it , first remove the default route in your routing table and just add routes to destination of those two application , if you are doing in the right way , you should just be able to connect to those applications and nothing else like google etc @v010dya
– Afshin
Apr 8 at 5:23
The IP addresses that those applications connect to will change all the time. So i guess this approach does not suit me.
– v010dya
Apr 8 at 5:45
As far as I know it can't have changeable IP address , they just have multi IP address for redundancy purpose and etc , so you can find all of IP addresses of a specific applications by searching (if it is well known app) or asking from support team and write multiple route for an app , but if you say so ..
– Afshin
Apr 8 at 14:22
In those instructions i see how to add routes, but i do not understand how it is relating to make them application specific.
– v010dya
Apr 7 at 17:27
In those instructions i see how to add routes, but i do not understand how it is relating to make them application specific.
– v010dya
Apr 7 at 17:27
you have to find out which ip address or addresses those two applications connect , for doing this you can simply run wireshark or tcpdump and when you are running those applications look at destination address and when you find out you can add a new route to that network or specefic host and tell your system when the destination address is these , send data from your wireless card and your router ip address as a Gateway @v010dya
– Afshin
Apr 8 at 5:20
you have to find out which ip address or addresses those two applications connect , for doing this you can simply run wireshark or tcpdump and when you are running those applications look at destination address and when you find out you can add a new route to that network or specefic host and tell your system when the destination address is these , send data from your wireless card and your router ip address as a Gateway @v010dya
– Afshin
Apr 8 at 5:20
For testing it , first remove the default route in your routing table and just add routes to destination of those two application , if you are doing in the right way , you should just be able to connect to those applications and nothing else like google etc @v010dya
– Afshin
Apr 8 at 5:23
For testing it , first remove the default route in your routing table and just add routes to destination of those two application , if you are doing in the right way , you should just be able to connect to those applications and nothing else like google etc @v010dya
– Afshin
Apr 8 at 5:23
The IP addresses that those applications connect to will change all the time. So i guess this approach does not suit me.
– v010dya
Apr 8 at 5:45
The IP addresses that those applications connect to will change all the time. So i guess this approach does not suit me.
– v010dya
Apr 8 at 5:45
As far as I know it can't have changeable IP address , they just have multi IP address for redundancy purpose and etc , so you can find all of IP addresses of a specific applications by searching (if it is well known app) or asking from support team and write multiple route for an app , but if you say so ..
– Afshin
Apr 8 at 14:22
As far as I know it can't have changeable IP address , they just have multi IP address for redundancy purpose and etc , so you can find all of IP addresses of a specific applications by searching (if it is well known app) or asking from support team and write multiple route for an app , but if you say so ..
– Afshin
Apr 8 at 14:22
|
show 1 more comment
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1130068%2fis-it-possible-to-stop-using-vpn-on-some-application%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Split Tunneling is covered by most VPN Providers.
– EODCraft Staff
Mar 31 at 10:59
@EODCraftStaff I do not want split tunneling, i wish to have an application that doesn't tunnel through the VPN interface at all.
– v010dya
Apr 7 at 4:52