.. _Managing Virtual Routers: Managing Virtual Routers ------------------------ .. _vinfra service compute router create: vinfra service compute router create ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Create a virtual router: :: usage: vinfra service compute router create [--external-gateway ] [--enable-snat | --disable-snat] [--fixed-ip ] [--internal-interface |] ``--external-gateway `` Specify a public network to be used as the router's external gateway (name or ID) ``--enable-snat`` Enable source NAT on the external gateway ``--disable-snat`` Disable source NAT on the external gateway ``--fixed-ip `` Desired IP on the external gateway ``--internal-interface |`` Specify an internal interface. This option can be used multiple times. - ``network``: name of a private virtual network. - ``ip-addr``: an unused IP address from the selected private network to assign to the interface; specify if the default gateway of the selected private network is in use. ```` Virtual router name Example: :: # vinfra service compute router create myrouter --external-gateway public \ --internal-interface private --enable-snat +-----------------------+--------------------------------------------------+ | Field | Value | +-----------------------+--------------------------------------------------+ | external_gateway_info | enable_snat: true | | | ip_addresses: | | | - 10.94.129.76 | | | network_id: 720e45bc-4225-49de-9346-26513d8d1262 | | id | b9d8b000-5d06-4768-9f65-2715250cda53 | | name | myrouter | | project_id | 894696133031439f8aaa7e4868dcbd4d | | routes | [] | | status | ACTIVE | +-----------------------+--------------------------------------------------+ This command creates a router ``myrouter`` between the public network ``public`` and the private network ``private`` with enabled SNAT on the external gateway. .. _vinfra service compute router list: vinfra service compute router list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ List virtual routers: :: usage: vinfra service compute router list Example: :: # vinfra service compute router list -c id -c external_gateway_info -c name -c status +---------------------+---------------------------------+----------+--------+ | id | external_gateway_info | name | status | +---------------------+---------------------------------+----------+--------+ | b9d8b000-5d06-<...> | enable_snat: true | myrouter | ACTIVE | | | ip_addresses: | | | | | - 10.94.129.76 | | | | | network_id: 720e45bc-4225-<...> | | | +---------------------+---------------------------------+----------+--------+ This command lists virtual routers used in the compute cluster. (The output is abridged to fit on page.) .. _vinfra service compute router show: vinfra service compute router show ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Display information about a virtual router: :: usage: vinfra service compute router show ```` Virtual router name Example: :: # vinfra service compute router show myrouter +-----------------------+--------------------------------------------------+ | Field | Value | +-----------------------+--------------------------------------------------+ | external_gateway_info | enable_snat: true | | | ip_addresses: | | | - 10.94.129.76 | | | network_id: 720e45bc-4225-49de-9346-26513d8d1262 | | id | b9d8b000-5d06-4768-9f65-2715250cda53 | | name | myrouter | | project_id | 894696133031439f8aaa7e4868dcbd4d | | routes | [] | | status | ACTIVE | +-----------------------+--------------------------------------------------+ This command shows the details of the virtual router ``myrouter``. .. _vinfra service compute router set: vinfra service compute router set ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Modify virtual router parameters: :: usage: vinfra service compute router set [--name ] [--external-gateway | --no-external-gateway] [--fixed-ip ] [--enable-snat | --disable-snat] [--route | --no-route] ``--name `` Virtual router name ``--external-gateway `` Specify a public network to be used as the router's external gateway (name or ID) ``--no-external-gateway`` Remove the external gateway from the router ``--enable-snat`` Enable source NAT on the external gateway ``--disable-snat`` Disable source NAT on the external gateway ``--fixed-ip `` Desired IP on the external gateway ``--route `` A static route for the router. This option can be used multiple times. - ``destination``: destination subnet range in CIDR notation. - ``nexthop``: next hop IP address from one of the networks that the router is connected to. ``--no-route`` Clear routes associated with the router ```` Virtual router name or ID Example: :: # vinfra service compute router set myrouter --disable-snat --external-gateway public +-----------------------+--------------------------------------------------+ | Field | Value | +-----------------------+--------------------------------------------------+ | external_gateway_info | enable_snat: false | | | ip_addresses: | | | - 10.94.129.76 | | | network_id: 720e45bc-4225-49de-9346-26513d8d1262 | | id | b9d8b000-5d06-4768-9f65-2715250cda53 | | name | myrouter | | project_id | 894696133031439f8aaa7e4868dcbd4d | | routes | [] | | status | ACTIVE | +-----------------------+--------------------------------------------------+ This command disables SNAT on the external gateway of the virtual router ``myrouter``. .. _vinfra service compute router iface add: vinfra service compute router iface add ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Add an interface to a virtual router: :: usage: vinfra service compute router iface add [--ip-address ] --interface router ``--ip-address `` IP address ``--interface `` Network name or ID ``router`` Virtual router name or ID Example: :: # vinfra service compute router iface add myrouter --interface private2 \ --ip-address 192.168.30.3 +--------------------------------------+-------------+-----------------+--------+ | network_id | is_external | ip_addresses | status | +--------------------------------------+-------------+-----------------+--------+ | 720e45bc-4225-49de-9346-26513d8d1262 | True | - 10.94.129.76 | ACTIVE | | e6f146ce-a6d0-48b2-9e4f-64a128ce97ae | False | - 192.168.128.1 | ACTIVE | | 86803e07-a6d7-4809-9566-1cbe4a89adfd | False | - 192.168.30.3 | DOWN | +--------------------------------------+-------------+-----------------+--------+ This command adds an interface from the virtual network ``private2`` to the virtual router ``myrouter`` with the IP address ``192.168.30.3``. .. _vinfra service compute router iface list: vinfra service compute router iface list ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ List router interfaces: :: usage: vinfra service compute router iface list router ``router`` Virtual router name or ID Example: :: # vinfra service compute router iface list myrouter +-------------------------------------------------+-------------+-----------------+--------+ | network_id | is_external | ip_addresses | status | +-------------------------------------------------+-------------+-----------------+--------+ | 720e45bc-4225-49de-9346-26513d8d1262 (public) | True | - 10.94.129.76 | ACTIVE | | e6f146ce-a6d0-48b2-9e4f-64a128ce97ae (private) | False | - 192.168.128.1 | ACTIVE | | 86803e07-a6d7-4809-9566-1cbe4a89adfd (private2) | False | - 192.168.30.3 | ACTIVE | +-------------------------------------------------+-------------+-----------------+--------+ This command lists interfaces of the virtual router ``myrouter``. .. _vinfra service compute router iface remove: vinfra service compute router iface remove ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Remove an interface from a virtual router: :: usage: vinfra service compute router iface remove --interface router ``--interface `` Network name or ID ``router`` Virtual router name or ID Example: :: # vinfra service compute router iface remove myrouter --interface private2 +--------------------------------------+-------------+-----------------+--------+ | network_id | is_external | ip_addresses | status | +--------------------------------------+-------------+-----------------+--------+ | 720e45bc-4225-49de-9346-26513d8d1262 | True | - 10.94.129.76 | ACTIVE | | e6f146ce-a6d0-48b2-9e4f-64a128ce97ae | False | - 192.168.128.1 | ACTIVE | +--------------------------------------+-------------+-----------------+--------+ This command removes the interface from the virtual network ``private2`` from the virtual router ``myrouter``. .. _vinfra service compute router delete: vinfra service compute router delete ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Delete a virtual router: :: usage: vinfra service compute router delete ```` Virtual router ID or name Example: :: # vinfra service compute router delete myrouter Operation successful This command deletes the virtual router ``myrouter``.