RangerRanger
RangerRanger

Reputation: 2493

Publicly accessible IP for Vagrant on OSX

Trying to learn a bit more about networking via Vagrant and Linux.

My machine is running OSX and I've spun up a Vagrant box (trusty 64) and set up a simple netcat redirect like so: printf 'HTTP/1.1 302 Moved\r\nLocation: https://www.eff.org/' | nc -l 2345

I'm trying to get netcat to redirect my browser when I hit it (IP:2345) but nothing seems to work. I've tried looking up the IP from Vagrant a bunch of times and I keep finding different addresses and none of them work. Browser simply hangs and netcat never receives the request.

I've very little experience in VMs so I'm guessing that there isn't a publicly accessible IP in this instance? At least not with some config.

Upvotes: 1

Views: 418

Answers (1)

RangerRanger
RangerRanger

Reputation: 2493

Solution is to bridge the network. Add this to the Vagrantfile:

Vagrant.configure("2") do |config| config.vm.network "public_network" end

Documentation on this here: https://www.vagrantup.com/docs/networking/public_network.html

Upvotes: 1

Related Questions