Mailing List Archive

Question about binding tcpserver to several IP addresses
Hello,

is there a way to bind tcpserver to several IP addresses at once? For
example, I have IP{1-3}. I would like to use one configuration for
IP{1-2} (served via /service/qmail-smtpd1), and another one for the last
IP address (/service/qmail-smtpd2). I have searched Google for any
patches, but I can not find anything.


Thanks in advance,
Re: Question about binding tcpserver to several IP addresses [ In reply to ]
El 28/05/2012 10:20, Todor Petkov escribió:
> Hello,
>
> is there a way to bind tcpserver to several IP addresses at once? For
> example, I have IP{1-3}. I would like to use one configuration for
> IP{1-2} (served via /service/qmail-smtpd1), and another one for the
> last IP address (/service/qmail-smtpd2). I have searched Google for
> any patches, but I can not find anything.
>
>
> Thanks in advance,
>

you should create sepparate tcpserver instances by "cloning" the run
scripts ( /services/qmail-smtp/run ) and changing the listening port
within these scripts.
Re: Question about binding tcpserver to several IP addresses [ In reply to ]
On Mon, May 28, 2012 at 10:29:50AM +0200, "Iv??n L. Morales" wrote:
> El 28/05/2012 10:20, Todor Petkov escribi??:
> > Hello,
> >
> > is there a way to bind tcpserver to several IP addresses at once? For
> > example, I have IP{1-3}. I would like to use one configuration for
> > IP{1-2} (served via /service/qmail-smtpd1), and another one for the
> > last IP address (/service/qmail-smtpd2). I have searched Google for
> > any patches, but I can not find anything.
> >
> >
> > Thanks in advance,
> >
>
> you should create sepparate tcpserver instances by "cloning" the run
> scripts ( /services/qmail-smtp/run ) and changing the listening port
> within these scripts.
>

I agree.

I suggest you create /service/qmail-smtpd{1,2,3} and in the run
scripts set tcpserver to listen on a different IP in the pool and
perform their different functions (IP{1,2} v IP{3})
Re: Question about binding tcpserver to several IP addresses [ In reply to ]
Hello,

>> is there a way to bind tcpserver to several IP addresses at once? For
>> example, I have IP{1-3}. I would like to use one configuration for
>> IP{1-2} (served via /service/qmail-smtpd1), and another one for the
>> last IP address (/service/qmail-smtpd2).

> I suggest you create /service/qmail-smtpd{1,2,3} and in the run
> scripts set tcpserver to listen on a different IP in the pool and
> perform their different functions (IP{1,2} v IP{3})

If you want to have a single point of maintenance, you can use a UNIX
shell scripting trick.

Use ln to link the two other run scripts to the original.

# cd /service
# mv qmail-smptd qmail-smptd1
# mkdir qmail-smptd2 qmail-smptd3
# ln qmail-smptd1/run qmail-smptd2/run
# ln qmail-smptd1/run qmail-smptd3/run

The run file names are now aliases for the same underlying file.  Edit
the run file and add

dirName="$(dirname $0)"  # - OR  dirName=`dirname $0`

if [ "${dirName}" = "." ]
then
  dirName="$(basename $PWD)"
else
  dirName="$(basename ${dirName})"
fi

case "${dirName}" in
qmail-smtpd1)
TCP_HOST=192.168.1.30 # substitute your first actual IP addr here
;;
qmail-smtpd2)
TCP_HOST=192.168.1.31 # substitute your second actual IP addr here
;;
qmail-smtpd3)
TCP_HOST=192.168.1.32 # substitute your third actual IP addr here
;;
*)_echo "Unable choose a TCP_HOST"
exit 1
;;
esac

## Now later on in the run script use $TCP_HOST for the in the
tcpserver startup line

- David