1

Is it possible to assign different ip numbers to different openvpn interfaces on server (Like in PPTPD):

Server PC i-face-s:
tun0: inet 10.8.1.1 peer 10.8.2.1
tun1: inet 10.8.1.2 peer 10.8.2.2

Client 1 PC i-face-s:
tun_client1 inet 10.8.2.1 peer 10.8.1.1

Client 2 PC i-face-s:
tun_client2 inet 10.8.2.2 peer 10.8.1.2

I tried this: /etc/openvpn/server.conf:

dev tun
topology p2p
server 10.8.0.0 255.255.255.0
route 10.8.1.0 255.255.255.0
route 10.8.2.0 255.255.255.0
ifconfig-pool-persist ipp.txt 0
client-config-dir ccd

/etc/openvpn/ccd/client1

ifconfig-push 10.8.2.1 10.8.1.1

And on client all works:

19: tun_client1: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1300 qdisc fq_codel state UNKNOWN group default qlen 100
    link/none
    inet 10.8.2.1 peer 10.8.1.1/32 scope global tun_client1
       valid_lft forever preferred_lft forever

But on server ip addresses not valid and ping to 10.8.2.1 dont works:

1150: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 100
    link/[65534]
    inet 10.8.0.1 peer 10.8.0.2/32 scope global tun0
ErikE
  • 4,676
  • 1
  • 19
  • 25
Ivan Borshchov
  • 133
  • 1
  • 10
  • I guess the only solution would be to run multiple OpenVPN instances on the server. But maybe you should explain what problem you are trying to solve. – Oliver Aug 07 '15 at 10:08
  • the problem is in that there are no ping from server to 10.8.2.1, and can't ping 10.8.1.1 from client, I guess the reason is uncorrect ip's on servers tun0 interface, it should corespond to client ip's. – Ivan Borshchov Aug 07 '15 at 10:11
  • Yes, but what's the reason you want multiple tun interfaces on the server? OpenVPN is not PPTP. – Oliver Aug 07 '15 at 10:14
  • I want to allow 2 connections from one client to one server in general, if use subnet topology , there is issue when 2 routes with same network exists via different i-face-s – Ivan Borshchov Aug 07 '15 at 11:10

1 Answers1

1

Solved using 2 instances of openvpn and subnet topology. It was enough copy server.conf to server1.conf, change port and server's ip range and also rename some files which clashes with server.conf (logs etc). When service restarts it automatically creates instance of openvpn for each config.

Ivan Borshchov
  • 133
  • 1
  • 10