Vagrant reverse port forwarding?

后端 未结 5 1827
栀梦
栀梦 2020-12-07 07:06

I\'m working on a web services architecture. I\'ve got some software that I need to run on the native host machine, not in Vagrant. But I\'d like to run some client services

5条回答
  •  盖世英雄少女心
    2020-12-07 08:04

    Add following to your ~/.ssh/config on the host machine:

    Host 127.0.0.1
    RemoteForward 52698 127.0.0.1:52698
    

    It lets you access a service on host machine port 52698 from Vagrant, as long as you logged in via vagrant ssh.

    You can confirm it works by running netstat -lt on vagrant VM and taking a note on the following lines:

    tcp      0    0 localhost:52698         *:*                 LISTEN
    tcp6     0    0 ip6-localhost:52698     [::]:*              LISTEN
    

提交回复
热议问题