Cortwave
Cortwave

Reputation: 4917

How to bind external ip to Vagrant VM?

I have external IP address. I added it to my eth0 interface of host machine. I can successfully ping it. I want to run VM using Vagrant and set my external IP to it (I want to call my VM just like a simple VPS using this external IP address). I have next line in Vagrantfile for this:

node.vm.network "public_network", ip: myExternalIP

After my machine start I see eth2 interface inside my VM with my external IP as inet addr. But I can't get access to any open port on my vm using this IP address. Maybe I don't understand idea of public_network in Vagrant. How to bind external ip to my Vagrant VM?

Update: As I understood vagrant set default gateway of VM to interface under NAT. Due to NAT packages cant be sent from VM to external world through bridged interface.

Upvotes: 2

Views: 1251

Answers (1)

Jean Guzman
Jean Guzman

Reputation: 2232

I got it working this way:

config.vm.network "public_network", ip: "192.168.0.17"

Upvotes: 1

Related Questions