== Running OsmoHNBGW

The OsmoHNBGW executable (`osmo-hnbgw`) offers the following command-line
arguments:

=== SYNOPSIS

*osmo-hnbgw* [-h|-V] [-d 'DBGMASK'] [-D] [-c 'CONFIGFILE'] [-s] [-T] [-e 'LOGLEVEL']

=== OPTIONS

*-h, --help*::
	Print a short help message about the supported options
*-V, --version*::
	Print the compile-time version number of the OsmoHNBGW program
*-d, --debug 'DBGMASK','DBGLEVELS'*::
	Set the log subsystems and levels for logging to stderr. This
	has mostly been superseded by VTY-based logging configuration,
	see <<logging>> for further information.
*-D, --daemonize*::
	Fork the process as a daemon into background.
*-c, --config-file 'CONFIGFILE'*::
	Specify the file and path name of the configuration file to be
	used. If none is specified, use `osmo-msc.cfg` in the current
	working directory.
*-s, --disable-color*::
	Disable colors for logging to stderr. This has mostly been
	deprecated by VTY based logging configuration, see <<logging>>
	for more information.
*-T, --timestamp*::
	Enable time-stamping of log messages to stderr. This has mostly
	been deprecated by VTY based logging configuration, see
	<<logging>> for more information.
*-e, --log-level 'LOGLEVEL'*::
	Set the global log level for logging to stderr. This has mostly
	been deprecated by VTY based logging configuration, see
	<<logging>> for more information.


=== Multiple instances

Running multiple instances of `osmo-hnbgw` on the same computer is possible if
all interfaces (VTY, CTRL, Iuh) are separated using the appropriate
configuration options. The IP based interfaces are binding to local host by
default. In order to separate the processes, the user has to bind those
services to specific but different IP addresses and/or ports.

The VTY and the Control interface can be bound to IP addresses from the loopback
address range, for example:

----
line vty
 bind 127.0.0.2
ctrl
 bind 127.0.0.2
----

The Iuh interface can be bound to an individual port:

----
hnbgw
 iuh
  local-ip 0.0.0.0
  local-port 29169
----

For the following links, OsmoHNBGW acts as a client and does not listen/bind to a
specific interface, and will hence not encounter conflicts for multiple instances
running on the same interface:

- The SCCP/M3UA links are established by OsmoHNBGW contacting an STP.

To run multiple OsmoHNBGW instances on the same SCCP routing, each HNBGW has to
configure a distinct point-code, see <<configure_iucs_iups>>.


=== Configuring Primary Links

[[configure_iucs_iups]]
==== Configure SCCP/M3UA to connect to an MSC's _IuCS_ and an SGSN's _IuPS_ interface

OsmoHNBGW acts as client to contact an STP instance and establish an SCCP/M3UA
link.

An example configuration of OsmoHNBGW's SCCP link:

----
cs7 instance 0
 point-code 0.23.5
 asp asp-clnt-OsmoHNBGW 2905 0 m3ua
  remote-ip 127.0.0.1
  sctp-role client
 sccp-address msc
  routing-indicator PC
  point-code 0.23.1
 sccp-address sgsn
  routing-indicator PC
  point-code 0.23.2
hnbgw
 iucs
  remote-addr msc
 iups
  remote-addr sgsn
----

This configuration is explained in detail in <<cs7_config>>.

==== Configure RUA to accept Iuh connections from hNodeB

OsmoHNBGW acts as server to accept Iuh connections from hNodeB devices.

An example configuration for OsmoHNBGW's RUA server:

----
hnbgw
 iuh
  local-ip 10.9.8.7
  local-port 29169
----
