Network Load Balancer Listeners

This section describes how to use listeners to check for incoming traffic on the network load balancer's IP address.

Creating a Network Load Balancer Listener

You can create a listener for an existing network load balancer (NLB). The listener waits for traffic to arrive for an IP address and distributes the traffic to the backend set servers. To handle traffic, you must configure at least one listener for each traffic type. When you create a listener, you must make sure that your VCN's security rules allow the listener to accept traffic.

Using the Compute Web UI

  1. Open the Navigation Menu. Under Networking, click Network Load Balancers.

  2. Click the name of the Network Load Balancer for which you want to create the listener.

  3. Any existing listeners are listed under the NLB Resources information, otherwise the list says No data available. To create a listener, click Create Listener.

  4. Enter the following information:

    • Name: Enter a descriptive name for the Listener.

    • Protocol: Select TCP from the drop-down list.

    • Port: The default port value 22 for TCP is preselected. Use the up or down arrows to change the port value, or enter a value between 1 and 65,535.
    • Backend Set: Select the backend set for the listener from the pull-down list. If the value is None Available, then you haven't yet created any NLB backend sets and must do so before this parameter can be configured.

    • IP Version: The default IP Version 4 is preselected.
  5. Click the Create Listener button in the dialog. To display the details of the listener, you must view the details for the network load balancer.

Using the OCI CLI

  1. Gather the information you need to run the command:

    • Compartment OCID (oci iam compartment list --compartment-id-in-subtree true)

    • NLB OCID (oci nlb network-load-balancer list --compartment-id compartment_OCID)

    • NLB accepted protocol list (oci nlb protocol list --compartment-id compartment_OCID)
  2. Run the listener create command.

    Use the NLB OCID, backend set name, accepted protocol, and other details to create the listener for the NLB backend set in the specified compartment.

    Note:

    For information about optional parameters, run the command with the --help option.

    Syntax (entered on a single line):

    oci nlb listener create --default-backend-set-name backend-set-name \
      --network-load-balancer-id network-load-balancer_OCID \  
      --name listener-name --port listener-port \
      --protocol listener-protocol  

    Where:

    default-backend-set-name is the name of the associated backend set. Example: example_backend_set.

    ip-version is the IP version that the listener pays attention to. Defaults to IPV4.

    load-balancer_OCID is the OCID of the load balancer on which to add a listener.

    listener_name is a user-friendly name for the listener. It must be unique and it can't be changed. Example: example_listener.

    listener-port is the communication port integer for the listener. Example: 22.

    listener-protocol is the protocol on which the listener accepts connection requests. Example: TCP.

    Options:

    max-wait-seconds The maximum time to wait for the work request to reach the state defined by wait-for-state. Defaults to 1200 seconds.

    wait-for-state This operation asynchronously creates, modifies or deletes a resource and uses a work request to track the progress of the operation. Accepted values are: ACCEPTED, CANCELED, CANCELING, FAILED, IN_PROGRESS, SUCCEEDED.

    wait-interval-seconds Check every --wait-interval-seconds to see whether the work request has reached the state defined by --wait-for-state. Defaults to 30 seconds.

    Example:

    $ oci nlb listener create --default-backend-set-name PublicNLB1-Backend-Set \
      --network-load-balancer-id ocid1.networkloadbalancer....….….….uniqueID  \  
      --name LB1-Listener --port 22 --protocol TCP  
    
    {
     "opc-work-request-id": "ocid1.workrequest.oc1.pca.networkloadbalancer...uniqueID"
    }

    Note:

    To see the listener results, use the NLB listener get command.
    $ oci nlb listener get --listener-name PrivNLB_TCPListener \
      --network-load-balancer-id ocid1.networkloadbalancer....….….….uniqueID 
    
    {
      "data": {
        "default-backend-set-name": "PrivNLB_TCPListen",
        "ip-version": "IPV4",
        "name": "PrivNLB_TCPListener",
        "port": 22,
        "protocol": "TCP"
      },
    }

Editing a Network Load Balancer Listener

You can change some network load balancer (NLB) listener properties.

Using the Compute Web UI

  1. Open the Navigation Menu. Under Networking, click Network Load Balancers.

  2. Click on the Network Load Balancer for which you want to view listeners.
  3. Under Resources, click Listeners.
  4. Select the name of the NLB listener that you want to edit.

  5. In the Actions list, click Edit to open the Edit Network Load Balancer Listener window.

  6. Make allowable changes to the listener in the pop-up window.

  7. Click Update Network Load Balancer Listener to update the NLB Listener properties.

Using the OCI CLI

  1. Gather the information you need to run the command:

    • Compartment OCID (oci iam compartment list --compartment-id-in-subtree true)

    • NLB OCID (oci nlb network-load-balancer list --compartment-id compartment_OCID)

  2. Run the update command.

    Note:

    For information about optional parameters, run the command with the --help option.

    Syntax (entered on a single line):

    oci nlb listener update --default-backend-set-name default-backendset-name \ 
    --listener-name listener-name --network-load-balancer-id networkloadbalancer_OCID\
    --port port-integer --protocol protocol-text

    Where:

    default-backendset-name is the name of the associated backend set.

    listener-name is the name of the listener to update. Example: example_listener

    networkloadbalancer_OCID is the OCID of the load balancer associated with the listener to update

    port-integer is the communication port for the listener. Example: 22.

    protocol-text is the protocol on which the listener accepts connection requests. Example: TCP

    Example (change listener port to 222):

    $ oci nlb listener update --default-backend-set-name PublicLB1-Backend-Set \ 
      --listener-name NLB1_Listener --network-load-balancer-id \ 
      ocid1.networkloadbalancer....….….….uniqueID \
      --port 222 --protocol TCP
    
    {
      "opc-work-request-id": "ocid1.workrequest.....….….….uniqueID "
    }

    Note:

    The command returns a work request ID. To see the update results, you use the NLB work-request get command.
    $ oci nlb work-request get --work-request-id ocid1.workrequest....….….….uniqueID 

    View the Listener details using the listener get command.

    $ oci nlb listener get --listener-name NLB1_Listener --network-load-balancer-id \ 
      --network-load-balancer-id ocid1.networkloadbalancer....….….….uniqueID
    
    {
      "data": {
        "default-backend-set-name": "PrivNLB_TCPListen",
        "ip-version": "IPV4",
        "name": "PrivNLB_TCPListener",
        "port": 22,
        "protocol": "TCP"
      },
    }

Deleting a Network Load Balancer Listener

You can delete a network load balancer (NLB) Listener and remove it from service.

Using the Compute Web UI

  1. Open the Navigation Menu. Under Networking, click Network Load Balancers.

  2. Click the name of the network load balancer (NLB) or which you want to list existing listeners.
  3. Under Resources, click Listeners.
  4. Select the name of the NLB listener you want to delete.

  5. Under the Actions column, click the three-dots pull-down menu, and select Delete.

  6. Confirm the operation when prompted.

Using the OCI CLI

  1. Gather the information you need to run the command:

    • Compartment OCID (oci iam compartment list --compartment-id-in-subtree true)

    • NLB OCID (oci nlb network-load-balancer list --compartment-id compartment_OCID)

  2. Run the delete command.

    Syntax (entered on a single line):

    $ oci nlb listener delete --listener-name listener-name-text \
      --network-load-balancer-id ocid1.networkloadbalancer....….….….uniqueID 
    Are you sure you want to delete this resource? [y/N]: y

    Note:

    To delete the NLB listener without verification, run the command with the --force option.