librelist archives

« back to archive

binding to different IPs on the same ethernet card.

binding to different IPs on the same ethernet card.

From:
Anthon van der Neut
Date:
2012-03-01 @ 18:32
My server has one ethernet device with multiple IP addresses associated 
with them. Each IP address has one or more domainnames associated with them.

I am in the process of moving from Apache2+mod_wsgi to mongrel2+uWSGI 
but got stuck as I got an error that the port was in use when I setup 
two servers with different bind_addr but the same port number.

Does anyone have this running? Should this work and am I to dumb to get 
it right?

For http I can do without the bind_addr and select on the domainname. 
But for https, I need to differentiate the servers as the different IP 
addresses (and domains) of course have different certificates.The IP 
address is the only thing for which you can select the right certificate 
as you don't have the domainname at the point the software needs to 
select the certificate.

Anthon

Re: [mongrel2] binding to different IPs on the same ethernet card.

From:
Jason Miller
Date:
2012-03-01 @ 18:36
Hi Anthon,

Did you try using strace to see exactly which address it is binding to?

-Jason

On 19:32 Thu 01 Mar     , Anthon van der Neut wrote:
>    My server has one ethernet device with multiple IP addresses associated
>    with them. Each IP address has one or more domainnames associated with
>    them.
>    I am in the process of moving from Apache2+mod_wsgi to mongrel2+uWSGI
>    but got stuck as I got an error that the port was in use when I setup
>    two servers with different bind_addr but the same port number.
>    Does anyone have this running? Should this work and am I to dumb to get
>    it right?
>    For http I can do without the bind_addr and select on the domainname.
>    But for https, I need to differentiate the servers as the different IP
>    addresses (and domains) of course have different certificates.The IP
>    address is the only thing for which you can select the right
>    certificate as you don't have the domainname at the point the software
>    needs to select the certificate.
>    Anthon

Re: [mongrel2] binding to different IPs on the same ethernet card.

From:
Anthon van der Neut
Date:
2012-03-01 @ 20:34
I did not use strace, and had to install it first on the server and find 
out how to use it.
I added "strace -o /var/tmp/strace00.log -f" to the run script that 
procer starts and then set up the second server in mongrel2.conf once 
more with its separate run script, with a different strace log file.

The strace log of the second mongrel2 actually has
   bind(4, {sa_family=AF_INET, sin_port=htons(80), 
sin_addr=inet_addr("XX.YYY.ZZZ.WW")}, 16) = -1 EADDRINUSE (Address 
already in use)
in it, but it does seem to serve the port correctly as both mongrel2 
instances write to their logs and  call their respective uwsgi programs.

Probably the erroneous part was between my chair and keyboard....

I will keep strace ready for other problems that might occur.
Thanks

Anthon


On 2012-03-01 19:36, Jason Miller wrote:
> Hi Anthon,
>
> Did you try using strace to see exactly which address it is binding to?
>
> -Jason
>
> On 19:32 Thu 01 Mar     , Anthon van der Neut wrote:
>>     My server has one ethernet device with multiple IP addresses associated
>>     with them. Each IP address has one or more domainnames associated with
>>     them.
>>     I am in the process of moving from Apache2+mod_wsgi to mongrel2+uWSGI
>>     but got stuck as I got an error that the port was in use when I setup
>>     two servers with different bind_addr but the same port number.
>>     Does anyone have this running? Should this work and am I to dumb to get
>>     it right?
>>     For http I can do without the bind_addr and select on the domainname.
>>     But for https, I need to differentiate the servers as the different IP
>>     addresses (and domains) of course have different certificates.The IP
>>     address is the only thing for which you can select the right
>>     certificate as you don't have the domainname at the point the software
>>     needs to select the certificate.
>>     Anthon