
[id='network-configuration_{context}']
= Network configuration

For network configuration, create or adjust _interfaces,_ _socket-bindings,_ and _outbound-socket-bindings._
The networking configuration is stored under the `network` -> `swarm` key.

== Interfaces

An interface represents a known ethernet interface.
By default, the interface named `public` is bound to the `0.0.0.0` IP address, which represents all known interfaces of the underlying machine.
This includes both publicly-routed interfaces, and the localhost (`127.0.0.1`) interface.

In addition to that, when you include the `management` fraction in an application, an interface named `management` is also provisioned, and it is bound only to localhost.

.Additional interface configuration
====

The following interface is called `backnet`, and is bound to the `192.168.4.5` address.

[source,yaml]
----
swarm:
  network:
    interfaces:
      backnet:
        bind: 192.168.4.5
----
====

If you want to change the bind address for the `public` or `management` interfaces, use special properties, which are defined for these two cases in particular:

* `swarm.bind.address`
* `swarm.management.bind.address`

Change the underlying addresses by changing the above properties or their related YAML values.

== Sockets

_Socket bindings_ and _outbound socket bindings_ allow externalized configuration of sockets and ports bound to a particular interface.
Use regular socket-bindings for inbound connections, while outbound-socket-bindings denote connections capable of changing to remote locations.

=== Socket-binding groups

Groups of bindings occur within _socket binding groups,_ where `standard-sockets` is the default group.
You can bind the sockets of an entire group to a given default interface, or you can offset all members of the group by a particular number of ports.

.Socket-binding group
====

The ports of the `standard-sockets` default group are offset by 10:

[source,yaml]
----
swarm:
  network:
    socket-binding-groups:
      standard-sockets:
        port-offset: 10
        default-interface: public
----
====

.Socket binding
====

Socket-bindings may be created or adjusted within a `socket-binding-group`:

[source,yaml]
----
swarm:
  network:
    socket-binding-groups:
      standard-sockets:
        http:
          port: 8081
----
====

.Outbound socket binding
====

To create a named outbound socket binding for connection to remote endpoints, define `outbound-socket-bindings` in a `socket-binding-group`:

[source,yaml]
----
swarm:
  network:
    socket-binding-groups:
      standard-sockets:
        outbound-socket-bindings:
              neo4jtesthost:
                remote-host: localhost
                remote-port: 7687
----
====

