Unable to connect to Vagrant private network from host - networking

I have a vagrant virtual box up and running. So far I have been unable to connect to the web server. here is the start up:
[jesse#Athens VVV-1.1]$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.2.0
default: VirtualBox Version: 4.3
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /home/jesse/vagrant/vvvStable/VVV-1.1
default: /srv/www => /home/jesse/vagrant/vvvStable/VVV-1.1/www
default: /srv/config => /home/jesse/vagrant/vvvStable/VVV-1.1/config
default: /srv/database => /home/jesse/vagrant/vvvStable/VVV-1.1/database
default: /var/lib/mysql => /home/jesse/vagrant/vvvStable/VVV-1.1/database/data
==> default: VM already provisioned. Run `vagrant provision` or use `--provision` to force it
==> default: Checking for host entries
on my host console, ip addr show yields:
4: vboxnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
5: vboxnet1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 0a:00:27:00:00:01 brd ff:ff:ff:ff:ff:ff
on the guest it yields:
vagrant#vvv:~$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:12:96:98 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
inet6 fe80::a00:27ff:fe12:9698/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:2c:d4:3e brd ff:ff:ff:ff:ff:ff
inet 192.168.50.4/24 brd 192.168.50.255 scope global eth1
For now, all I want to do is access the web server on the virtual machine, whatever way works. I have tried a variety of things, just shooting in the dark. I would be happy to provide any specific info. Any help or suggestions would be greatly appreciated

Based on the output provided, the box has 2 network interfaces, 1 is the default NAT and the other private - ask you said.
The reason why you are not able to access the web site hosted within the VM thru the private interface: it could be that host eth0 or wlan0 IP address is not in the same network as the private interface -> 192.168.50.4/24 and there is no route.
To access the the site hosted by the web server within the guest, you have the following options:
1. NAT port forwarding
Forward the web port, e.g. 80 to host's 8080 (you can't use 80 because it is a privileged port on *NIX). Add the following
Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 80, host: 8080,
auto_correct: true
end
NOTE: auto_correct will resolve port conflicts if the port on host is already in use.
DO a vagrant reload and you'll be able to access the site via http://localhost:8080/
2. Public Network (VirtualBox Bridged networking)
Add a public network interface
Vagrant.configure("2") do |config|
config.vm.network "public_network"
end
Get the IP of VM after it is up and running, port forwarding does NOT apply to bridged networking. So you'll be accessing the site by using http://IP_ADDR, if within the VM it binds to 80, otherwise specify the port.

One more possibility just for future reference.
Normally when you create VMs using private networking, Vagrant (Virtualbox? not sure) creates corresponding entries in the host's routing table. You can see these using
netstat -rn
Somehow my host had gotten into a state where creating the VMs did not result in new routes appearing in the routing table, with the corresponding inability to connect. Again you can see the routes not appearing using the command above.
Creating the route manually allowed me to reach the VMs. For example:
sudo route -nv add -net 10.0.4 -interface vboxnet
(Substitute the appropriate network and interface.) But I didn't want to have to do that.
Based on this question, I tried restarting my host and Vagrant started automatically creating the routing table entries again.
Not sure exactly what the issue was, but hopefully this helps somebody.

Your interface is down
I had the same issue. It was my vboxnet0 interface who was down. Within the listing of ip addr you have <BROADCAST,MULTICAST> for your interface but it should be <BROADCAST,MULTICAST,UP,LOWER_UP>.
That's mean you interface is down.
You can confirm with sudo ifconfig. The interface will not be shown but if you add -a you will see it : sudo ifconfig -a.
how to bring it up
So to bring it up you can do :
sudo ifconfig vbox
OR
sudo ip link set vboxnet0 up
Both works.

Alternatively, you could use manual port forwarding via SSH (SSH tunneling):
ssh -L 80:127.0.0.1:80 vagrant#127.0.0.1 -p 2222
That binds host port 80 to VM port 80 via your SSH session to the VM.

I ended up getting the private network to work as well by deleting it within Virtual Box. When I recreated it again with vagrant up, the ip config became:
vboxnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
inet 192.168.50.1/24 brd 192.168.50.255 scope global vboxnet0
valid_lft forever preferred_lft forever

I had a similar issue on my Mac. VirtualBox uses host only for private networks. To use as an internal network I had to add this to the private network configuration:
"virtualbox__intnet: true"

This may not apply exactly, but "private network" in the title brought me here and others may benefit that are trying to run multiple guest boxes on Mac OS X:
I use "private_network" and don't do any port forwarding. I.e. I access my VMs by hosts like "project1.local", "project2.local".
So, I was surprised when I tried to launch a second box (a scotch/box ubuntu for LAMP) and it refused to launch with an error (excerpt):
"...The forwarded port to 2222 is already in use on the host machine..."
The error message's proposed solution doesn't work. I.e. add this to your Vagrantfile:
config.vm.network :forwarded_port, guest: 22, host: 1234
#Where 1234 would be a different port.
I am not sure why it happens because I've run multiples before (but not scotch/box). The problem is that even if you use private_network, Vagrant uses port forwarding for SSH.
The solution is to set ports SPECIFICALLY FOR SSH by adding this to your Vagrant files:
# Specify SSH config explicitly with unique host port for each box
config.vm.network :forwarded_port,
guest: 22,
host: 1234,
id: "ssh",
auto_correct: true
Note: auto_correct may make non-unique port #s work, but I haven't tested that.
Now, you can run multiple VMs at the same time using private networking.
(Thanks to Aaron Aaron and his posting here: https://groups.google.com/forum/#!topic/vagrant-up/HwqFegoCXOc)

Was having the same issue with Arch (2017-01-01). Had to install net-tools: sudo pacman -S net-tools
Virtual Box 5.1.12r112440, Vagrant 1.9.1.

You have set a private network in for your vagrant machine
If that ip is not visible then ssh to your vagrant machine and fire this command
sudo /etc/init.d/networking restart
Check to stop your firewall and iptables too

Related

How to Create a virtual network interface and connect it to a bridge

I am trying to create a network of virtal qemu machines and the host using a bridge on Arch Linux to test a distributed program I wrote. I have found many howtos on using the physical NIC of the host on the bridge to connect to the VMs. This works fine. However, I don't want the VMs to be visible to the outside network but rather create a virtual interface on the host to connect to the VMs. This is what I have tried so far after creating the bridge and starting the VMs on it:
ip tuntap add tap2 mode tap
ip link set tap2 up
ip addr add dev tap2 10.10.10.2/24
ip link set tap2 master br0
Since I can't reach the VMs from the host I must be missing something.
ip link output is:
➜ ~ ip link
[...]
7: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether e6:69:29:67:cb:41 brd ff:ff:ff:ff:ff:ff
10: tap2: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel master br0 state DOWN mode DEFAULT group default qlen 1000
link/ether e6:69:29:67:cb:41 brd ff:ff:ff:ff:ff:ff
Also, the route is shown to be down:
➜ ~ ip route
[...]
10.10.10.0/24 dev tap2 proto kernel scope link src 10.10.10.2 linkdown
Does anyone know what I am missing?
Setting up another virtual interface is not necessary since one can assign an IP to the bridge:
ip addr add dev br0 <ip>
This can then be used to communicate with the other devices on the bridge if these have IPs in the same subnet

Configure kvm (libvirt) routed network on Ubuntu 16.04 host

I have an Ubuntu 16.04 KVM hypervisor behind a Debian-based firewall, and I'm trying to make the guest VMs IP-reachable, preferably matching the subnet I'm using for that collection of machines.
The firewall is hosting a 10.4.0.0/16 network, and successfully NAT'ing and accepting applicable traffic.
The hypervisor is at 10.4.20.250, with the virsh network configuration shown below. Of note, I've extended the netmask to try separating the clients from the host:
<network>
<name>default</name>
<uuid>02b5de1a-cde4-45dd-b8f5-a9fdfa1c6809</uuid>
<forward mode='route'/>
<bridge name='virbr0' stp='on' delay='0'/>
<mac address='52:54:00:a3:f0:e9'/>
<ip address='10.4.20.20' netmask='255.255.255.128'>
</ip>
</network>
The hypervisor (10.4.20.250) also has the following:
# ip r
default via 10.4.0.1 dev enp0s25 onlink
10.4.0.0/16 dev enp0s25 proto kernel scope link src 10.4.20.250
10.4.20.0/25 dev virbr0 proto kernel scope link src 10.4.20.20
169.254.0.0/16 dev enp0s25 scope link metric 1000
# brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.fe54009e64d0 yes vnet0
# ip link show virbr0
3: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether fe:54:00:9e:64:d0 brd ff:ff:ff:ff:ff:ff
# virsh domiflist myguest
Interface Type Source Model MAC
-------------------------------------------------------
vnet0 bridge virbr0 virtio 52:54:00:9e:64:d0
The guest ("myguest") at 10.4.20.25 is able to reach the internet at large; it's configured with:
ip r
default via 10.4.20.20 dev eth0
10.4.0.0/17 dev eth0 proto kernel scope link src 10.4.20.25
From a terminal session connected to the hypervisor (10.4.20.250), I can ping itself, the bridge at 10.4.20.20, the guest at 10.4.20.25, the firewall at 10.4.0.1, and the internet at large.
From the firewall (10.4.0.1) I can ping the hypervisor (10.4.20.250) and the bridge (10.4.20.20) .. but pings to the client (10.4.20.25) are lost. Similarly, from another machine on the 10.4 network, I can ping the firewall, the hypervisor, and the bridge, but not the client. I have the following rules set:
ip r
default via 10.4.0.1 dev enp4s0 onlink
10.4.0.0/16 dev enp4s0 proto kernel scope link src 10.4.2.1
10.4.20.0/25 via 10.4.20.20 dev enp4s0
192.168.15.0/24 dev enp1s0 proto kernel scope link src 192.168.15.242
Any help what configuration I might be missing to make my client be reachable from remote devices?
Note, I have tried to set the forward mode as 'open' but virsh net-edit gives me the following error:
error: unsupported configuration: unknown forwarding type 'open'

Vagrant can't start after changing network

I used vagrant to install KVM followed this guide:
https://www.cyberciti.biz/faq/installing-kvm-on-ubuntu-16-04-lts-server/
Here changed the bridged networking:
Step 3: Configure bridged networking
$ sudo cp /etc/network/interfaces /etc/network/interfaces.bakup-1-july-2016
$ sudo vi /etc/network/interfaces
auto br1
iface br0 inet static
address 10.18.44.26
netmask 255.255.255.192
broadcast 10.18.44.63
dns-nameservers 10.0.80.11 10.0.80.12
# set static route for LAN
post-up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.18.44.1
post-up route add -net 161.26.0.0 netmask 255.255.0.0 gw 10.18.44.1
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0
# br1 setup with static wan IPv4 with ISP router as a default gateway
auto br1
iface br1 inet static
address 208.43.222.51
netmask 255.255.255.248
broadcast 208.43.222.55
gateway 208.43.222.49
bridge_ports eth1
bridge_stp off
bridge_fd 0
bridge_maxwait 0
$ sudo systemctl restart networking
When I restart vagrant, it always stop here:
$ vagrant up
==> default: Attempting graceful shutdown of VM...
default: Guest communication could not be established! This is usually because
default: SSH is not running, the authentication information was changed,
default: or some other networking issue. Vagrant will force halt, if
default: capable.
==> default: Forcing shutdown of VM...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
How can fix it?
If you're using vagrant, you dont need to make those modification, you can just change in your Vagrantfile the network configuration (see Public Networks) and make the change
Vagrant.configure("2") do |config|
...
config.vm.network "public_network"
...
end
vagrant will take care to update the right configuration file

VMs are not getting static IP from Vagrantfile

I'm beginner in networking stuff and also I'm just starting with VMs.
I'm doing examples from "Ansible for Devops" and in chapter 3, I'm supposed to create three VMs and set a private network with static ip.
My Vagrant file looks like that:
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "geerlingguy/centos7"
config.ssh.insert_key = false
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider :virtualbox do |v|
v.memory = 256
v.linked_clone = true
end
config.vm.define "app1" do |app|
app.vm.hostname = "orc-app1.dev"
app.vm.network :private_network, ip: "192.168.60.4"
end
config.vm.define "app2" do |app|
app.vm.hostname = "orc-app2.dev"
app.vm.network :private_network, ip: "192.168.60.5"
end
config.vm.define "db" do |db|
db.vm.hostname = "orc-db.dev"
db.vm.network :private_network, ip: "192.168.60.6"
end
end
Vagrant loges:
❯ vagrant up
Bringing machine 'app1' up with 'virtualbox' provider...
Bringing machine 'app2' up with 'virtualbox' provider...
Bringing machine 'db' up with 'virtualbox' provider...
==> app1: Cloning VM...
==> app1: Matching MAC address for NAT networking...
==> app1: Checking if box 'geerlingguy/centos7' is up to date...
==> app1: Setting the name of the VM: 3_app1_1485309004899_30536
==> app1: Fixed port collision for 22 => 2222. Now on port 2202.
==> app1: Clearing any previously set network interfaces...
==> app1: Preparing network interfaces based on configuration...
app1: Adapter 1: nat
app1: Adapter 2: hostonly
==> app1: Forwarding ports...
app1: 22 (guest) => 2202 (host) (adapter 1)
==> app1: Running 'pre-boot' VM customizations...
==> app1: Booting VM...
==> app1: Waiting for machine to boot. This may take a few minutes...
app1: SSH address: 127.0.0.1:2202
app1: SSH username: vagrant
app1: SSH auth method: private key
app1: Warning: Remote connection disconnect. Retrying...
==> app1: Machine booted and ready!
==> app1: Checking for guest additions in VM...
==> app1: Setting hostname...
==> app1: Configuring and enabling network interfaces...
==> app2: Cloning VM...
==> app2: Matching MAC address for NAT networking...
==> app2: Checking if box 'geerlingguy/centos7' is up to date...
==> app2: Setting the name of the VM: 3_app2_1485309032690_32260
==> app2: Fixed port collision for 22 => 2222. Now on port 2203.
==> app2: Clearing any previously set network interfaces...
==> app2: Preparing network interfaces based on configuration...
app2: Adapter 1: nat
app2: Adapter 2: hostonly
==> app2: Forwarding ports...
app2: 22 (guest) => 2203 (host) (adapter 1)
==> app2: Running 'pre-boot' VM customizations...
==> app2: Booting VM...
==> app2: Waiting for machine to boot. This may take a few minutes...
app2: SSH address: 127.0.0.1:2203
app2: SSH username: vagrant
app2: SSH auth method: private key
app2: Warning: Remote connection disconnect. Retrying...
==> app2: Machine booted and ready!
==> app2: Checking for guest additions in VM...
==> app2: Setting hostname...
==> app2: Configuring and enabling network interfaces...
==> db: Cloning VM...
==> db: Matching MAC address for NAT networking...
==> db: Checking if box 'geerlingguy/centos7' is up to date...
==> db: Setting the name of the VM: 3_db_1485309060266_65663
==> db: Fixed port collision for 22 => 2222. Now on port 2204.
==> db: Clearing any previously set network interfaces...
==> db: Preparing network interfaces based on configuration...
db: Adapter 1: nat
db: Adapter 2: hostonly
==> db: Forwarding ports...
db: 22 (guest) => 2204 (host) (adapter 1)
==> db: Running 'pre-boot' VM customizations...
==> db: Booting VM...
==> db: Waiting for machine to boot. This may take a few minutes...
db: SSH address: 127.0.0.1:2204
db: SSH username: vagrant
db: SSH auth method: private key
db: Warning: Remote connection disconnect. Retrying...
==> db: Machine booted and ready!
==> db: Checking for guest additions in VM...
==> db: Setting hostname...
==> db: Configuring and enabling network interfaces...
And Vagrant SSH-config:
Host app1
HostName 127.0.0.1
User vagrant
Port 2202
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/mst/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
Host app2
HostName 127.0.0.1
User vagrant
Port 2203
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/mst/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
Host db
HostName 127.0.0.1
User vagrant
Port 2204
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/mst/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
So as You can see the machines didn't get those static ips I set for them and I can't connect to them using it. They just got a localhost IP and some high ports. In that example, I should work on that machines using ansible and use that static ips in the inventory file, so they should have it set correctly.
Any ideas?
macOS Sierra
Vagrant 1.9.1
VirtualBox 5.1.14
Thanks
EDIT: The machines are using CentOS and ip addr output is:
[root#orc-app1 vagrant]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:dd:23:fa brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
valid_lft 86067sec preferred_lft 86067sec
inet6 fe80::a00:27ff:fedd:23fa/64 scope link
valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 08:00:27:4d:38:fc brd ff:ff:ff:ff:ff:ff
Try with vagrant 1.9.0 . My co worker had an issue with it that nfs shares would not mount corectly if 1.9.1 and it related to the fact that the box didn't add one necessary interface automatically.
Downgrading to 1.9.0 fixed this.
There are couple of open issues on the vagrants github and they relate to rhel/centos 7 specifically.
This is one of them https://github.com/mitchellh/vagrant/issues/8138
I reviewed based on the example - the file for the network interface has been correctly created by vagrant
[vagrant#orc-app2 ~]$ cd /etc/sysconfig/network-scripts
[vagrant#orc-app2 network-scripts]$ ll
total 236
-rw-r--r--. 1 root root 353 25 janv. 16:06 ifcfg-enp0s3
-rw-------. 1 vagrant vagrant 214 25 janv. 16:06 ifcfg-enp0s8
and the content for this new network interface is correct
[vagrant#orc-app2 network-scripts]$ more ifcfg-enp0s8
#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
NM_CONTROLLED=no
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.60.5
NETMASK=255.255.255.0
DEVICE=enp0s8
PEERDNS=no
#VAGRANT-END
so I just restarted the network services to try
[vagrant#orc-app2 network-scripts]$ sudo systemctl restart network
and it was ok
[vagrant#orc-app2 network-scripts]$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:dd:23:fa brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
valid_lft 86391sec preferred_lft 86391sec
inet6 fe80::a00:27ff:fedd:23fa/64 scope link
valid_lft forever preferred_lft forever
3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:42:83:e9 brd ff:ff:ff:ff:ff:ff
inet 192.168.60.5/24 brd 192.168.60.255 scope global enp0s8
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe42:83e9/64 scope link
valid_lft forever preferred_lft forever
I dont have another centos7 box to test (still working nicely with 6) to confirm its an issue with this box or with the new centos

Not able to connect to Vagrant private network from host on VPN (CISCO AnyConnect)

On VPN connection ( to another location of my office ), my vagrant box is not reachable via browser. Its working fine in my office location.
here is vagrant reload:
==> default: Attempting graceful shutdown of VM...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.3.10
default: VirtualBox Version: 5.0
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => /Users/sachinkushwaha/Workspace/vagrant-quikr
default: /home/axle => /Users/sachinkushwaha/Workspace/quikraxledashboard
default: /home/data => /Users/sachinkushwaha/Workspace/quikr_prod/QuikrBaseCode
default: /home/vhosts => /Users/sachinkushwaha/Workspace/vhosts
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
I tried to connected many times .
Ip addr show on vagrant:
vagrant#vagrant-ubuntu-trusty-64:~$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:3e:96:5b brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe3e:965b/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:d7:25:82 brd ff:ff:ff:ff:ff:ff
inet 192.168.33.10/16 brd 192.168.255.255 scope global eth1
I wanted to access the web server on my machine.
I also tried NAT port forwarding :
Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 80, host: 8080,
auto_correct: true
end
It doesn't work for me .
This is a workaround--not a fix. After you power on your laptop/workstation, but before starting Cisco AnyConnect, start your vm (i.e., vagrant up). Make sure you can connect to an app in the vm via the browser. Then start AnyConnect.
As long as you start your vm before AnyConnect, you should be able to "vagrant up" and "vagrant [whatever]" the vm as often as needed without rebooting. You'll need to repeat that process every time you power on your laptop/workstation. At least that works for us. Good luck!
I'm a bit confused about the network setup and what you are trying to achieve. If the vagrant Guest is on your local machine, you can access it by simply typing http://localhost:8080 in your browser and the VPN shouldn't really matter.
If the vagrant Guest is on another machine on another network, which you are VPN to traverse, then as long as the VPN connection on your local machine is up you should be able to access it by appending :8080 to the IP of the box. From the code you posted, that could be either http://10.0.2.15:8080 or http://192.168.33.10:8080.
If I have misunderstood the question, please comment with additional information!

Resources