Max Gregorian wrote:
A few points.

Firstly, If you are going to run 2 different instances on the same server,
they should have different ports (e.g. 5060 for the 1st instance and 5062
for 2nd).

not needed if you are using different IP addresses.

regards
klaus


Secondly, if you are trying to resolve 2 different Local IPs to the same
server (in your case 192.168.1.112 and 192.168.1.113), one of any of these
should happen:
1. you should either have 2 network card interfaces in your server, or
2. Linux does this thing where it is able to split a single (physical) NIC
interface into seperate virtual interfaces (e.g. for a single interface *
eth0* splits it into *eth0:0* for the 1st virtual interface and *eth0:1* for the 2nd, etc). The process is called *IP aliasing*. You should then allocate
the 2 local IPs to the 2 virtual interfaces like so:
eth0:0 -> 192.168.1.112, and
eth0:1 -> 192.168.1.113

commands are something like this:

   ifconfig eth0   *XXX.XXX.XXX.XXX* netmask 255.255.255.0 broadcast *
XXX.XXX.XXX*.255
   ifconfig eth0:0 192.168.1.112   netmask 255.255.255.0 broadcast
192.168.1.255
   ifconfig eth0:1 192.168.1.113   netmask 255.255.255.0 broadcast
192.168.1.255

   route add -host *XXX.XXX.XXX.XXX* dev eth0
   route add -host 192.168.1.112 dev eth0
   route add -host 192.168.1.113  dev eth0
   route add default gw <Gateway IP>

where *XXX.XXX.XXX.XXX* in the 1st instance refers to another local IP e.g.
192.168.1.3.
(I am no Linux guru so maybe the gurus here could pipe in). :)

Method 1 is probably the simpler and more straight-forward, but if you can't
afford 2 NICs I don't think Method 2 will be too difficult either.


Simply putting the entries in etc/hosts is not enough as the server needs to
be able to identify them as 2 separate instances. This is why you are
getting that error - it's because only one interface was identified and that
has already been "bound" to the first Local IP (192.168.1.112).

Also, if I understand your *ifconfig* output correctly, then this is not
setup correctly. You seem to be mixing private and public IP addresses. If
you are going through a router or NATed environement you don't need
to assign the external interfaces to the NIC(s), nor do you specifically
need to define them in your openser.cfgs (i.e. listen=external IP). You only
need this if you are in a non-NATed environment, so it's a case of either
or.

Hope that made sense.



On 05/01/07, Gerardo Amaya <[EMAIL PROTECTED]> wrote:

Hello All. I'm trying to install 2 Instances of openser on the same
machine with the following interfaces:

Instance #1 -----> 172.16.18.2 and 192.168.1.112
Instance #2 -----> 172.16.1.2 and 192.168.1.113

I made one installation on the default OpenSER folders and one in the
/usr/loca/openser_1/

The configuration went quite smooth. The first instance of the server is
running with no problem at all, but when I try to start the second
instance I got an error that it was unable to resolve the IP addresses I
add the following lines to the /etc/hosts file:

### OpenSER 1st interface configuration ####
192.168.1.112   openser1_internal
172.16.18.2     openser1_external
### OpenSER 1st Interface configuration ####

### OpenSER 2nd Interface configuration ####
192.168.1.113   openser1_internal
172.16.1.2     openser1_external
### OpenSER 2nd Interface configuration ####


After that Now I have the following error:

Jan  5 17:26:30 atel-router ./openser[17772]: ERROR: tcp_init: bind(7,
0x813e194, 16) on 192.168.1.112:5060 : Address already in use


Any Help will be appreciated, of better is there a How-to on OpenSER
multiple instances please let me know.

Thanks in advance

Gerardo Amaya

Here is the configuration file for each instance:

OpenSER.cfg Instance #1

#
# $Id: ser.cfg,v 1.25.2.1 2005/02/18 14:30:44 andrei Exp $
#
# simple quick-start config script
#

# ----------- global configuration parameters ------------------------

debug=5        # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no # (cmd line: -E)

/* Uncomment these lines to enter debugging mode
#fork=no
#log_stderror=yes
*/

check_via=no    # (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
listen=192.168.1.112
listen=172.16.18.2
port=5060
mhomed=1
children=4
fifo="/tmp/ser_fifo"

# ------------------ module loading ----------------------------------

# Uncomment this if you want to use SQL database
loadmodule "/usr/local/lib/openser/modules/mysql.so"

loadmodule "/usr/local/lib/openser/modules/sl.so"
loadmodule "/usr/local/lib/openser/modules/tm.so"
loadmodule "/usr/local/lib/openser/modules/rr.so"
loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
loadmodule "/usr/local/lib/openser/modules/usrloc.so"
loadmodule "/usr/local/lib/openser/modules/registrar.so"
loadmodule "/usr/local/lib/openser/modules/textops.so"
loadmodule "/usr/local/lib/openser/modules/uri.so"
loadmodule "/usr/local/lib/openser/modules/uri_db.so"
loadmodule "/usr/local/lib/openser/modules/domain.so"
loadmodule "/usr/local/lib/openser/modules/mediaproxy.so"
loadmodule "/usr/local/lib/openser/modules/nathelper.so"

# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/openser/modules/auth.so"
loadmodule "/usr/local/lib/openser/modules/auth_db.so"

# ----------------- setting module-specific parameters ---------------

# -- usrloc params --

#modparam("usrloc", "db_mode",   0)

# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)

# -- auth params --
# Uncomment if you are using auth module
#
#modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config),
# uncomment also the following parameter)
#
#modparam("auth_db", "password_column", "password")

# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

# -- nathelper and mediaproxy params --
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "rtpproxy_sock", "unix:/var/run/rtpproxy.sock")
# -- End of nathelper and mediaproxy params --

# -- auth_db database params for domain.so module to work properly --

modparam("auth_db|domain|uri_db|usrloc","db_url","
mysql://root:[EMAIL PROTECTED]/openser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
# -- End of database params --


# -------------------------  request routing logic -------------------

# main routing logic

route{

       # initial sanity checks -- messages with
       # max_forwards==0, or excessively long requests
       if (!mf_process_maxfwd_header("10")) {
               sl_send_reply("483","Too Many Hops");
               return;
       };
       if (msg:len >=  2048 ) {
               sl_send_reply("513", "Message too big");
               return;
       };


       if (method == "REGISTER" || ! search("^Record-Route:")) {

         fix_nated_contact(); # Rewrite contact with source IP of
signalling
         #if (method == "INVITE") {
         #  fix_nated_sdp("1"); # Add direction=active to SDP
         #};

         force_rport(); # Add rport parameter to topmost Via

       }


       if (method == "INVITE") {
           if (dst_ip == 192.168.1.112){
               if (force_rtp_proxy("FAII"))
               t_on_reply("1");
           } else if (dst_ip == 172.16.18.2){
               if (force_rtp_proxy("FAEI"))
               t_on_reply("1");
           } else if (dst_ip == 192.168.1.112){
               if (force_rtp_proxy("FAIE"))
               t_on_reply("1");
           } else if (dst_ip == 172.16.18.2){
               if (force_rtp_proxy("FAEE"))
               t_on_reply("1");
           }
       };
       # Record-route all messages -- to make sure that
       # subsequent messages will go through our proxy; that's
       # particularly good if upstream and downstream entities
       # use different transport protocol

       # This is the Call Tear Down Section
       if (method=="BYE" || method=="CANCEL") {
          unforce_rtp_proxy();
       };

       route(1);
}

route[1] {

       t_on_reply("1");

       #force_rtp_proxy();
       t_relay("udp:192.168.1.2:5060");


}

onreply_route[1] {

       if (!search("^Content-Length:[ ]*0")) {
               force_rtp_proxy();
       };

       if (nat_uac_test("1")) {
               fix_nated_contact();
       };
}


OpenSER.cfg Instance #2
#
# $Id: ser.cfg,v 1.25.2.1 2005/02/18 14:30:44 andrei Exp $
#
# simple quick-start config script
#

# ----------- global configuration parameters ------------------------

debug=5        # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no # (cmd line: -E)

/* Uncomment these lines to enter debugging mode
#fork=no
#log_stderror=yes
*/

check_via=no    # (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
listen=udp:192.168.1.113:5060
listen=udp:172.16.1.2:5060
#port=5060
mhomed=1
children=4
fifo="/tmp/ser_fifo2"

# ------------------ module loading ----------------------------------

# Uncomment this if you want to use SQL database
loadmodule "/usr/local/lib/openser/modules/mysql.so"

loadmodule "/usr/local/openser_1/lib/openser/modules/sl.so"
loadmodule "/usr/local/openser_1/lib/openser/modules/tm.so"
loadmodule "/usr/local/openser_1/lib/openser/modules/rr.so"
loadmodule "/usr/local/openser_1/lib/openser/modules/maxfwd.so"
loadmodule "/usr/local/openser_1/lib/openser/modules/usrloc.so"
loadmodule "/usr/local/openser_1/lib/openser/modules/registrar.so"
loadmodule "/usr/local/openser_1/lib/openser/modules/textops.so"
loadmodule "/usr/local/openser_1/lib/openser/modules/uri.so"loadmodule
"/usr/local/openser_1/lib/openser/modules/nathelper.so"

# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/openser_1/lib/openser/modules/auth.so"
loadmodule "/usr/local/openser_1/lib/openser/modules/auth_db.so"

# ----------------- setting module-specific parameters ---------------

# -- usrloc params --

#modparam("usrloc", "db_mode",   0)

# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)

# -- auth params --
# Uncomment if you are using auth module
#
#modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config),
# uncomment also the following parameter)
#
#modparam("auth_db", "password_column", "password")

# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

# -- nathelper and mediaproxy params --
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
modparam("nathelper", "rtpproxy_sock", "unix:/var/run/rtpproxy_1.sock")
# -- End of nathelper and mediaproxy params --

# -- auth_db database params for domain.so module to work properly --

modparam("auth_db|domain|uri_db|usrloc","db_url","
mysql://root:[EMAIL PROTECTED]/openser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
# -- End of database params --


# -------------------------  request routing logic -------------------

# main routing logic

route{

       # initial sanity checks -- messages with
       # max_forwards==0, or excessively long requests
       if (!mf_process_maxfwd_header("10")) {
               sl_send_reply("483","Too Many Hops");
               return;
       };
       if (msg:len >=  2048 ) {
               sl_send_reply("513", "Message too big");
               return;
       };


       if (method == "REGISTER" || ! search("^Record-Route:")) {

         fix_nated_contact(); # Rewrite contact with source IP of
signalling
         #if (method == "INVITE") {
         #  fix_nated_sdp("1"); # Add direction=active to SDP
         #};

         force_rport(); # Add rport parameter to topmost Via

       }


       if (method == "INVITE") {
           if (dst_ip == 192.168.1.113){
               if (force_rtp_proxy("FAII"))
               t_on_reply("1");
           } else if (dst_ip == 172.16.1.2){
               if (force_rtp_proxy("FAEI"))
               t_on_reply("1");
           } else if (dst_ip == 192.168.1.113){
               if (force_rtp_proxy("FAIE"))
               t_on_reply("1");
               t_on_reply("1");
           } else if (dst_ip == 192.168.1.113){
               if (force_rtp_proxy("FAIE"))
               t_on_reply("1");
           } else if (dst_ip == 172.16.1.2){
               if (force_rtp_proxy("FAEE"))
               t_on_reply("1");
           }
       };
       # Record-route all messages -- to make sure that
       # subsequent messages will go through our proxy; that's
       # particularly good if upstream and downstream entities
       # use different transport protocol

       # This is the Call Tear Down Section
       if (method=="BYE" || method=="CANCEL") {
          unforce_rtp_proxy();
       };

       route(1);
}

route[1] {

       t_on_reply("1");

       #force_rtp_proxy();
       t_relay("udp:192.168.1.2:5060");


}

onreply_route[1] {

       if (!search("^Content-Length:[ ]*0")) {
               force_rtp_proxy();
       };

       if (nat_uac_test("1")) {
               fix_nated_contact();
       };
}

loadmodule "/usr/local/openser_1/lib/openser/modules/uri_db.so"
loadmodule "/usr/local/openser_1/lib/openser/modules/domain.so"
loadmodule "/usr/local/openser_1/lib/openser/modules/mediaproxy.so"





ifconfig output

eth0      Link encap:Ethernet  HWaddr 00:0E:2E:0A:61:68
         inet addr:172.16.18.2  Bcast:172.16.18.255  Mask:255.255.255.0
         inet6 addr: fe80::20e:2eff:fe0a:6168/64 Scope:Link
         UP BROADCAST MULTICAST  MTU:1500  Metric:1
         RX packets:216465 errors:0 dropped:0 overruns:0 frame:0
         TX packets:323925 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:18190685 (17.3 MiB)  TX bytes:118579358 (113.0 MiB)
         Interrupt:185 Base address:0xaf00

eth1      Link encap:Ethernet  HWaddr 00:0E:2E:06:EC:17
         inet addr:172.16.1.2  Bcast:172.16.1.255  Mask:255.255.255.0
         UP BROADCAST MULTICAST  MTU:1500  Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
         Interrupt:209 Base address:0xce00

eth2      Link encap:Ethernet  HWaddr 00:0C:76:BE:E5:87
         inet addr:192.168.1.112  Bcast:192.168.1.255  Mask:255.255.255.0
         inet6 addr: fe80::20c:76ff:febe:e587/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:1155321 errors:0 dropped:0 overruns:0 frame:0
         TX packets:664343 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:187622098 (178.9 MiB)  TX bytes:125573054 (119.7 MiB)
         Interrupt:217 Base address:0xed00

eth2:0    Link encap:Ethernet  HWaddr 00:0C:76:BE:E5:87
         inet addr:192.168.1.113  Bcast:192.168.1.255  Mask:255.255.255.0
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         Interrupt:217 Base address:0xed00



_______________________________________________
Users mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/users



------------------------------------------------------------------------

_______________________________________________
Users mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/users


--
Klaus Darilion
nic.at


_______________________________________________
Users mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/users

Reply via email to