-1

I have a public subnet with squid installed.

Let's say my subnet is from 1.2.3.2 to 1.2.4.254.

When I set the following:

http_port 50000
http_port 1.2.3.2:50000

it is working.

But when I set:

http_port 1.2.4.37:50000

it is not working.

It is only working with my first public IP from my subnet.

The error I get when it is not working is the following:

commBind: Cannot bind socket FD 10 to 1.2.4.37:50000: (99) Cannot assign requested address

What is wrong with my configuration?

@Zoredache

I have a dedicated server and the whole subnet is defined as IP Range. When I use only the port or the first IP and doing

netstat -ntlp | grep  46555

I get the following:

tcp        0      0 0.0.0.0:50000           0.0.0.0:*               LISTEN      25532/(squid        )

When I use my specific IP, then the netstat query will show nothing, as the server does not start. I don't want squid to listen on all or the first IP, it is just a specific one it should listen to.

Chris
  • 235
  • 1
  • 4
  • 9
  • `the whole subnet is defined as IP Range`. How exactly did you accomplish that. Have you actually assigned every address to the computer, or has it just been routed to the computer. Is `1.2.4.37` listed within the output of `ip addr`? – Zoredache Dec 01 '12 at 01:08
  • I get: `inet 1.2.3.2/22 brd 1.2.5.255 scope global eth0`. I transfered the original IPs to my above example for privacy reasons. Maybe the IP is not correctly transfered, but the `/22` is shown. So it should be assigned I think. – Chris Dec 01 '12 at 01:13
  • If the host hasn't been configured to have the `1.2.4.37` IP address then it doesn't have it. You MUST configure it within the network settings. Squid cannot bind to an IP that hasn't been configured on the host. – Zoredache Dec 01 '12 at 01:16
  • I thought when configuring the IP with my subnet mask, all IPs are configured. It shows the /22, so I think it has the whole subnet? Or will I need to assign every IP one by one? – Chris Dec 01 '12 at 01:18
  • 1
    No setting a subnet mask does not automatically assign all the addresses to the system. The subnet mask is used for making a routing decision, so your computer knows what address space is local, and what isn't. – Zoredache Dec 01 '12 at 01:20
  • When entering ifconfig it shows `inet Address:X.X.X.2 Bcast:X.X.X.255 Mask:255.255.252.0` So what will I need to do now? – Chris Dec 01 '12 at 01:25

1 Answers1

4

What is the output of netstat -ntlp | grep 50000?

By default the http_port 50000 option will result in squid binding to 0.0.0.0:50000 which means it will accept requests on any address on the system.

You shouldn't need to list 1.2.3.2, or 1.2.4.37. Just make sure those addresses are assigned to the host.

If your host doesn't have the 1.2.4.37 address assigned locally, then I would gather you are trying to do interception caching or something. You probably need to intercept that address with a firewall rule. On a Linux system you would do this with REDIR.

ip addr - I get: inet 1.2.3.2/22 brd 1.2.5.255 scope global eth0.

If the host hasn't been configured to have the 1.2.4.37 IP address then it doesn't have it. You MUST configure it within the network settings. Squid cannot bind to an IP that hasn't been configured on the host.

Zoredache
  • 128,755
  • 40
  • 271
  • 413