build立:
一个运行OpenVPN服务器和几个Vagrant虚拟机的盒子
问题:
我想作为普通机器直接从VPN客户端访问Vagrant盒,而不是只有很less的转发端口。
组态:
OpenVPN的接口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 PtP: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)
Vagrantconfiguration与public_networks与特定的ip:
config.vm.network "public_network", :bridge => "tun0", ip:"10.69.69.101", :auto_config => "false", :netmask => "255.255.255.0"
但是这不起作用,我猜是因为我无法将Vagrant桥接到OpenVpn接口? 从日志中:
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}
我应该以某种方式桥接tun0通过Virtualbox? 或者这是不可行的? 我试过这样做:
v.customize ["modifyvm", :id, "--nic1", "bridged", "--bridgeadapter1", "tun0"]
我应该创build一个虚拟接口eth1(我不能使用bridge0,因为它是一个公共ip),并桥接它的stream浪,然后创buildOpenVPN服务器的路由规则?