If you want to forward two ports, you can simply add another line:
config.vm.network :forwarded_port, guest: 8080, host: 8080 config.vm.network :forwarded_port, guest: 5432, host: 5432
The best way, in my opinion, is to set up a private network (or a host-only network), so you do not need to manually forward all ports.
See my post here: Forwarding the reverse port of vagrants?
Additional tips
If you use the :id function when defining entries :forward_port , you need to make sure that each one is unique. Otherwise, they will shrink with each other, and the last of them, as a rule, wins.
For example:
config.vm.network "forwarded_port", guest: 8080, host: 8080, id: 'was_appserver_http' config.vm.network "forwarded_port", guest: 9043, host: 9043, id: 'ibm_console_http' config.vm.network "forwarded_port", guest: 9060, host: 9060, id: 'ibm_console_https'
Mingyu Jul 12 '13 at 21:19 2013-07-12 21:19
source share