0

There seems to be alot of similar problems to mine, but no solution has worked thus far.

I have an ubuntu-xenial running my application listening on port 3333. And i would like this VM to be accessible from outside world. To do this, i have have created a public network on my vagrant file. Here is my vagrant file.

Vagrant.configure("2") do |config|
    config.vm.box = "ubuntu/xenial64"

     config.vm.provider :virtualbox do |vb|
        vb.customize ['modifyvm', :id,'--memory', '2048']
        vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
        vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]

        config.vm.network "public_network", ip:"192.168.0.17", bridge: "en0: Wi-Fi (AirPort)"
        config.ssh.forward_agent = true
    end

ifconfig on the VM looks like this

enp0s3    Link encap:Ethernet  HWaddr 02:f4:1f:34:da:68  
      inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
      inet6 addr: fe80::f4:1fff:fe34:da68/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:1461 errors:0 dropped:0 overruns:0 frame:0
      TX packets:914 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:374409 (374.4 KB)  TX bytes:114458 (114.4 KB)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:e5:7f:3d  
      inet addr:192.168.0.17  Bcast:192.168.0.255  Mask:255.255.255.0
      inet6 addr: fe80::a00:27ff:fee5:7f3d/64 Scope:Link
      inet6 addr: fd44:dcec:a817:0:a00:27ff:fee5:7f3d/64 Scope:Global
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:25 errors:0 dropped:0 overruns:0 frame:0
      TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:2440 (2.4 KB)  TX bytes:1602 (1.6 KB)

lo        Link encap:Local Loopback  
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:1 errors:0 dropped:0 overruns:0 frame:0
      TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1 
      RX bytes:112 (112.0 B)  TX bytes:112 (112.0 B)

Now, here is my problem, i have 2 ethernet network interfaces enp0s3 and enp0s8 with different ips. enp0s3 is created by default, so even if i don't create my public network, enp0s3 still exists.

I can access my vm with the ip 192.168.0.17 (enp0s8) totally fine, but i can't access my vm with 10.0.2.15 (enp0s3). Since the enp0s3 network interface is useless to me, how do i take it out?

When i try the solution here (How to force Vagrant to have a single, bridged, network interface), i am unable to ssh into the vm.

The reason i need the enp0s3 network interface gone is that, i have another program running on my host that scans the network and returns all device ips on the network. It always returns 10.0.2.15 for the virtual machine. When i really want 192.168.0.17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.