Vagrant port forwarding not working. Cups not acce

2019-02-25 09:10发布

问题:

So I'm working with vagrant and I'm trying to use it as a printing server. I installed cups.

Internally everything works just fine. I can even make a quick curl to my localhost:631 (cups port inside my vagrant) and there's everything.

The thing is I cant access it in any way I try from the host machine.

Obviously I forwarded the port and I've tried with several ports. I've also tried with Debian squeeze and Ubuntu 12.04. Here is my current Vagrantfile

Vagrant.configure("2") do |config|                                              
  config.vm.box = "guruDebian"
  config.vm.network :forwarded_port, guest: 80, host: 8080
  config.vm.network :forwarded_port, guest: 631, host: 6363   ## HERE IS CUPS           
end

Any ideas?

回答1:

I think what you will find is that the default cups config file is locked down to only work from localhost for security reasons.

Inside your Vagrant VM open the /etc/cups/cupsd.conf file and change the following line:

Listen localhost:631

to

Listen 0.0.0.0:631

That should allow you to connect from any host.



回答2:

Have you tried accessing port 8080 of guest to your host? if no, and the services inside guest are running. then its a firewall issue in guest.

Try to turn firewall temporarily

service iptables off

then try to access it again from host.



标签: vagrant cups