Managing Networks
Managing network resources and settings in Arvancloud Cloud Server.
Overview
The network commands provide tools for managing network resources, including private networks, floating IPs, ports, and PTR records. These commands let you configure and control network connectivity for your cloud infrastructure.
Alias: net
Commands
1. Listing Networks
Shows the list of all available networks, including public and private networks.
arvan iaas network list
Alias: ls
Flags:
--region,-r: filter by region code (such asir-central1)--az,-a: filter by data center (such asir-central1-a)
Example:
$ arvan iaas network list --az=ir-central1-a
Output:
ID NAME CIDR STATUS SERVERS AZ
net-2b3c4d5e-6789-01bc-def0-23456789 private-net-01 10.0.1.0/24 ACTIVE 3 ir-central1-a
net-3c4d5e6f-7890-12cd-ef01-34567890 app-network 10.0.2.0/24 ACTIVE 1 ir-central1-b
net-4d5e6f7g-8901-23de-f012-45678901 test-network 192.168.1.0/24 ACTIVE 0 ir-central1-c
2. Showing Network Details
Shows detailed information about a specific network.
arvan iaas network show <network-id>
Alias: sh
Arguments:
network-id(required): the network ID
Example:
$ arvan iaas network show net-1a2b3c4d-5678-90ab-cdef-12345678
Output:
NETWORK DETAILS:
ID: net-1a2b3c4d-5678-90ab-cdef-12345678
Name: private-net-01
Status: ACTIVE
Created: 2024-01-15T10:30:00Z
Updated: 2024-02-01T14:20:00Z
Availability Zone: ir-central1-a
PRIVATE NETWORK/SUBNET DETAILS:
Subnet ID: sub-1a2b3c4d-5678-90ab-cdef-12345678
Name: private-net-01
CIDR: 10.0.1.0/24
Gateway: 10.0.1.1
DHCP: Enabled
DHCP IP: 10.0.1.2
IP Version: IPv4
DNS Servers:
• 8.8.8.8
• 8.8.4.4
Allocation Pools:
• 10.0.1.10 - 10.0.1.100
ATTACHED SERVERS:
Server: web-server-01 (srv-12345678)
Port 1:
IP Address: 10.0.1.15
MAC Address: fa:16:3e:aa:bb:cc
Port ID: port-1a2b3c4d
Port Security: Enabled
Security Groups: default, web-sg
3. Creating a Network
Creates a new private network with a subnet.
arvan iaas network create <network-name> --cidr <cidr> --az <az>
Alias: cr
Arguments:
network-name(required): the name of the new network (positional argument)
Flags:
--cidr,-c: the network's CIDR range (required)--az,-a: the data center (required)--dhcp: enable DHCP (requires the--poolflag)--pool,-p: IP allocation pools, asstart-end, orstart1-end1,start2-end2for multiple ranges (required if DHCP is enabled)--gateway,-g: the gateway IP, or the valuesenableordisable--dns: a comma-separated list of DNS servers--description,-d: the network description--force,-f: skip confirmation
Example:
# Basic network creation
$ arvan iaas network create my-network --cidr 192.168.1.0/24 --az ir-central1-a
# Network with DHCP and allocation pools
$ arvan iaas network create dhcp-net --cidr 10.0.0.0/24 --az ir-central1-a --dhcp --pool "10.0.0.10-10.0.0.100"
# Network with multiple allocation pools
$ arvan iaas network create app-net --cidr 10.1.0.0/24 --az ir-central1-a --dhcp --pool "10.1.0.10-10.1.0.50,10.1.0.100-10.1.0.200"
# Network with all options
$ arvan iaas network create web-net --cidr 172.16.0.0/24 --az ir-central1-a \
--gateway 172.16.0.1 --dns "8.8.8.8,8.8.4.4" --description "Production web network"
Output:
CREATE NETWORK:
Name: my-network
CIDR: 192.168.1.0/24
Availability Zone: ir-central1-a
DHCP: true
Allocation Pools: 10.0.0.10-10.0.0.100
Gateway: 10.0.0.1
DNS Servers: 8.8.8.8,8.8.4.4
Create network 'my-network'? (y/n) y
Network 'my-network' has been created successfully.
Notes:
- Network and subnet: creating a network automatically creates a subnet with the same settings. This happens transparently for the user.
- DHCP and allocation pools:
- When you use the
--dhcpflag, DHCP is enabled and the--poolflag becomes required. - If you don't use the
--dhcpflag, DHCP is disabled and you can't use the--poolflag. - The IPs defined in the allocation pool must be within the specified CIDR range.
- When you use the
- Gateway options:
- IP address: sets a specific IP for the gateway (example:
192.168.1.1). enable: enables the gateway (the server assigns an IP automatically).disable: disables the gateway completely.
- IP address: sets a specific IP for the gateway (example:
- DNS servers: the server list must be comma-separated values of valid IPs.
- Availability Zones: entering a valid data center code (such as
ir-central1-aorir-central1-b) is required.
4. Deleting a Network
Deletes a private network.
arvan iaas network delete <network-id>
Alias: del
Arguments:
network-id(required): the ID of the network to delete
Flags:
--force,-f: skip confirmation
Example:
$ arvan iaas network delete net-12345678-1234-1234-1234-123456789abc
Output:
NETWORK TO DELETE:
ID: net-12345678-1234-1234-1234-123456789abc
Name: test-network
Status: ACTIVE
AZ: ir-central1-a
Are you sure you want to delete network 'test-network'? (y/n) y
Network 'test-network' has been deleted.
Before deleting the network, make sure all servers have been detached from it. This operation can't be undone, and the attached subnet is also deleted.
5. Attaching a Server to a Network
Attaches a server to a network.
arvan iaas network attach <server-id> --network <network-id>
Alias: att
Arguments:
server-id(required): the ID of the server to attach
Flags:
--network,-n: the destination network ID (required)--port-security,-p: port security setting:enableordisable(default:enable)--ip,-i: assign a specific fixed IP (optional)--force,-f: skip confirmation
Example:
$ arvan iaas network attach srv-12345678 --network net-1a2b3c4d
$ arvan iaas network attach srv-12345678 --network net-1a2b3c4d --port-security disable --ip 192.168.1.50
Output:
ATTACH SERVER TO NETWORK:
Server: web-server-01 (srv-12345678)
Network: private-net-01 (net-1a2b3c4d)
Subnet: private-net-01 (sub-1a2b3c4d)
Port Security: Enabled
AZ: ir-central1-a
Are you sure you want to attach server 'web-server-01' to network 'private-net-01'? (y/n) y
Server 'web-server-01' is being attached to network 'private-net-01'.
6. Detaching a Server from a Network
Detaches a server from a network using the port ID. The server and the network must be in the same data center.
arvan iaas network detach <server-id> <port-id>
Alias: dtt
Arguments:
server-id(required): the server IDport-id(required): the ID of the port to detach
Example:
$ arvan iaas network detach srv-12345678 port-1a2b3c4d
Output:
DETACH SERVER FROM NETWORK:
Server: web-server-01 (srv-12345678)
Port ID: port-1a2b3c4d
Network: private-net-01 (net-1a2b3c4d)
Region: Tehran
AZ: ir-central1-a
Are you sure you want to detach server 'web-server-01' from network 'private-net-01'? (y/n) y
Server 'web-server-01' is being detached from network 'private-net-01'.
7. Updating a Network
Changes the configuration of a private network.
arvan iaas network update <network-id>
Alias: up
Arguments:
network-id(required): the ID of the network to update
Flags:
--name,-n: a new name for the network--gateway,-g: the gateway IP,enable, ordisable--dhcp,-d: enable or disable DHCP--dns: the list of DNS servers--pool,-p: IP allocation pools
Example:
$ arvan iaas network update net-1a2b3c4d --name my-network --gateway 192.168.1.1
$ arvan iaas network update net-1a2b3c4d --gateway disable
$ arvan iaas network update net-1a2b3c4d --dhcp enable --dns "8.8.8.8,8.8.4.4"
$ arvan iaas network update net-1a2b3c4d --pool "192.168.1.10-192.168.1.100"
$ arvan iaas network update net-1a2b3c4d --pool "192.168.1.10-192.168.1.50,192.168.1.75-192.168.1.100"
Output:
UPDATE NETWORK:
Network: private-net-01 (net-1a2b3c4d)
Subnet: private-net-01 (sub-1a2b3c4d)
AZ: ir-central1-a
New Name: production-network
DNS Servers: 1.1.1.1,1.0.0.1
Are you sure you want to update network 'private-net-01'? (y/n) y
Network 'private-net-01' has been updated successfully.
8. Enabling Port Security
Enables port security on a specific network port.
arvan iaas network port-security-enable <port-id>
Alias: pse
Arguments:
port-id(required): the port ID
Flags:
--force,-f: skip confirmation
Example:
$ arvan iaas network port-security-enable port-1a2b3c4d
Output:
ENABLE PORT SECURITY
--------------------
Port ID: port-1a2b3c4d
Instance: web-server-01 (srv-12345678)
Network: net-1a2b3c4d
IP: 10.0.1.15
Mac: fa:16:3e:aa:bb:cc
Region: Tehran
Are you sure you want to enable port security on port 'port-1a2b3c4d'? (y/n) y
Port security has been enabled on port 'port-1a2b3c4d'.
9. Disabling Port Security
Disables port security on a network port.
arvan iaas network port-security-disable <port-id>
Alias: psd
Arguments:
port-id(required): the port ID
Example:
$ arvan iaas network port-security-disable port-1a2b3c4d
Output:
DISABLE PORT SECURITY
---------------------
Port ID: port-1a2b3c4d
Instance: web-server-01 (srv-12345678)
Network: net-1a2b3c4d
IP: 10.0.1.15
Mac: fa:16:3e:aa:bb:cc
Region: Tehran
Are you sure you want to disable port security on port 'port-1a2b3c4d'? (y/n) y
Port security has been disabled on port 'port-1a2b3c4d'.
10. Creating a PTR Record
Creates a PTR record (reverse DNS) for a public IP address. This record maps an IP address to a domain name. The region is detected automatically based on the IP address. Note that this record can only be created for public IPs, and adding a new record replaces the previous record for that IP.
arvan iaas network ptr-create <ip> <domain>
Arguments:
ip(required): the IP address for the PTR recorddomain(required): the domain name for the PTR record
Flags:
--force,-f: skip confirmation
Example:
$ arvan iaas network ptr-create 185.10.200.15 web.example.com
Output:
PTR RECORD TO CREATE
--------------------
IP: 185.10.200.15
Domain: web.example.com
Region: ir-central1-a
Are you sure you want to create PTR record? (y/n) y
PTR record created successfully!
The region is detected automatically based on the IP.
11. Deleting a PTR Record
Deletes an existing PTR record.
arvan iaas network ptr-delete <ip>
Arguments:
<ip>(required): the IP address of the record to delete
Flags:
--force,-f: skip confirmation
Example:
$ arvan iaas network ptr-delete 185.10.200.15
Output:
DELETE PTR RECORD
-----------------
IP: 185.10.200.15
Current PTR: web.example.com
Region: ir-thr-ba1-a
Are you sure you want to delete the PTR record for IP '185.10.200.15'? (y/n)
PTR record deleted successfully!
The region is detected automatically based on the IP.
12. Listing PTR Records
Shows all public IP addresses and their PTR records.
arvan iaas network ptr-list
Alias: ls-ptr
Flags:
--region,-r: filter by region code (such asir-central1)--az,-a: filter by data center (such asir-central1-a)
Example:
$ arvan iaas network ptr-list
$ arvan iaas network ls-ptr --region ir-central1
Output:
PUBLIC IP ADDRESSES
-------------------
┌────────────────────┬──────────────────┬─────────────────┬───────────────────┬──────────────┬──────────────────┬──────────────────┐
│ IP │ POINTER_RECORD │ SERVER_NAME │ MAC_ADDRESS │ GATEWAY │ SECURITY_GROUPS │ AZ │
├────────────────────┼──────────────────┼─────────────────┼───────────────────┼──────────────┼──────────────────┼──────────────────┤
│ 185.10.200.15 │ web.example.com │ web-server-01 │ fa:16:3e:xx:xx:xx │ 185.10.200.1 │ default │ ir-thr-ba1-a │
│ 185.10.200.20 │ - │ app-server-01 │ fa:16:3e:yy:yy:yy │ 185.10.200.1 │ default, http │ ir-thr-ba1-a │
└────────────────────┴──────────────────┴─────────────────┴───────────────────┴──────────────┴──────────────────┴──────────────────┘
13. Adding a Public IP
Assigns a public IP address to a server. The server's region is detected automatically. You can specify the firewall groups and the IP type (IPv4 or IPv6).
arvan iaas network public-ip-add <server-id>
Alias: piadd
Arguments:
server-id(required): the server ID
Flags:
--security-groups-ids,-s: a comma-separated list of firewall group IDs (optional, default: arDefault)--type,-t: the IP type, ipv4 or ipv6 (default: ipv4)
Example:
$ arvan iaas network public-ip-add abc123 --security-groups-ids sg-001,sg-002
$ arvan iaas network public-ip-add abc123 --security-groups-ids sg-001 --type ipv4
Output:
PUBLIC IP ADDED
---------------
Server ID: abc123
Server Name: web-server-01
Region: ir-central1-a
Security Groups: sg-001, sg-002
IP Type: ipv4
The region is detected automatically.
Floating IP Commands
Important notes:
- The private network must have a configured gateway address.
- Only servers without a public IP can be connected to a floating IP.
1. Listing Floating IPs
Shows the list of all floating IP addresses.
arvan iaas network float-ip list
Alias: fip ls
Flags:
--region,-r: filter by region code (such asir-central1)--az,-a: filter by data center (such asir-central1-a)
Example:
$ arvan iaas network float-ip list --az=ir-central1-a
Output:
ID IP_ADDRESS STATUS DESCRIPTION ATTACHED_TO AZ
fip-1a2b3c4d-5678-90ab-cdef-12345678 185.10.200.15 ACTIVE Web server IP web-server-01 ir-central1-a
fip-2b3c4d5e-6789-01bc-def0-23456789 185.10.200.16 DOWN - - ir-central1-a
fip-3c4d5e6f-7890-12cd-ef01-34567890 185.10.200.17 ACTIVE Database server IP db-server-01 ir-central1-b
2. Showing Floating IP Details
Shows detailed information about a specific floating IP.
arvan iaas network float-ip show <floating-ip-id>
Alias: fip sh
Arguments:
floating-ip-id(required): the floating IP ID
Example:
$ arvan iaas network float-ip show fip-1a2b3c4d-5678-90ab-cdef-12345678
Output:
FLOATING IP DETAILS:
ID: fip-1a2b3c4d-5678-90ab-cdef-12345678
IP Address: 185.10.200.15
Status: ACTIVE
Description: Web server public IP
Created At: 2024-01-15T10:30:00Z
AZ: ir-central1-a
CONNECTED SERVER:
Server Name: web-server-01
Server ID: srv-12345678-1234-1234-1234-123456789abc
Fixed IP: 10.0.1.10
Port ID: port-1a2b3c4d-5678-90ab
3. Creating a Floating IP
Creates a new floating IP address.
arvan iaas network float-ip create <description>
Alias: fip cr
Arguments:
description(required): a description for the floating IP
Flags:
--az,-a: the data center (required, such as ir-central1-a)
Example:
$ arvan iaas network float-ip create "Web server public IP" --az ir-central1-a
Output:
FLOATING IP CREATED
-------------------
ID: fip-4d5e6f7g-8901-23de-f012-456789012345
IP Address: 185.10.200.20
Description: Web server public IP
Status: DOWN
AZ: ir-central1-a
Floating IP created successfully!
4. Connecting a Floating IP
Connects a floating IP to a server's port.
arvan iaas network float-ip connect <server-id>
Alias: fip con
Arguments:
server-id(required): the destination server ID
Flags:
--port,-p: the ID of the port to connect to (required)--float-ip,-f: the floating IP ID (required)--force,-y: skip confirmation
Requirements:
- The server must not have a public IP.
- The server must be connected to a private network.
- The private network must have a gateway.
Example:
$ arvan iaas network float-ip connect srv-12345678 --port port-1a2b3c4d-5678-90ab --float-ip fip-1a2b3c4d
Output:
CONNECT FLOATING IP:
Floating IP: 185.10.200.15
Floating IP ID: fip-1a2b3c4d-5678-90ab-cdef-12345678
Server: web-server-01
Server ID: srv-12345678-1234-1234-1234-123456789abc
Port ID: port-1a2b3c4d-5678-90ab
Network: private-network-01
Subnet ID: subnet-12345678-1234-1234-1234-123456789abc
AZ: ir-central1-a
Are you sure you want to connect floating IP '185.10.200.15' to server 'web-server-01' port 'port-1a2b3c4d-5678-90ab'? (y/n) y
✓ Floating IP '185.10.200.15' is being connected to server 'web-server-01'.
5. Disconnecting a Floating IP
Disconnects a floating IP from a server.
arvan iaas network float-ip disconnect <floating-ip-id>
Alias: fip dis
Arguments:
floating-ip-id(required): the ID of the floating IP to disconnect
Flags:
--force,-y: skip confirmation
Example:
$ arvan iaas network float-ip disconnect fip-1a2b3c4d-5678-90ab-cdef-12345678
Output:
DISCONNECT FLOATING IP:
ID: fip-1a2b3c4d-5678-90ab-cdef-12345678
IP Address: 185.10.200.15
Status: ACTIVE
AZ: ir-central1-a
Server: web-server-01 (srv-12345678-1234-1234-1234-123456789abc)
Are you sure you want to disconnect floating IP '185.10.200.15'? (y/n) y
✓ Floating IP '185.10.200.15' is being disconnected.
6. Deleting a Floating IP
Deletes a floating IP address.
arvan iaas network float-ip delete <floating-ip-id>
Alias: fip del
Arguments:
floating-ip-id(required): the ID of the floating IP to delete
Flags:
--force,-f: skip confirmation
Example:
$ arvan iaas network float-ip delete fip-1a2b3c4d-5678-90ab-cdef-12345678
Output:
FLOATING IP TO DELETE:
ID: fip-1a2b3c4d-5678-90ab-cdef-12345678
IP Address: 185.10.200.15
Status: DOWN
AZ: ir-central1-a
Are you sure you want to delete floating IP '185.10.200.15'? (y/n) y
✓ Floating IP '185.10.200.15' has been deleted.
Command Reference
| Command | Alias | Description | Arguments |
|---|---|---|---|
network list | ls | List all networks | None |
network show | sh | Show the details of a network | <network-id> |
network create | cr | Create a new private network | <network-name> |
network delete | del | Delete a private network | <network-id> |
network attach | att | Attach a server to a network | <server-id> |
network detach | dtt | Detach a server from a network | <server-id> <port-id> |
network update | up | Update network settings | <network-id> |
network ptr-create | - | Create a PTR record | <ip> <domain> |
network ptr-delete | - | Delete a PTR record | <ip> |
network ptr-list | ls-ptr | List PTR records | None |
network public-ip-add | piadd | Add a public IP to a server | <server-id> |
network float-ip list | fip ls | List floating IPs | None |
network float-ip show | fip sh | Show the details of a floating IP | <floating-ip-id> |
network float-ip create | fip cr | Create a new floating IP | <description> |
network float-ip connect | fip con | Connect a floating IP to a server | <server-id> |
network float-ip disconnect | fip dis | Disconnect a floating IP | <floating-ip-id> |
network float-ip delete | fip del | Delete a floating IP | <floating-ip-id> |