4

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?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
AAlvz
  • 1,059
  • 2
  • 9
  • 15

2 Answers2

7

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.

Matt Cooper
  • 9,962
  • 2
  • 31
  • 26
  • 3
    Thanks! That was the problem!.. When I did this it caused a `Bad Request` error which I solved by adding `ServerAlias *` to /etc/cups/cupsd.conf and everything worked like a charm. Thanks again. – AAlvz Oct 25 '13 at 22:30
  • @AAlvz `ServerAlias *` really helps me a lot! thanks! – lousuan Nov 01 '22 at 08:33
0

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.

Ryan
  • 156
  • 2
  • 18