vinfra service compute router create
Create a virtual router:
usage: vinfra service compute router create [--external-gateway <network>]
[--enable-snat | --disable-snat]
[--fixed-ip <fixid-ip>]
[--internal-interface
<network=network,ip-addr=ip-addr> |
<network>] <router-name>
--external-gateway <network>- Specify a physical 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 <fixid-ip>- Desired IP on the external gateway
--internal-interface <network=network,ip-addr=ip-addr>|<network>-
Specify an internal interface. This option can be used multiple times.
network: name of a virtual network.ip-addr: an unused IP address from the selected virtual network to assign to the interface; specify if the default gateway of the selected virtual network is in use.
<router-name>- 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 physical network public and the virtual network private with enabled SNAT on the external gateway.