hashicorp/vagrant-vmware-desktop

OSX, Vagrant, Fusion, vagrant-vmware-desktop always launches ssh/portforward via ipv6 on host

Opened this issue · 7 comments

When using Vagrant 2.3.4, Fusion 13.0.2 , and vagrant-vmware-desktop (3.0.) provider on a m1 mac running 13.3.1 it will always forward ssh port using ipv6 even if the host currently has ipv6 disable for the network device and host_ip is assigned at localhost/127.0.0.1 and not ipv6.

How do I tell it to use ipv4 and not ipv6 ?

config.vm.network "forwarded_port", guest: 22, host: 2222, host_ip: "127.0.0.1", id: "ssh"

On mac it shows 2222 is utilizing ipv6
vagrant-v 4578 root 12u IPv6 0xeb5f3de393e534d3 0t0 TCP *:2222 (LISTEN)
Expected behavior

vagrant-v 4578 root 12u IPv4 0x2cc683a1668ce0db 0t0 TCP localhost:2222 (LISTEN)
Actual behavior

"forwarded_port" is using ipv6
vagrant-v 4578 root 12u IPv6 0xeb5f3de393e534d3 0t0 TCP *:2222 (LISTEN)
Reproduction information

Run OSX and run vagrant up
Vagrant version

Vagrant 2.3.4
Host operating system

OSX 13.3.1 M1 chip
Guest operating system

RockyLinux9, Ubuntu 22.04
Steps to reproduce

Run vagrant
Vagrantfile

config.vm.network "forwarded_port", guest: 22, host: 2222, host_ip: "127.0.0.1", id: "ssh"

phinze commented

Hi @EnorMOZ - thanks for the report. We'll try to get this reproduced and follow up.

When running via Fusion only:

/Library/Preferences/VMware\ Fusion/networking

add_nat_portfwd 2 tcp 2222 10.10.10.100 22
add_nat_portfwd 8 tcp 2200 10.10.10.100 22

vmnet2/nat.conf

[incomingtcp]
2222 = 10.10.10.100:22

vmnet8/nat.conf

[incomingtcp]
2200 = 10.10.10.100:22

lsof -i -P |egrep "vmn.*:22"

vmnet-nat 61902           root   11u  IPv4 0xeb5f3ddec1693cdb      0t0  TCP *:2222 (LISTEN)
vmnet-nat 61926           root   11u  IPv4 0xeb5f3ddec16926bb      0t0  TCP *:2200 (LISTEN)

Not sure if I am doing it properly on the vagrant side. Or somehow it is always defaulting to using ipv6

Hi @EnorMOZ. Would you please provide a gist of the output generated from running:

vagrant up --debug

And if you can provide a minimal Vagrantfile that's producing the issue, that would be great. Thanks!

While powered and started

sudo lsof -i -P |egrep "vmn.*:22|vagrant.*:22"                                                                                                                                                                                                                   
vagrant-v  4578           root    9u  IPv6 0xeb5f3de393e54cd3      0t0  TCP localhost:2200->localhost:62366 (ESTABLISHED)
**vagrant-v  4578           root   11u  IPv6 0xeb5f3de393e544d3      0t0  TCP *:2200 (LISTEN)**
vagrant-v  4578           root   12u  IPv4 0xeb5f3ddec0fa4a4b      0t0  TCP 172.16.159.1:62367->172.16.159.130:22 (ESTABLISHED)
vmnet-nat 72898           root   11u  IPv4 0xeb5f3ddec169e91b      0t0  TCP *:2222 (LISTEN)

While powered off

sudo lsof -i -P |egrep "vmn.*:22|vagrant.*:22"                                                                                                                                                                                   
**vagrant-v  4578           root   11u  IPv6 0xeb5f3de393e544d3      0t0  TCP *:2200 (LISTEN)**
vmnet-nat 72898           root   11u  IPv4 0xeb5f3ddec169e91b      0t0  TCP *:2222 (LISTEN)

Vagrantfile.txt
vagrant.log

Hi @EnorMOZ. Would you please provide a gist of the output generated from running:

vagrant up --debug

And if you can provide a minimal Vagrantfile that's producing the issue, that would be great. Thanks!

Let me know if you need any additional information. Same issue is occurring on Vagrant 2.3.5, Fusion 13.0.2 , and vagrant-vmware-desktop (3.0.3)

@EnorMOZ Hi! One thing that would be helpful: can you provide the output from ifconfig on your host machine?

@EnorMOZ Hi! One thing that would be helpful: can you provide the output from ifconfig on your host machine?
ifconfig.txt