Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
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 1 '12 at 1: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 1 '12 at 1: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 1 '12 at 1: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 1 '12 at 1: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 1 '12 at 1:20
show 2 more comments

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
    
I have answered you in my question. –  Chris Dec 1 '12 at 1:00
    
Thank you, it is working now. –  Chris Dec 1 '12 at 8:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.