Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Setup:

A box running OpenVPN server and few Vagrant virtual machines

Problem:

I would like to access Vagrant boxes directly from VPN clients as regular machines, and not on only few forwarded ports.

Configuration:

OpenVPN has interface tun0:

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
          inet addr:10.69.69.1  P-t-P:10.69.69.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:110348 errors:0 dropped:0 overruns:0 frame:0
          TX packets:89923 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:18322866 (18.3 MB)  TX bytes:16651955 (16.6 MB)

Vagrant is configured with public_networks with specific ip:

config.vm.network "public_network", :bridge => "tun0", ip:"10.69.69.101", :auto_config => "false", :netmask => "255.255.255.0"

But it does not work, i guess because i cannot bridge Vagrant to OpenVpn interface?. From the logs:

DEBUG network: Normalized configuration: {:auto_config=>"false", :bridge=>"tun0", :mac=>nil, :nic_type=>nil, :use_dhcp_assigned_default_route=>false, :ip=>"10.69.69.101", :netmask=>"255.255.255.0", :protocol=>"tcp", :id=>"9d8e9f11-8e10-442d-92a3-7c463e14cf24", :adapter=>2}
 INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "list", "bridgedifs"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: Name:            eth0
GUID:            30687465-0000-4000-8000-d43d7ee2ff6e
DHCP:            Disabled
IPAddress:       XXX.XXX.XXX.XXX
NetworkMask:     255.255.255.224
IPV6Address:     2a01:04f8:0200:6152:0000:0000:0000:0002
IPV6NetworkMaskPrefixLength: 64
HardwareAddress: d4:3d:7e:e2:ff:6e
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-eth0

DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
DEBUG network: Bridge was directly specified in config, searching for: tun0
 INFO interface: info: Specific bridge 'tun0' not found. You may be asked to specify
which network to bridge to.
[default] Specific bridge 'tun0' not found. You may be asked to specify
which network to bridge to.
DEBUG network: Only one bridged interface available. Using it by default.
 INFO network: Bridging adapter 2 to eth0
DEBUG network: Adapter configuration: {:adapter=>2, :type=>:bridged, :bridge=>"eth0", :mac_address=>nil, :nic_type=>nil}

Should i somehow bridge tun0 via Virtualbox? Or is this not doable? I've tried doing it something like this:

v.customize ["modifyvm", :id, "--nic1", "bridged", "--bridgeadapter1", "tun0"]

Should i create a virtual interface eth1 (i cannot use bridge0 as it is a public ip), and bridge to it Vagrant, and then create routing rules for OpenVPN server?

share|improve this question

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.