OpenVPN and Network Namespaces

This forum is for general conversation and user-user networking.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
fullbring3r
OpenVpn Newbie
Posts: 6
Joined: Wed Mar 23, 2016 2:55 pm

OpenVPN and Network Namespaces

Post by fullbring3r » Thu Oct 26, 2017 1:57 pm

Hello, I need some help with configuring openvpn connection inside a network namespace.
I've got my VM running on Ubuntu Server 16.04, got a few namespaces with openvpn in it, connected to my openvpn servers in datacenter.
What I want is to setup additional netns with Windscribe openvpn in it. My trouble is that I can't control which IP adress I will get from windscribe openvpn server, so I can't create script for it, like I did with my servers from which I get the same IPs every time.
Is there a way to automaticly get ip and gateway from the server after I move openvpn tun interface inside netns?

TinCanTech
OpenVPN Protagonist
Posts: 11137
Joined: Fri Jun 03, 2016 1:17 pm

Re: OpenVPN and Network Namespaces

Post by TinCanTech » Thu Oct 26, 2017 3:33 pm

fullbring3r wrote:
Thu Oct 26, 2017 1:57 pm
Is there a way to automaticly get ip and gateway from the server after I move openvpn tun interface inside netns?
Which IP and gateway ?

fullbring3r
OpenVpn Newbie
Posts: 6
Joined: Wed Mar 23, 2016 2:55 pm

Re: OpenVPN and Network Namespaces

Post by fullbring3r » Thu Oct 26, 2017 6:39 pm

I've got this when I connect to windscibe server normally -

Code: Select all

tun20     Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10.110.222.57  P-t-P:10.110.222.57  Mask:255.255.254.0
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:204 (204.0 B)  TX bytes:1137 (1.1 KB)
And this after I link tun20 to netns.

Code: Select all

tun20     Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:11155 errors:0 dropped:3 overruns:0 frame:0
          TX packets:12139 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:2497117 (2.4 MB)  TX bytes:1450358 (1.4 MB)

Usually I assign ip and gateway manually for tun interface since I know that it would remain the same, but I can't to it with windscribe vpn.

My netns script for connection to my vpn servers -

Code: Select all

ip netns add ns1
ip link add vns1a type veth peer name vns1b
ip link set vns1b netns ns1
ip netns exec ns1 ifconfig vns1b 10.1.1.1/24 up
ifconfig vns1a 10.1.1.2/24 up
ip link set tun10 netns ns1
ip netns exec ns1 ip link set tun10 up
ip netns exec ns1 ip addr add 10.11.0.6/24 dev tun10
ip netns exec ns1 ip route add default via 10.11.0.5

Post Reply