Vagrant with xdebug can't connect to host - virtualbox

My vagrant setup for the network is config.vm.network :private_network, ip: "192.168.56.101". If I'm accessing a php page with echo $_SERVER['REMOTE_ADDR']; I got 192.168.56.1 as result. The problem now is that I can't ping 192.168.56.1, so also the config for Xdebug with xdebug.remote_connect_back=1 will fail, because Xdebug tries to connect to 192.168.56.1. If I use my normal ip address with xdebug.remote_host=X.X.X.X everything works fine, but I want to use xdebug.remote_connect_back=1. What can I do that it will work?

I was having the same problem and then started up a Virtualbox manually and realized that I hadn't started a virtualbox since updating and the firewall had to updated. Once I restarted virtualbox I could ping 192.168.56.1 and not have to rely on a hard coded ip address. So, my guess, is that you probably have firewall issues.

Related

Cannot reach react application via dns hosted on ec2

I just want to see my development working on an EC2, showing to some friends, and think in deploying it after all of the work is done, but react doesn't cooperate. :/
I did everything I always do.
Started a ubuntu server on EC2
applied a group with 3000/tcp opened in my instance
Installed all dependencies of my app, npm 11.1 and its packages via npm install.
npm started it
and...
Nope.. there is no "and"... just my tears over a bunch of attempts without reaching 3000/tcp via public ip and dns..
I even tested ping on it.. set ICMP echo request and response rules, tested and it worked, but when I try to reach the application by 3000/tcp port, nothing.
Does someone have any idea?
As an image talk more than a thousand words, there it is... My nighmare
PS: a curl on localhost:3000 inside the ec2 works just fine.. while
another curl outside the ec2 returns Connection Refused
Looks like the application is bound to localhost (127.0.0.1). Update your start property to include --host 0.0.0.0
Refer: https://github.com/webpack/webpack-dev-server/issues/147

Not able to connect remote floodlight controller to mininet

I am new to mininet and I was trying to build a mininet topology which uses a remote SDN controller.
I tried using floodlight as the remote controller. I installed it and ran it and it is running on "localhost:6653". But it is also running on 192.168.122.1:6653 (And I have no idea why).
192.168.122.1 is my virbr0 interface's address. In my mininet VM which is in virtualbox i have two network adapters.
NAT
Host only adapter
And for host only adapter i have the following configuration.
Adapter settings:
Ipv4 address: 192.168.56.1 and net mask: 255.255.255.0
DHCP server settings: Sever ip= 192.168.56.100; net mask= 255.255.255.0; Lower bound Ip: 192.168.56.101; Upper bound Ip: 192.168.56.254
To avoid confusion i have added the screenshots as well.
I tried the following command to build my topology:
sudo mn --controller=remote,ip=192.168.122.1,port=6653
I get the following response from mininet
Unable to contact remote controller 192.168.122.1:6653
I have tried changing ip to 192.168.56.1 but that also didn't work.
Any kind of help will be appreciated.
Thanks.
As per your setup, I guess FLC is running on Host OS and mininet is running in Oracle VM.
Your Host-Only network is useful if you are trying to reach something deployed in VM from your Host Os.
It will not work other way around. Here you want to access FLC running on Host inside your VM.
I would suggest using Floodlight VM for Virtual Box. It has mininet and FLC inbuild.
Once imported. Start VM.
Credentials: floodlight/floodlight
Inside VM start FLC
Do ifconfig ithe n terminal and get IP
change to that IP in this
sudo mn --controller=remote,ip=192.168.122.1,port=6653
and execute, all will work fine.
You can access FLC in Host using above IP

Local Server not loading in Ubuntu VirtualBox

I have laravel app which is running in my windows local server. This laravel app is running port:80. I want to load this app in my Ubuntu VirtualBox.
My IP Config:
IPv4 Address : 192.168.8.157
Subnet Mask : 255.255.255.0
Default Gateway: 192.168.8.1
I have config my virtualbox as Bridged Adapter. In my /etc/hosts (ubuntu virtualbox), I have this :
127.0.0.1 localhost
127.0.1.1 asus
192.168.8.157 v2.my.local
I have made a hello word app (node.js) in my local windows which is running on port :3000, and it is running in my VirtualBox by typing v2.my.local:3000, but if I type v2.my.local on my VirtualBox, it is not working (although app is running on windows local machine). it says:
This v2.my.local page can’t be found
Any suggestion? Thanks in Advance.
May be windows firewall blocking connections via port 80. turn off firewall and try it, if it works. Start windows firewall and add firewall rule to allow connections via port 80. If your windows version is 10 then, it will block all virtual box related connections. make sure to add correct rules.

Access django server on virtual Machine

I know there is a lot of similar question but I haven't be able to make it work.
I have a VM (VirtualBox) running CentOS 7
I set up 2 adapters, a NAT and a host-only adapter. This way I have internet output on the VM and I can enter via ssh using a ip (192.168.56.102) from the host
Now, I'm trying to reach a django server running on the guest from the host
I've tried running at 0.0.0.0:8000 and 192.168.56.102:8000 but I always got
$ curl 192.168.56.2:8000
curl: (7) Failed connect to 192.168.56.2:8000; No route to host
I've read some solutions using a bridge instead of NAT, but I need to keep the output to internet and the access via ssh
Finally I opened the port 8000 on the guest firewall and its working now.
For CentOS 7, i followed those steps centos 7 - open firewall port
firewall-cmd --zone=public --add-port=8000/tcp --permanent
firewall-cmd --reload

Getting acces to host VM in a VirtualBox with Puppet

I have an application running in a VirtualBox VM that for testing purposes needs to connect to the host machine. The VM is started with Vagrant and managed by Puppet.
What is the best way to set-up this connection? For example, om my host machine the app runs on port 9200. So from my VM I'd like to go to myhostmachine:9200.
Currently I'm thinking of hacking in a small command that adds hostvm as a entry to /etc/hosts using a simple command like this to figure out my host ip (which is the same as the default route).
/sbin/ip -4 route list 0/0 | grep -m 1 default | awk '/default/ { print $3 }'
And just let Puppet run that every time using the exec functionality. However, I get the feeling there has to be a better way.
The guest OS is Ubuntu 12.04 and the Host is OS-X.
Thanks!
As far as I know, at the moment Vagrant always sets up a natted interface to connect to virtualbox, so I think that the ip of your host machine will always be the 10.0.2.2 address you mentioned. I reckon a puppet host declaration might be easier to manage than running that command each time.
host { 'myhostmachine':
ip => '10.0.2.2',
}
The puppet resource reference for hosts has all the other params you can set too.
I was then able to access the host using myhostmachine:9200