If the management interface is not available, as a system administrator, you can configure all network settings by using the command-line interface of the VMware Cloud Director Availability appliance.

Caution: Only use the following net.py commands in case you cannot access the management interface.

You must not use any other command-line network configuration, for example: the ip command, VAMI scripts, must not manually modify configuration files, and other network settings. Do not automate or use in scripts the net.py commands.

You can run the following net.py commands in any order.

Prerequisites

  • Verify that the VMware Cloud Director Availability appliance is successfully deployed.
  • Verify that before running any of the following commands, you understand the general network configuration in VMware Cloud Director Availability. For more information, see Network settings configuration.

Procedure

  1. Connect to the VMware Cloud Director Availability by using a Secure Shell (SSH) client.
    1. Open an SSH connection to Appliance-IP-Address.
    2. Log in as the root user.
  2. To retrieve all available network adapters, run: /opt/vmware/h4/bin/net.py nics-status.
    $ /opt/vmware/h4/bin/net.py nics-status
    [
        {
            "addresses": [
                "fe80::250:56ff:fea9:7c8c/64"
            ],
            "configMode": "SLAAC_V6",
            "gateway": null,
            "mac": "00:50:56:a9:7c:8c",
            "mtu": 1500,
            "name": "ens192",
            "state": "degraded (configured)"
        },
        {
            "addresses": [
                "10.71.218.128/21"
            ],
            "configMode": "DHCP_V4",
            "gateway": "10.71.223.253",
            "mac": "00:50:56:a9:0e:65",
            "mtu": 1500,
            "name": "ens160",
            "state": "routable (configured)"
        }
    ]
  3. To retrieve the status of a specific network adapter, run: /opt/vmware/h4/bin/net.py nic-status <adapter-name>.
    $ /opt/vmware/h4/bin/net.py nic-status ens160
    {
        "addresses": [
            "10.71.218.128/21"
        ],
        "configMode": "DHCP_V4",
        "gateway": "10.71.223.253",
        "mac": "00:50:56:a9:0e:65",
        "mtu": 1500,
        "name": "ens160",
        "state": "routable (configured)"
    }
  4. To turn off a specific network adapter and delete all its settings, including static routes, run: /opt/vmware/h4/bin/net.py unconfigure-nic <adapter-name>.
    $ /opt/vmware/h4/bin/net.py unconfigure-nic ens192
    {
        "addresses": [],
        "configMode": "UNCONFIGURED",
        "gateway": null,
        "mac": "00:50:56:a9:7c:8c",
        "mtu": 1500,
        "name": "ens192",
        "state": "off (unmanaged)"
    }
  5. To configure a specific network adapter to use DHCPv4, run: /opt/vmware/h4/bin/net.py configure-nic <adapter-name> --dhcp4.

    The command configures the network adapter and exits instantly, although in the background the network settings are received and handled asynchronously.

    $ /opt/vmware/h4/bin/net.py configure-nic ens192 --dhcp4
    {
        "addresses": [],
        "configMode": "DHCP_V4",
        "gateway": null,
        "mac": "00:50:56:a9:7c:8c",
        "mtu": 1500,
        "name": "ens192",
        "state": "carrier (configuring)"
    }
  6. To configure a specific network adapter to use DHCPv6, run: /opt/vmware/h4/bin/net.py configure-nic <adapter-name> --dhcp6.

    The command configures the network adapter and exits instantly, although in the background the network settings are received and handled asynchronously.

    $ /opt/vmware/h4/bin/net.py configure-nic ens192 --dhcp6
    {
        "addresses": [],
        "configMode": "DHCP_V6",
        "gateway": null,
        "mac": "00:50:56:a9:7c:8c",
        "mtu": 1500,
        "name": "ens192",
        "state": "no-carrier (configuring)"
    }
  7. To configure a specific network adapter to use SLAAC, run: /opt/vmware/h4/bin/net.py configure-nic <adapter-name> --slaac.

    The command configures the network adapter and exits instantly, although in the background the network settings are received and handled asynchronously.

    $ /opt/vmware/h4/bin/net.py configure-nic ens192 --slaac
    {
        "addresses": [],
        "configMode": "SLAAC_V6",
        "gateway": null,
        "mac": "00:50:56:a9:7c:8c",
        "mtu": 1500,
        "name": "ens192",
        "state": "no-carrier (configuring)"
    }
  8. To configure a specific network adapter to use a static IP, run: /opt/vmware/h4/bin/net.py configure-nic <adapter-name> --static --address <CIDR> --gateway <IP> --mtu <MTU-bytes>.
    $ /opt/vmware/h4/bin/net.py configure-nic ens192 --static --address 172.16.0.2/18 --gateway 172.16.0.1 --mtu 1400
    {
        "addresses": [
            "172.16.0.2/18"
        ],
        "configMode": "DHCP_V4",
        "gateway": "172.16.0.1",
        "mac": "00:50:56:a9:0e:65",
        "mtu": 1400,
        "name": "ens192",
        "state": "routable (configured)"
    }
  9. To see the manually configured static routes list for a specific network adapter, run: /opt/vmware/h4/bin/net.py list-routes <adapter-name>.
    $ /opt/vmware/h4/bin/net.py list-routes ens192                                                                    
    [
        {
            "destination": "1.2.3.4",
            "gateway": "5.6.7.8",
            "metric": 0
        },
        {
            "destination": "10.0.0.0/16",
            "gateway": "9.9.9.9",
            "metric": 0
        },
        {
            "destination": "40.40.40.40",
            "gateway": "50.50.50.50",
            "metric": 0
        }
    ]
  10. To add a static route to a specific network adapter, run: /opt/vmware/h4/bin/net.py add-route <adapter-name> <destination IP or subnet CIDR> <gateway> <optional-metric>.
    $ /opt/vmware/h4/bin/net.py add-route ens160 99.99.99.99 10.0.0.42
    [
        {
            "destination": "99.99.99.99",
            "gateway": "10.0.0.42",
            "metric": 0
        }
    ]
  11. To remove a static route from a specific network adapter, run: /opt/vmware/h4/bin/net.py remove-route <adapter-name> <destination IP or subnet CIDR> <gateway> <metric>.

    Ensure that the destination IP, gateway, and metric exactly match the rule to delete.

    $ /opt/vmware/h4/bin/net.py remove-route ens160 99.99.99.99 10.0.0.42
    []