Use photon-mgmtd
REST-APIs to manage, control, configure, and monitor services remotely.
You can use photon-mgmtd
to manage the following:
- Services
- System
- Network
- User, Group, Host
This the multi-page printable view of this section. Click here to print.
Use photon-mgmtd
REST-APIs to manage, control, configure, and monitor services remotely.
You can use photon-mgmtd
to manage the following:
To manage the available services and take actions on the services, execute a POST request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request POST --data '{"action":"{command}”,”unit”:”{unit}"}' http://localhost/api/v1/service/systemd
The following table lists the parameters:
Parameter | Description |
---|---|
Unit | The name of the service you want to manage. |
Action Commands | The action you want to take on the service. Start, stop, restart, try-restart, reload-or-restart, reload, enable, disable, mask, unnmask, kill |
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request POST --data '{"action":"start","unit":"nginx.service"}' http://localhost/api/v1/service/systemd
Response:
{
"success":true,
"message":"",
"errors":""
}
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request POST --data '{"action":"stop","unit":"nginx.service"}' http://localhost/api/v1/service/systemd
Response:
{
"success":true,
"message":"",
"errors":""
}
The systemctl list-unit-files
command lists all the services available in the system.
To fetch the list of services listed in the list-unit files, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/service/systemd/units
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/service/systemd/units
To receive the status details of a specific service, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/service/systemd/{unit}/status
The following table lists the parameter:
Parameter | Description |
---|---|
Unit | The name of the service for which you want to get the status. |
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost:5208/api/v1/service/systemd/nginx.service/status | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 514 100 514 0 0 38298 0 --:--:-- --:--:-- --:--:-- 39538
Response:
{
"success":true,
"message":{
"Property":"inactive",
"Unit":"nginx.service",
"Name":"nginx.service",
"Description":"Nginx High-performance HTTP server and reverse proxy",
"MainPid":0,
"LoadState":"loaded",
"ActiveState":"inactive",
"SubState":"dead",
"Followed":"",
"Path":"/org/freedesktop/systemd1/unit/nginx_2eservice",
"JobId":0,
"JobType":"",
"JobPath":"/",
"UnitFileState":"disabled",
"StateChangeTimestamp":0,
"InactiveExitTimestamp":0,
"ActiveEnterTimestamp":0,
"ActiveExitTimestamp":0,
"InactiveEnterTimestamp":0
},
"errors":""
}
To fetch the value of a specific property, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/service/systemd/manager/property/Version
The following table lists the parameter:
Parameter | Description |
---|---|
Property | Version, Features, Virtualization, Architecture, Tainted. |
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://127.0.0.1/api/v1/service/systemd/manager/property/Virtualization
Response:
{
"success":true,
"message":{
"property":"Virtualization",
"value":"vmware"
},
"errors":""
}
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://127.0.0.1/api/v1/service/systemd/manager/property/Architecture
Response:
{
"success":true,
"message":{
"property":"Architecture",
"value":"x86-64"
},
"errors":""
}
To fetch the property of a specific service, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/service/systemd/{unit}/property
The following table lists the parameter:
Parameter | Description |
---|---|
Unit | The name of the service for which you want to get the properties. |
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/service/systemd/nginx.service/property
To fetch all the properties of a service, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/service/systemd/{unit}/propertyall
The following table lists the parameter:
Parameter | Description |
---|---|
Unit | The name of the service for which you want to fetch the properties. |
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/service/systemd/nginx.service/propertyall | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 9652 0 9652 0 0 1058k 0 --:--:-- --:--:-- --:--:-- 1178k
To receive the configuration details, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/service/systemd/conf
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/service/systemd/conf
Response:
{
"success":true,
"message":{
"CPUAffinity":"",
"CapabilityBoundingSe":"",
"CrashChangeVT":"",
"CrashReboot":"",
"CrashShell":"",
"CtrlAltDelBurstAction":"",
"DefaultBlockIOAccounting":"",
"DefaultCPUAccounting":"",
"DefaultEnvironment":"",
"DefaultIOAccounting":"",
"DefaultIPAccounting":"",
"DefaultLimitAS":"",
"DefaultLimitCORE":"",
"DefaultLimitCPU":"",
"DefaultLimitDATA":"",
"DefaultLimitFSIZE":"",
"DefaultLimitLOCKS":"",
"DefaultLimitMEMLOCK":"",
"DefaultLimitMSGQUEUE":"",
"DefaultLimitNICE":"",
"DefaultLimitNOFILE":"",
"DefaultLimitNPROC":"",
"DefaultLimitRSS":"",
"DefaultLimitRTPRIO":"",
"DefaultLimitRTTIME":"",
"DefaultLimitSIGPENDING":"",
"DefaultLimitSTACK":"",
"DefaultMemoryAccounting":"",
"DefaultRestartSec":"",
"DefaultStandardError":"",
"DefaultStandardOutput":"",
"DefaultStartLimitBurst":"",
"DefaultStartLimitIntervalSec":"",
"DefaultTasksAccounting":"",
"DefaultTasksMax":"",
"DefaultTimeoutStartSec":"",
"DefaultTimeoutStopSec":"",
"DefaultTimerAccuracySec":"",
"DumpCore":"",
"IPAddressAllow":"",
"IPAddressDeny":"",
"JoinControllers":"",
"LogColor":"",
"LogLevel":"",
"LogLocation":"",
"LogTarget":"",
"RuntimeWatchdogSec":"",
"ShowStatus":"",
"ShutdownWatchdogSec":"",
"SystemCallArchitectures":"",
"TimerSlackNSec":""
},
"errors":""
}
To fetch the details about the configuration updates, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/service/systemd/conf/update
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/service/systemd/conf/update
Response:
{
"success":true,
"message":{
"CPUAffinity":"",
"CapabilityBoundingSe":"",
"CrashChangeVT":"",
"CrashReboot":"",
"CrashShell":"",
"CtrlAltDelBurstAction":"",
"DefaultBlockIOAccounting":"",
"DefaultCPUAccounting":"",
"DefaultEnvironment":"",
"DefaultIOAccounting":"",
"DefaultIPAccounting":"",
"DefaultLimitAS":"",
"DefaultLimitCORE":"",
"DefaultLimitCPU":"",
"DefaultLimitDATA":"",
"DefaultLimitFSIZE":"",
"DefaultLimitLOCKS":"",
"DefaultLimitMEMLOCK":"",
"DefaultLimitMSGQUEUE":"",
"DefaultLimitNICE":"",
"DefaultLimitNOFILE":"",
"DefaultLimitNPROC":"",
"DefaultLimitRSS":"",
"DefaultLimitRTPRIO":"",
"DefaultLimitRTTIME":"",
"DefaultLimitSIGPENDING":"",
"DefaultLimitSTACK":"",
"DefaultMemoryAccounting":"",
"DefaultRestartSec":"",
"DefaultStandardError":"",
"DefaultStandardOutput":"",
"DefaultStartLimitBurst":"",
"DefaultStartLimitIntervalSec":"",
"DefaultTasksAccounting":"",
"DefaultTasksMax":"",
"DefaultTimeoutStartSec":"",
"DefaultTimeoutStopSec":"",
"DefaultTimerAccuracySec":"",
"DumpCore":"",
"IPAddressAllow":"",
"IPAddressDeny":"",
"JoinControllers":"",
"LogColor":"",
"LogLevel":"",
"LogLocation":"",
"LogTarget":"",
"RuntimeWatchdogSec":"",
"ShowStatus":"",
"ShutdownWatchdogSec":"",
"SystemCallArchitectures":"",
"TimerSlackNSec":""
},
"errors":""
}
To fetch the complete system information, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET http://localhost/api/v1/system/describe
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET http://localhost/api/v1/system/describe | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 5588 0 5588 0 0 42133 0 --:--:-- --:--:-- --:--:-- 42015
To fetch information related to CPU, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/cpuinfo
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/cpuinfo
To fetch the usage details of the disk, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/diskusage
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/diskusage
Response:
{
"success":true,
"message":{
"path":"/",
"fstype":"ext2/ext3",
"total":269474643968,
"free":241944858624,
"used":13769904128,
"usedPercent":5.3848686637440935,
"inodesTotal":16777216,
"inodesUsed":101362,
"inodesFree":16675854,
"inodesUsedPercent":0.6041646003723145
},
"errors":""
}
To fetch the details about the platform and kernel versions on which the system is installed:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/version
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/version
Response:
{
"success":true,
"message":{
"hostname":"photon-4",
"uptime":10168492,
"bootTime":1627041016,
"procs":475,
"os":"linux",
"platform":"photon",
"platformFamily":"",
"platformVersion":"4.0",
"kernelVersion":"5.10.46-2.ph4",
"kernelArch":"x86_64",
"virtualizationSystem":"",
"virtualizationRole":"",
"hostId":"25a54d56-2249-524d-1355-e97b24e3415a"
},
"errors":""
}
To fetch miscellaneous harware details, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/misc
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/misc
Response:
{
"success":true,
"message":{
"175":"agpgart",
"183":"hw_random",
"228":"hpet",
"229":"fuse",
"231":"snapshot",
"235":"autofs",
"237":"loop-control",
"60":"vsock",
"61":"vmci",
"62":"cpu_dma_latency",
"63":"vga_arbiter"
},
"errors":""
}
To fetch the user details, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/userstat
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/userstat
To fetch the details of the virtual memory, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/virtualmemory
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/virtualmemory
Response:
{
"success":true,
"message":{
"total":16810287104,
"available":15859195904,
"used":519139328,
"usedPercent":3.0882240427438687,
"free":9925554176,
"active":4017090560,
"inactive":2234974208,
"wired":0,
"laundry":0,
"buffers":171372544,
"cached":6194221056,
"writeBack":0,
"dirty":0,
"writeBackTmp":0,
"shared":9539584,
"slab":440422400,
"sreclaimable":370315264,
"sunreclaim":70107136,
"pageTables":6144000,
"swapCached":0,
"commitLimit":8405143552,
"committedAS":1310273536,
"highTotal":0,
"highFree":0,
"lowTotal":0,
"lowFree":0,
"swapTotal":0,
"swapFree":0,
"mapped":126369792,
"vmallocTotal":35184372087808,
"vmallocUsed":46546944,
"vmallocChunk":0,
"hugePagesTotal":0,
"hugePagesFree":0,
"hugePageSize":2097152
},
"errors":""
}
To fetch the details about the kernel module, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/modules
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/modules
To fetch the network ARP details, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/net/arp
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/net/arp
Response:
{
"success":true,
"message":[
{
"IPAddress":"",
"HWType":"",
"Flags":"",
"HWAddress":"",
"Mask":"",
"Device":""
},
{
"IPAddress":"10.197.103.253",
"HWType":"0x1",
"Flags":"0x2",
"HWAddress":"00:00:0c:9f:f4:28",
"Mask":"*",
"Device":"eth0"
},
{
"IPAddress":"10.197.103.162",
"HWType":"0x1",
"Flags":"0x2",
"HWAddress":"00:0c:29:b1:e6:16",
"Mask":"*",
"Device":"eth0"
},
{
"IPAddress":"10.197.103.251",
"HWType":"0x1",
"Flags":"0x2",
"HWAddress":"00:35:1a:9d:b8:e3",
"Mask":"*",
"Device":"eth0"
},
{
"IPAddress":"10.197.103.174",
"HWType":"0x1",
"Flags":"0x2",
"HWAddress":"00:0c:29:d3:c7:00",
"Mask":"*",
"Device":"eth0"
},
{
"IPAddress":"10.197.103.252",
"HWType":"0x1",
"Flags":"0x2",
"HWAddress":"00:f2:8b:e1:b0:13",
"Mask":"*",
"Device":"eth0"
},
{
"IPAddress":"10.197.103.91",
"HWType":"0x1",
"Flags":"0x2",
"HWAddress":"00:0c:29:41:07:8b",
"Mask":"*",
"Device":"eth0"
}
],
"errors":""
}
To fetch the partition details, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/partitions
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/partitions
To fetch the details of the platform on which the system is installed, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/platform
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/platform
Respose:
{
"success":true,
"message":{
"Platform":"photon",
"Family":"",
"Version":"4.0"
},
"errors":""
}
To fetch the swap memory details, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/swapmemory
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/swapmemory
Response:
{
"success":true,
"message":{
"total":0,
"used":0,
"free":0,
"usedPercent":0,
"sin":0,
"sout":0,
"pgIn":0,
"pgOut":0,
"pgFault":0,
"pgMajFault":0
},
"errors":""
}
To fetch the input/output (read/write) details of all the disk partition, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/iocounters
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/proc/iocounters
Response:
{
"success":true,
"message":{
"loop0":{
"readCount":16407,
"mergedReadCount":0,
"writeCount":0,
"mergedWriteCount":0,
"readBytes":3999833088,
"writeBytes":0,
"readTime":6294,
"writeTime":0,
"iopsInProgress":0,
"ioTime":9088,
"weightedIO":6294,
"name":"loop0",
"serialNumber":"",
"label":""
},
"sda":{
"readCount":85357,
"mergedReadCount":13672,
"writeCount":212568,
"mergedWriteCount":783168,
"readBytes":5029398016,
"writeBytes":44981511680,
"readTime":54628,
"writeTime":17939082,
"iopsInProgress":0,
"ioTime":301572,
"weightedIO":17993710,
"name":"sda",
"serialNumber":"",
"label":""
},
"sda1":{
"readCount":351,
"mergedReadCount":0,
"writeCount":0,
"mergedWriteCount":0,
"readBytes":1437696,
"writeBytes":0,
"readTime":33,
"writeTime":0,
"iopsInProgress":0,
"ioTime":152,
"weightedIO":33,
"name":"sda1",
"serialNumber":"",
"label":""
},
"sda2":{
"readCount":128,
"mergedReadCount":23,
"writeCount":1,
"mergedWriteCount":0,
"readBytes":916480,
"writeBytes":512,
"readTime":38,
"writeTime":0,
"iopsInProgress":0,
"ioTime":56,
"weightedIO":38,
"name":"sda2",
"serialNumber":"",
"label":""
},
"sda3":{
"readCount":84806,
"mergedReadCount":13649,
"writeCount":212567,
"mergedWriteCount":783168,
"readBytes":5025352192,
"writeBytes":44981511168,
"readTime":54540,
"writeTime":17939082,
"iopsInProgress":0,
"ioTime":301444,
"weightedIO":17993623,
"name":"sda3",
"serialNumber":"",
"label":""
},
"sr0":{
"readCount":7,
"mergedReadCount":0,
"writeCount":0,
"mergedWriteCount":0,
"readBytes":1024,
"writeBytes":0,
"readTime":0,
"writeTime":0,
"iopsInProgress":0,
"ioTime":12,
"weightedIO":0,
"name":"sr0",
"serialNumber":"",
"label":""
}
},
"errors":""
}
pmctl
ToolYou can use the pmctl
tool to fetch the sysctl
configuration details. The following section lists the commands related to various use cases of sysctl
configuration.
To fetch all the sysctl
configuration details in the system, use the following command in the pmctl
tool:
pmctl status sysctl
To fetch a specific variable configuration in the sysctl
configuration, use the following command in the pmctl
tool:
pmctl status sysctl k <InputKey>
or
pmctl status sysctl key <InputKey>
Example:
>pmctl status sysctl k fs.file-max
fs.file-max: 9223372036854775807
To fetch all the variable configuration in the sysctl
configuration based on the input pattern, use the following command in the pmctl
tool:
pmctl status sysctl p <InputPatern>
or
pmctl status sysctl pattern <InputPatern>
Example:
pmctl status sysctl p net.ipv6.route.gc{
"net.ipv6.route.gc_elasticity":"9",
"net.ipv6.route.gc_interval":"30",
"net.ipv6.route.gc_min_interval":"0",
"net.ipv6.route.gc_min_interval_ms":"500",
"net.ipv6.route.gc_thresh":"1024",
"net.ipv6.route.gc_timeout":"60"
}
To add or Update a variable configuration in the sysctl
configuration, use the following command in the pmctl
tool.
pmctl sysctl u -k <InputKey> -v <InputValue> -f <InputFile>
or
pmctl sysctl update key <InputKey> value <InputValue> filename <InputFile>
Examples:
pmctl sysctl u -k fs.file-max -v 65566 -f 99-sysctl.conf
pmctl sysctl u -k fs.file-max -v 65566
To remove a variable configuration in the sysctl
configuration, use the following command in the pmctl
tool:
pmctl sysctl r -k <InputKey> -f <InputFile>
or
pmctl sysctl remove key <InputKey> filename <InputFile>
Examples:
pmctl sysctl r -k fs.file-max -f 99-sysctl.conf
pmctl sysctl r -k fs.file-max
To Load sysctl
configuration files, use the following command in the pmctl
tool:
pmctl sysctl l -f <InputfileList>
or
pmctl sysctl load files <InputFileList>
Examples:
pmctl sysctl l -f 99-sysctl.conf,70-sysctl.conf
pmctl sysctl l -f
To fetch the sysctl
configuration, execute a GET request in the following JSON format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET http://localhost/api/v1/system/sysctl/statusall
Example:
>curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET http://localhost/api/v1/system/sysctl/statusall
To fetch a specific variable configuration from sysctl
configuration, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET --data '{"key":"<keyName>"}' http://localhost/api/v1/system/sysctl/status
Example:
>curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET --data '{"key":"fs.file-max"}' http://localhost/api/v1/system/sysctl/status
To fetch all the variable configuration in sysctl
, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET --data '{"pattern":"<Pattern>"}' http://localhost/api/v1/system/sysctl/statuspattern
>curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET --data '{"pattern":"fs.file"}' http://localhost/api/v1/system/sysctl/statuspattern
To add or update a variable configuration in the sysctl
configuration, execute a POST request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request POST --data '{"apply":true,"key":"<keyName>","value":"<Value>","filename":"<fileName>"}' http://localhost/api/v1/system/sysctl/update
Example:
>curl --unix-socket /run/photon-mgmt/mgmt.sock --request POST --data '{"apply":true,"key":"fs.file-max","value":"65409","filename":"99-sysctl.conf"}' http://localhost/api/v1/system/sysctl/update
To remove a variable configuration from the sysctl
configuration, execute a DELETE request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request DELETE --data '{"apply":true,"key":"<keyName>","filename":"<fileName>"}' http://localhost/api/v1/system/sysctl/remove
Example:
>curl --unix-socket /run/photon-mgmt/mgmt.sock --request DELETE --data '{"apply":true,"key":"fs.file-max","filename":"99-sysctl.conf"}' http://localhost/api/v1/system/sysctl/remove
To load sysctl
configuration files, execute a POST request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request POST --data '{"apply":true,"files":["<fileName>","<fileName>"]}' http://localhost/api/v1/system/sysctl/load
Example:
>curl --unix-socket /run/photon-mgmt/mgmt.sock --request POST --data '{"apply":true,"files":["99-sysctl.conf","75-sysctl.conf"]}' http://localhost/api/v1/system/sysctl/load
To fetch complete network details, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET http://localhost/api/v1/network/describe | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 5238 0 5238 0 0 88919 0 --:--:-- --:--:-- --:--:-- 90310
Response:
{
"success":true,
"message":{
"NetworDescribe":{
"AddressState":"routable",
"CarrierState":"carrier",
"OperationalState":"routable",
"OnlineState":"",
"IPv4AddressState":"",
"IPv6AddressState":"",
"DNS":[
"10.142.7.1",
"10.132.7.1",
"10.166.17.90"
],
"Domains":null,
"RouteDomains":null,
"NTP":[
"10.128.152.81",
"10.166.1.120",
"10.188.26.119",
"10.84.55.42"
]
},
"LinksDescribe":{
"Interfaces":[
{
"AddressState":"off",
"AlternativeNames":null,
"CarrierState":"carrier",
"Driver":"",
"IPv4AddressState":"",
"IPv6AddressState":"",
"Index":1,
"LinkFile":"",
"Model":"",
"Name":"lo",
"OnlineState":"",
"OperationalState":"carrier",
"Path":"",
"SetupState":"unmanaged",
"Type":"loopback",
"Vendor":"",
"Manufacturer":""
},
{
"AddressState":"routable",
"AlternativeNames":null,
"CarrierState":"carrier",
"Driver":"vmxnet3",
"IPv4AddressState":"",
"IPv6AddressState":"",
"Index":2,
"LinkFile":"",
"Model":"VMXNET3 Ethernet Controller",
"Name":"eth0",
"OnlineState":"",
"OperationalState":"routable",
"Path":"pci-0000:0b:00.0",
"SetupState":"configured",
"Type":"ether",
"Vendor":"VMware",
"Manufacturer":"",
"NetworkFile":"/etc/systemd/network/99-dhcp-en.network"
}
]
},
"links":[
{
"Index":1,
"MTU":65536,
"TxQLen":1000,
"Name":"lo",
"AlternativeNames":"",
"HardwareAddr":"",
"Flags":"up|loopback",
"RawFlags":65609,
"ParentIndex":0,
"MasterIndex":0,
"Namespace":"",
"Alias":"",
"Statistics":{
"RxPackets":168,
"TxPackets":168,
"RxBytes":17146,
"TxBytes":17146,
"RxErrors":0,
"TxErrors":0,
"RxDropped":0,
"TxDropped":0,
"Multicast":0,
"Collisions":0,
"RxLengthErrors":0,
"RxOverErrors":0,
"RxCrcErrors":0,
"RxFrameErrors":0,
"RxFifoErrors":0,
"RxMissedErrors":0,
"TxAbortedErrors":0,
"TxCarrierErrors":0,
"TxFifoErrors":0,
"TxHeartbeatErrors":0,
"TxWindowErrors":0,
"RxCompressed":0,
"TxCompressed":0
},
"Promisc":0,
"Xdp":{
"Fd":0,
"Attached":false,
"Flags":0,
"ProgId":0
},
"EncapType":"loopback",
"Protinfo":"",
"OperState":"unknown",
"NetNsID":0,
"NumTxQueues":1,
"NumRxQueues":1,
"GSOMaxSize":65536,
"GSOMaxSegs":65535,
"Group":0,
"Slave":""
},
{
"Index":2,
"MTU":1500,
"TxQLen":1000,
"Name":"eth0",
"AlternativeNames":"",
"HardwareAddr":"00:0c:29:68:ed:d8",
"Flags":"up|broadcast|multicast",
"RawFlags":69699,
"ParentIndex":0,
"MasterIndex":0,
"Namespace":"",
"Alias":"",
"Statistics":{
"RxPackets":179491,
"TxPackets":25306,
"RxBytes":281174090,
"TxBytes":2339627,
"RxErrors":0,
"TxErrors":0,
"RxDropped":120,
"TxDropped":0,
"Multicast":0,
"Collisions":0,
"RxLengthErrors":0,
"RxOverErrors":0,
"RxCrcErrors":0,
"RxFrameErrors":0,
"RxFifoErrors":0,
"RxMissedErrors":0,
"TxAbortedErrors":0,
"TxCarrierErrors":0,
"TxFifoErrors":0,
"TxHeartbeatErrors":0,
"TxWindowErrors":0,
"RxCompressed":0,
"TxCompressed":0
},
"Promisc":0,
"Xdp":{
"Fd":0,
"Attached":false,
"Flags":0,
"ProgId":0
},
"EncapType":"ether",
"Protinfo":"",
"OperState":"up",
"NetNsID":0,
"NumTxQueues":8,
"NumRxQueues":8,
"GSOMaxSize":65536,
"GSOMaxSegs":65535,
"Group":0,
"Slave":""
}
],
"Addresses":[
{
"Name":"lo",
"Ifindex":1,
"OperState":"unknown",
"Mac":"",
"MTU":65536,
"Addresses":[
{
"IP":"127.0.0.1",
"Mask":8,
"Label":"lo",
"Flags":128,
"Scope":254,
"Peer":"",
"Broadcast":"",
"PreferedLft":4294967295,
"ValidLft":4294967295
},
{
"IP":"::1",
"Mask":128,
"Label":"",
"Flags":128,
"Scope":254,
"Peer":"",
"Broadcast":"",
"PreferedLft":4294967295,
"ValidLft":4294967295
}
]
},
{
"Name":"eth0",
"Ifindex":2,
"OperState":"up",
"Mac":"00:0c:29:68:ed:d8",
"MTU":1500,
"Addresses":[
{
"IP":"10.197.103.42",
"Mask":23,
"Label":"eth0",
"Flags":0,
"Scope":0,
"Peer":"",
"Broadcast":"10.197.103.255",
"PreferedLft":3927,
"ValidLft":3927
},
{
"IP":"fe80::20c:29ff:fe68:edd8",
"Mask":64,
"Label":"",
"Flags":128,
"Scope":253,
"Peer":"",
"Broadcast":"",
"PreferedLft":4294967295,
"ValidLft":4294967295
}
]
}
],
"Routes":[
{
"LinkName":"eth0",
"LinkIndex":2,
"ILinkIndex":0,
"Scope":0,
"Dst":{
"IP":"",
"Mask":0
},
"Src":"10.197.103.42",
"Gw":"10.197.103.253",
"MultiPath":"",
"Protocol":16,
"Priority":1024,
"Table":254,
"Type":1,
"Tos":0,
"Flags":null,
"MPLSDst":"",
"NewDst":"",
"Encap":"",
"MTU":0,
"AdvMSS":0,
"Hoplimit":0
},
{
"LinkName":"eth0",
"LinkIndex":2,
"ILinkIndex":0,
"Scope":253,
"Dst":{
"IP":"10.197.102.0",
"Mask":23
},
"Src":"10.197.103.42",
"Gw":"",
"MultiPath":"",
"Protocol":2,
"Priority":0,
"Table":254,
"Type":1,
"Tos":0,
"Flags":null,
"MPLSDst":"",
"NewDst":"",
"Encap":"",
"MTU":0,
"AdvMSS":0,
"Hoplimit":0
},
{
"LinkName":"eth0",
"LinkIndex":2,
"ILinkIndex":0,
"Scope":253,
"Dst":{
"IP":"10.197.103.253",
"Mask":32
},
"Src":"10.197.103.42",
"Gw":"",
"MultiPath":"",
"Protocol":16,
"Priority":1024,
"Table":254,
"Type":1,
"Tos":0,
"Flags":null,
"MPLSDst":"",
"NewDst":"",
"Encap":"",
"MTU":0,
"AdvMSS":0,
"Hoplimit":0
},
{
"LinkName":"lo",
"LinkIndex":1,
"ILinkIndex":0,
"Scope":0,
"Dst":{
"IP":"::1",
"Mask":128
},
"Src":"",
"Gw":"",
"MultiPath":"",
"Protocol":2,
"Priority":256,
"Table":254,
"Type":1,
"Tos":0,
"Flags":null,
"MPLSDst":"",
"NewDst":"",
"Encap":"",
"MTU":0,
"AdvMSS":0,
"Hoplimit":0
},
{
"LinkName":"eth0",
"LinkIndex":2,
"ILinkIndex":0,
"Scope":0,
"Dst":{
"IP":"fe80::",
"Mask":64
},
"Src":"",
"Gw":"",
"MultiPath":"",
"Protocol":2,
"Priority":256,
"Table":254,
"Type":1,
"Tos":0,
"Flags":null,
"MPLSDst":"",
"NewDst":"",
"Encap":"",
"MTU":0,
"AdvMSS":0,
"Hoplimit":0
}
],
"Dns":[
{
"Link":"eth0",
"Family":2,
"Dns":"10.142.7.1"
},
{
"Link":"eth0",
"Family":2,
"Dns":"10.132.7.1"
},
{
"Link":"eth0",
"Family":2,
"Dns":"10.166.17.90"
}
],
"Domains":null,
"NTP":{
"ServerName":"",
"Family":0,
"ServerAddress":"",
"SystemNTPServers":null,
"LinkNTPServers":[
"10.128.152.81",
"10.166.1.120",
"10.188.26.119",
"10.84.55.42"
]
}
},
"errors":""
}
To fetch the route details, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/network/netlink/route
Example:
root@photon [ ~/4.0/photon ]# curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/network/netlink/route | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1407 100 1407 0 0 996k 0 --:--:-- --:--:-- --:--:-- 1374k
Response:
{
"success":true,
"message":[
{
"LinkName":"eth0",
"LinkIndex":2,
"ILinkIndex":0,
"Scope":0,
"Dst":{
"IP":"",
"Mask":0
},
"Src":"10.197.103.42",
"Gw":"10.197.103.253",
"MultiPath":"",
"Protocol":16,
"Priority":1024,
"Table":254,
"Type":1,
"Tos":0,
"Flags":null,
"MPLSDst":"",
"NewDst":"",
"Encap":"",
"MTU":0,
"AdvMSS":0,
"Hoplimit":0
},
{
"LinkName":"eth0",
"LinkIndex":2,
"ILinkIndex":0,
"Scope":253,
"Dst":{
"IP":"10.197.102.0",
"Mask":23
},
"Src":"10.197.103.42",
"Gw":"",
"MultiPath":"",
"Protocol":2,
"Priority":0,
"Table":254,
"Type":1,
"Tos":0,
"Flags":null,
"MPLSDst":"",
"NewDst":"",
"Encap":"",
"MTU":0,
"AdvMSS":0,
"Hoplimit":0
},
{
"LinkName":"eth0",
"LinkIndex":2,
"ILinkIndex":0,
"Scope":253,
"Dst":{
"IP":"10.197.103.253",
"Mask":32
},
"Src":"10.197.103.42",
"Gw":"",
"MultiPath":"",
"Protocol":16,
"Priority":1024,
"Table":254,
"Type":1,
"Tos":0,
"Flags":null,
"MPLSDst":"",
"NewDst":"",
"Encap":"",
"MTU":0,
"AdvMSS":0,
"Hoplimit":0
},
{
"LinkName":"lo",
"LinkIndex":1,
"ILinkIndex":0,
"Scope":0,
"Dst":{
"IP":"::1",
"Mask":128
},
"Src":"",
"Gw":"",
"MultiPath":"",
"Protocol":2,
"Priority":256,
"Table":254,
"Type":1,
"Tos":0,
"Flags":null,
"MPLSDst":"",
"NewDst":"",
"Encap":"",
"MTU":0,
"AdvMSS":0,
"Hoplimit":0
},
{
"LinkName":"eth0",
"LinkIndex":2,
"ILinkIndex":0,
"Scope":0,
"Dst":{
"IP":"fe80::",
"Mask":64
},
"Src":"",
"Gw":"",
"MultiPath":"",
"Protocol":2,
"Priority":256,
"Table":254,
"Type":1,
"Tos":0,
"Flags":null,
"MPLSDst":"",
"NewDst":"",
"Encap":"",
"MTU":0,
"AdvMSS":0,
"Hoplimit":0
}
],
"errors":""
}
To fetch all the interfaces links details (such as interface, mac address, and transaction), execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/network/netlink/link
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock http://localhost/api/v1/network/netlink/link
Response:
{
"success":true,
"message":[
{
"Index":1,
"MTU":65536,
"TxQLen":1000,
"Name":"lo",
"AlternativeNames":"",
"HardwareAddr":"",
"Flags":"up|loopback",
"RawFlags":65609,
"ParentIndex":0,
"MasterIndex":0,
"Namespace":"",
"Alias":"",
"Statistics":{
"RxPackets":168,
"TxPackets":168,
"RxBytes":17146,
"TxBytes":17146,
"RxErrors":0,
"TxErrors":0,
"RxDropped":0,
"TxDropped":0,
"Multicast":0,
"Collisions":0,
"RxLengthErrors":0,
"RxOverErrors":0,
"RxCrcErrors":0,
"RxFrameErrors":0,
"RxFifoErrors":0,
"RxMissedErrors":0,
"TxAbortedErrors":0,
"TxCarrierErrors":0,
"TxFifoErrors":0,
"TxHeartbeatErrors":0,
"TxWindowErrors":0,
"RxCompressed":0,
"TxCompressed":0
},
"Promisc":0,
"Xdp":{
"Fd":0,
"Attached":false,
"Flags":0,
"ProgId":0
},
"EncapType":"loopback",
"Protinfo":"",
"OperState":"unknown",
"NetNsID":0,
"NumTxQueues":1,
"NumRxQueues":1,
"GSOMaxSize":65536,
"GSOMaxSegs":65535,
"Group":0,
"Slave":""
},
{
"Index":2,
"MTU":1500,
"TxQLen":1000,
"Name":"eth0",
"AlternativeNames":"",
"HardwareAddr":"00:0c:29:68:ed:d8",
"Flags":"up|broadcast|multicast",
"RawFlags":69699,
"ParentIndex":0,
"MasterIndex":0,
"Namespace":"",
"Alias":"",
"Statistics":{
"RxPackets":226492,
"TxPackets":25740,
"RxBytes":289546384,
"TxBytes":2689948,
"RxErrors":0,
"TxErrors":0,
"RxDropped":120,
"TxDropped":0,
"Multicast":0,
"Collisions":0,
"RxLengthErrors":0,
"RxOverErrors":0,
"RxCrcErrors":0,
"RxFrameErrors":0,
"RxFifoErrors":0,
"RxMissedErrors":0,
"TxAbortedErrors":0,
"TxCarrierErrors":0,
"TxFifoErrors":0,
"TxHeartbeatErrors":0,
"TxWindowErrors":0,
"RxCompressed":0,
"TxCompressed":0
},
"Promisc":0,
"Xdp":{
"Fd":0,
"Attached":false,
"Flags":0,
"ProgId":0
},
"EncapType":"ether",
"Protinfo":"",
"OperState":"up",
"NetNsID":0,
"NumTxQueues":8,
"NumRxQueues":8,
"GSOMaxSize":65536,
"GSOMaxSegs":65535,
"Group":0,
"Slave":""
}
],
"errors":""
}
To fetch the network DNS status, use the following command in pmctl
:
>pmctl status network dns
Global
DNS: 8.8.8.1 8.8.8.2
DNS Domains: test3.com test4.com . localdomain . localdomain
Link 2 (ens33)
Current DNS Server: 172.16.61.2
DNS Servers: 172.16.61.2
Link 3 (ens37)
Current DNS Server: 172.16.61.2
DNS Servers: 172.16.61.2
To fetch the network iostat status, use the following command in pmctl
:
> pmctl status network iostat
Name: lo
Packets received: 7510
Bytes received: 7510
Bytes sent: 7510
Drop in: 7510
Drop out: 0
Error in: 0
Error out: 0
Fifo in: 0
Fifo out: 0
Name: ens33
Packets received: 46014
Bytes received: 19072
Bytes sent: 19072
Drop in: 19072
Drop out: 0
Error in: 0
Error out: 0
Fifo in: 0
Fifo out: 0
Name: ens37
Packets received: 9682
Bytes received: 10779
Bytes sent: 10779
Drop in: 10779
Drop out: 0
Error in: 0
Error out: 0
Fifo in: 0
Fifo out: 0
To fetch the network status of the network interfaces, use the following command in pmctl
:
> pmctl status network interfaces
Name: lo
Index: 1
MTU: 65536
Flags: up loopback
Hardware Address:
Addresses: 127.0.0.1/8 ::1/128
Name: ens33
Index: 2
MTU: 1500
Flags: up broadcast multicast
Hardware Address: 00:0c:29:7c:6f:84
Addresses: 172.16.61.128/24 fe80::c099:2598:cc4c:14d1/64
Name: ens37
Index: 3
MTU: 1500
Flags: up broadcast multicast
Hardware Address: 00:0c:29:7c:6f:8e
Addresses: 172.16.61.134/24 fe80::be9:7746:7729:3e2/64
You can configure the network links using pmctl
command. The following section lists the commands you can use to configure network links.
pmctl network set-dhcp <deviceName> <DHCPMode>
Example:
>pmctl network set-dhcp ens37 ipv4
pmctl network set-link-local-addr <deviceName> <linkLocalAddressingMode>
Example:
>pmctl network set-link-local-addr ens37 ipv4
pmctl network set-multicast-dns <deviceName> <MulticastDNSMode>
Example:
>pmctl network set-multicast-dns ens37 resolve
pmctl network add-link-address <deviceName> address <Address> peer <Address> label <labelValue> scope <scopeValue>
Example:
>pmctl network add-link-address ens37 address 192.168.0.15/24 peer 192.168.10.10/24 label ipv4 scope link
pmctl network add-route dev <deviceName> gw <Gateway> gwonlink <GatewayOnlink> src <Source> dest <Destination> prefsrc <preferredSource> table <Table> scope <Scope>
Example:
>pmctl network add-route dev ens33 gw 192.168.1.0 gwonlink no src 192.168.1.15/24 dest 192.168.10.10/24 prefsrc 192.168.8.9 table 1234 scope link
pmctl network add-dns dev <deviceName> dns <dnslist>
Example:
>pmctl network add-dns dev ens37 dns 8.8.8.8,8.8.4.4,8.8.8.1,8.8.8.2
pmctl network add-domain dev <deviceName> domains <domainlist>
Example:
>pmctl network add-domain dev ens37 domains test1.com,test2.com,test3.com,test4.com
pmctl network add-ntp dev <deviceName> ntp <ntplist>
Example:
>pmctl network add-ntp dev ens37 ntp 198.162.1.15,test3.com
pmctl network set-ipv6-accept-ra <deviceName> <IPv6AcceptRA>
Example:
>pmctl network set-ipv6-accept-ra ens37 false
pmctl network set-link-mode dev <device> mode <unmanagedValue> arp <arpValue> mc <multicastValue> amc <allmulticastValue> pcs <PromiscuousValue> rfo <RequiredForOnline>
Example:
>pmctl network set-link-mode dev ens37 arp 1 mc no amc true pcs yes rfo on
pmctl network set-mtu <deviceName> <mtubytesValue>
Example:
>pmctl network set-mtu ens37 2048
pmctl network set-mac <deviceName> <MACAddress>
Example:
>pmctl network set-gmac ens37 00:a0:de:63:7a:e6
pmctl network set-group <deviceName> <groupValue>
Example:
>pmctl network set-group ens37 2147483647
pmctl network set-rf-online <deviceName> <familyValue>
Example:
>pmctl network set-rf-online ens37 ipv4
pmctl network set-active-policy <deviceName> <policyValue>
Example:
>pmctl network set-active-policy ens37 always-up
pmctl network add-rule dev <deviceName> tos <TypeOfService> from <Address> to <Address> fwmark <FirewallMark> table <Table> prio <Priority> iif <IncomingInterface> oif <OutgoingInterface> srcport <SourcePort> destport <DestinationPort> ipproto <IPProtocol> invertrule <InvertRule> family <Family> usr <User> suppressprefixlen <SuppressPrefixLength> suppressifgrp <SuppressInterfaceGroup> type <Type>
Example:
>pmctl network add-rule dev ens37 tos 12 from 192.168.1.10/24 to 192.168.2.20/24 fwmark 7/255 table 8 prio 3 iif ens37 oif ens37 srcport 8000-8080 destport 9876 ipproto 17 invertrule yes family ipv4 usr 1001 suppressprefixlen 128 suppressifgrp 2098 type prohibit
pmctl network delete-rule dev <deviceName> tos <TypeOfService> from <Address> to <Address> fwmark <FirewallMark> table <Table> prio <Priority> iif <IncomingInterface> oif <OutgoingInterface> srcport <SourcePort> destport <DestinationPort> ipproto <IPProtocol> invertrule <InvertRule> family <Family> usr <User> suppressprefixlen <SuppressPrefixLength> suppressifgrp <SuppressInterfaceGroup> type <Type>
Example:
>pmctl network delete-rule dev ens37 tos 12 from 192.168.1.10/24 to 192.168.2.20/24 fwmark 7/255 table 8 prio 3 iif ens37 oif ens37 srcport 8000-8080 destport 9876 ipproto 17 invertrule yes family ipv4 usr 1001 suppressprefixlen 128 suppressifgrp 2098 type prohibit
pmctl network set-dhcpv4-id dev <deviceName> clientid <ClientIdentifier> vendorclassid <VendorClassIdentifier> iaid <IAID>
Example:
>pmctl network set-dhcpv4-id dev ens37 clientid duid vendorclassid 101 iaid 201
pmctl network set-dhcpv4-duid dev <deviceName> duidtype <DUIDType> duidrawdata <DUIDRawData>
Example:
>pmctl network set-dhcpv4-duid dev ens37 duidtype vendor duidrawdata af:03:ff:87
pmctl network set-dhcpv4-use dev <deviceName> usedns <UseDNS> usentp <UseNTP> usesip <UseSIP> usemtu <UseMTU> usehostname <UseHostname> usedomains <UseDomains> useroutes <UseRoutes> usegateway <UseGateway> usetimezone <UseTimezone>
Example:
>pmctl network set-dhcpv4-use dev ens37 usedns false usentp false usesip false usemtu yes usehostname true usedomains yes useroutes no usegateway yes usetimezone no
pmctl network set-dhcpv6 dev <deviceName> mudurl <MUDURL> userclass <UserClass> vendorclass <VendorClass> prefixhint <IPV6ADDRESS> withoutra <WithoutRA>
Example:
>pmctl network set-dhcpv6 dev ens37 mudurl https://example.com/devB userclass usrcls1,usrcls2 vendorclass vdrcls1 prefixhint 2001:db1:fff::/64 withoutra solicit
pmctl network set-dhcpv6-id dev <deviceName> iaid <IAID> duidtype <DUIDType> duidrawdata <DUIDRawData>
Example:
>pmctl network set-dhcpv6-id dev ens37 iaid 201 duidtype vendor duidrawdata af:03:ff:87
pmctl network set-dhcpv6-use dev <deviceName> useaddr <UseAddress> useprefix <UsePrefix> usedns <UseDNS> usentp <UseNTP> usehostname <UseHostname> usedomains <UseDomains>
Example:
>pmctl network set-dhcpv6-use dev ens37 useaddr yes useprefix no usedns false usentp false usehostname true usedomains yes
pmctl network set-dhcpv6-option dev <deviceName> reqopt <RequestOptions> sendopt <SendOption> sendvendoropt <SendVendorOption>
Example:
>pmctl network set-dhcpv6-option dev ens37 reqopt 10,198,34 sendopt 34563 sendvendoropt 1987653,65,ipv6address,af:03:ff:87
pmctl network add-dhcpv4-server dev <Devicename> pool-offset <poolOffset> pool-size <PoolSize> default-lease-time-sec <DefaultLeaseTimeSec> max-lease-time-sec <MaxLeaseTimeSec> dns <DNS> emit-dns <EmitDNS> emit-ntp <EmitNTP> emit-router <EmitRouter>
Example:
>pmctl network add-dhcpv4-server dev ens37 pool-offset 100 pool-size 200 default-lease-time-sec 10 max-lease-time-sec 30 dns 192.168.1.2,192.168.10.10,192.168.20.30 emit-dns yes emit-ntp no emit-router yes
pmctl network remove-dhcpv4-server <Devicename>
Example:
>pmctl network remove-dhcpv4-server ens37
pmctl network add-ipv6ra dev <deviceName> rt-pref <RouterPreference> emit-dns <EmitDNS> dns <DNS> emit-domains <EmitDomains> domains <Domains> dns-lifetime-sec <DNSLifetimeSec> prefix <Prefix> pref-lifetime-sec <PreferredLifetimeSec> valid-lifetime-sec <ValidLifetimeSec> assign <Assign> route <Route> lifetime-sec <LifetimeSec>
Example:
>pmctl network add-ipv6ra dev ens37 rt-pref medium emit-dns yes dns 2002:da8:1::1,2002:da8:2::1 emit-domains yes domains test1.com,test2.com dns-lifetime-sec 100 prefix 2002:da8:1::/64 pref-lifetime-sec 100 valid-lifetime-sec 200 assign yes route 2001:db1:fff::/64 lifetime-sec 1000
pmctl network remove-ipv6ra <Devicename>
Example:
>pmctl network remove-ipv6ra ens37
pmctl
You can configure the network devices using pmctl
command. Use the following commands to configure network devices.
pmctl network create-vlan <vlanName> dev <device> id <vlanId>
Example:
>pmctl network create-vlan vlan1 dev ens37 id 101
pmctl network create-bond <bondName> dev <device> mode <modeType> thp <TransmitHashPolicyType> ltr <LACPTransmitRateType> mms <MIIMonitorSecTime>
Example:
>pmctl network create-bond bond1 dev ens37,ens38 mode 802.3ad thp layer2+3 ltr slow mms 1s
Example:
>pmctl network create-bond bond1 dev ens37,ens38
pmctl network create-bridge <bridgeName> dev <device list>
Example:
>pmctl network create-bridge br0 dev ens37,ens38
pmctl network create-macvlan <macvlanName> dev <device> mode <modeName>
Example:
>pmctl network create-macvlan macvlan1 dev ens37 mode private
pmctl network create-ipvlan <ipvlanName> dev <device> mode <modeName> flags <flagsName>
Example:
>pmctl network create-ipvlan ipvlan1 dev ens37 mode l2 flags vepa
Example:
>pmctl network create-ipvlan ipvlan1 dev ens38
pmctl network create-vxlan <vxlanName> dev <device> remote <RemoteAddress> local <LocalAddress> group <GroupAddress> destport <DestinationPort> independent <IndependentFlag>
Example:
>pmctl network create-vxlan vxlan1 dev ens37 vni 16777215 remote 192.168.1.3 local 192.168.1.2 group 192.168.0.0 destport 4789 independent no
pmctl network create-wg <wireguardName> dev <device> skey <privateKey> pkey<publicKey> endpoint <address:Port> port <listenport> ips <allowedIPs>
Example:
>pmctl network create-wg wg1 dev ens37 skey wCmc/74PQpRoxTgqGircVFtdArZFUFIiOoyQY8kVgmI= pkey dSanSzExlryduCwNnAFt+rzpI5fKeHuJx1xx2zxEG2Q= endpoint 10.217.69.88:51820 port 51822 ips fd31:bf08:57cb::/48,192.168.26.0/24
Example:
>pmctl network create-wg wg1 dev ens37 skey wCmc/74PQpRoxTgqGircVFtdArZFUFIiOoyQY8kVgmI= pkey dSanSzExlryduCwNnAFt+rzpI5fKeHuJx1xx2zxEG2Q= endpoint 10.217.69.88:51820
pmctl
To remove a network device, use the following command in pmctl
:
pmctl network remove-netdev <kindDeviceName> kind <kindType>
Example:
>pmctl network remove-netdev ipvlan1 dev ens37 kind ipvlan
Use the following commands to configure links using the pmctl
command.
pmctl link set-mac dev <deviceName> macpolicy <MACAddressPolicy> macaddr <MACAddress>
Example:
>pmctl link set-mac dev eth0 macpolicy none macaddr 00:a0:de:63:7a:e6
pmctl link set-name dev <deviceName> namepolicy <NamePolicy> name <Name>
Example:
>pmctl link set-name dev ens37 namepolicy mac,kernel,database,onboard,keep,slot,path
pmctl link set-name dev <deviceName> altnamespolicy <AlternativeNamesPolicy> altname <AlternativeName>
Example:
>pmctl link set-alt-name dev ens37 altnamespolicy mac,database,onboard,slot,path
pmctl link set-csum-offload dev <deviceName> rco <ReceiveCheksumOffload> tco <TransmitChecksumOffload>
Example:
>pmctl link set-csum-offload dev ens37 rxco true txco true
pmctl link set-tcp-offload dev <deviceName> tcpso <TCPSegmentationOffload> tcp6so <TCP6SegmentationOffload>
Example:
>pmctl link set-tcp-offload dev ens37 tcpso true tcp6so true
pmctl link set-generic-offload dev <deviceName> gso <GenericSegmentationOffload> gro <GenericReceiveOffload> grohw <GenericReceiveOffloadHardware> gsomaxbytes <GenericSegmentOffloadMaxBytes> gsomaxseg <GenericSegementOffloadMaxSegments>
Example:
>pmctl link set-generic-offload dev ens37 gso true gro true grohw false gsomaxbytes 65536 gsomaxseg 65535
pmctl link set-vlan-tags dev <deviceName> rxvlanctaghwacl <ReceiveVLANCTAGHardwareAcceleration> txvlanctaghwacl <TransmitVLANCTAGHardwareAcceleration> rxvlanctagfilter <ReceiveVLANCTAGFilter> txvlanstaghwacl <TransmitVLANSTAGHardwareAcceleration>
Example:
>pmctl link set-vlan-tags dev ens37 rxvlanctaghwacl true txvlanctaghwacl false rxvlanctagfilter true txvlanstaghwacl true
pmctl link set-channel dev <deviceName> rxch <RxChannels> txch <TxChannels> oth <OtherChannels> coch <CombinedChannels>
Example:
>pmctl link set-channel dev ens37 rxch 1024 txch 2045 och 45678 coch 32456
pmctl link set-buffer dev <deviceName> rxbufsz <RxBufferSize> rxmbufsz <RxMiniBufferSize> rxjbufsz <RxJumboBufferSize> txbufsz <TxBufferSize>
Example:
>pmctl link set-buffer dev ens37 rxbufsz 100009 rxmbufsz 1998 rxjbufsz 10999888 txbufsz 83724
pmctl link set-queue dev <deviceName> rxq <ReceiveQueues> txq <TransmitQueues> txqlen <TransmitQueueLength>
Example:
>pmctl link set-queue dev ens37 rxq 4096 txq 4096 txqlen 4294967294
pmctl link set-flow-ctrl dev <deviceName> rxfctrl <RxFlowControl> txfctrl <TxFlowControl> anfctrl <AutoNegotiationFlowControl>
Example:
>pmctl link set-flow-ctrl dev ens37 rxfctrl true txfctrl true anfctrl true
pmctl link set-adpt-coalesce dev <deviceName> uarxc <UseAdaptiveRxCoalesce> uatxc <UseAdaptiveTxCoalesce>
Example:
>pmctl link set-adpt-coalesce dev ens37 uarxc true uatxc true
pmctl link set-rx-coalesce dev <deviceName> rxcs <RxCoalesceSec> rxcsirq <RxCoalesceIrqSec> rxcslow <RxCoalesceLowSec> rxcshigh <RxCoalesceHighSec>
Example:
>pmctl link set-rx-coalesce dev ens37 rxcs 23 rxcsirq 56 rxcslow 5 rxcshigh 76788
pmctl link set-tx-coalesce dev <deviceName> txcs <TxCoalesceSec> txcsirq <TxCoalesceIrqSec> txcslow <TxCoalesceLowSec> txcshigh <TxCoalesceHighSec>
Example:
>pmctl link set-tx-coalesce dev ens37 txcs 23 txcsirq 56 txcslow 5 txcshigh 76788
pmctl link set-rx-coald-frames dev <deviceName> rxcmf <RxMaxCoalescedFrames> rxcmfirq <RxMaxCoalescedIrqFrames> rxcmflow <RxMaxCoalescedLowFrames> rxcmfhigh <RxMaxCoalescedHighFrames>
Example:
>pmctl link set-rx-coald-frames dev ens37 rxmcf 23 rxmcfirq 56 rxmcflow 5 rxmcfhigh 76788
pmctl link set-tx-coald-frames dev <deviceName> txcmf <TxMaxCoalescedFrames> txcmfirq <TxMaxCoalescedIrqFrames> txcmflow <TxMaxCoalescedLowFrames> txcmfhigh <TxMaxCoalescedHighFrames>
Example:
>pmctl link set-tx-coald-frames dev ens37 txmcf 23 txmcfirq 56 txmcflow 5 txmcfhigh 76788
pmctl link set-coalesce-pkt dev <deviceName> cprlow <CoalescePacketRateLow> cprhigh <CoalescePacketRateHigh> cprsis <CoalescePacketRateSampleIntervalSec>
Example:
>pmctl link set-coalesce-pkt dev ens37 cprlow 1000 cprhigh 32456 cprsis 102
You can configure links for Alias, Description, port, duplex, and so on.
pmctl link set-link dev ens37 alias <Alias> desc <Description> mtub <MTUBytes> bits <BitsPerSecond> duplex <Duplex> auton <AutoNegotiation> wol <WakeOnLan> wolpassd <WakeOnLanPassword> port <Port> advertise <Advertise> lrxo <LargeReceiveOffload> ntf <NTupleFilter> ssbcs <StatisticsBlockCoalesceSec>
Example:
>pmctl link set-link dev ens37 alias ifalias desc configdevice mtub 10M bits 5G duplex full auton no wol phy,unicast,broadcast,multicast,arp,magic,secureon wolpassd cb:a9:87:65:43:21 port mii advertise 10baset-half,10baset-full,20000basemld2-full lrxo true ntf true ssbcs 1024
To fetch the Ethtool Status, use the following command:
\#Get Ethtool all status
pmctl status ethtool <LINK>
Example:
>pmctl status ethtool ens37
\#Get Ethtool status based on action
pmctl status ethtool <LINK> <ACTION>
Example:
>pmctl status ethtool ens37 bus
To add a group, execute a POST request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request POST --data '{"Name":"photon","Gid":"1125"}' http://localhost/api/v1/system/group/add
The following table lists the parameter:
Parameter | Description |
---|---|
Gid | ID of the group that you want to add. |
Name | Name of the group that you want to add. |
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request POST --data '{"Name":"photon","Gid":"1125"}' http://localhost/api/v1/system/group/add
Response:
{
"success":true,
"message":"group added",
"errors":""
}
To add a user, execute a POST request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request POST --data '{"Name":"photon1"}' http://localhost/api/v1/system/user/add
The following table lists the parameter:
Parameter | Description |
---|---|
Name | Name of the user you want to add. |
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request POST --data '{"Name":"photon1"}' http://localhost/api/v1/system/user/add
To remove a group, execute a DELETE request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request DELETE --data '{"Name":"photon","Gid":"1125"}' http://localhost/api/v1/system/group/remove
The following table lists the parameters:
Parameter | Description |
---|---|
Name | Name of the group you want to delete. |
Gid | ID of the group that you want to delete. |
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request DELETE --data '{"Name":"photon22"}' http://localhost/api/v1/system/group/remove
Response:
{
"success":true,
"message":"group removed",
"errors":""
}
To remove a user, execute a DELETE request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request DELETE --data '{"Name":"photon1"}' http://localhost/api/v1/system/user/remove
Response
{
"success":true,
"message":"user removed",
"errors":""
}
To modify the name of a group, execute a PUT request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request PUT --data '{"Name":"photon6","NewName":"photon33"}' http://localhost/api/v1/system/group/modify
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request PUT --data '{"Name":"photon6","NewName":"photon33"}' http://localhost/api/v1/system/group/modify
To fetch the details of the host, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET http://localhost/api/v1/system/hostname/describe
Example:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET http://localhost/api/v1/system/hostname/describe | jq % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 585 100 585 0 0 8374 0 --:--:-- --:--:-- --:--:-- 8478
You can use the pmctl
tool to get login details of users. The following section lists the commands you can use to get the user details.
To list all the logged in users, use the following command in the pmctl
tool:
>pmctl status login user
To list all the logged in sessions, use the following command in the pmctl
tool:
>pmctl status login session
To get the status of users based on user ID, use pmctl
command in the following format:
pmctl status login user <UID>
Example:
>pmctl status login user 2
To get the status of logged in sessions based on the users ID, use the pmctl
command in the following format:
pmctl status login session <ID>
Example:
>pmctl status login session 1000
pmctl
toolYou can get the group details using commands in pmctl
tools. The following section lists the commands you can use in the pmctl
tool to get various group details.
To fetch all the group details, use the following command in the the pmctl
tool.
>pmctl status group
Gid: 0
Name: root
Gid: 1
Name: daemon
Gid: 2
Name: bin
Gid: 3
Name: sys
Gid: 4
Name: adm
.
.
.
Gid: 1001
Name: photon-mgmt
To fetch specific group details, use the following commands in the pmctl
tool:
pmctl status group <GroupName>
or
pmctl status group <GroupName>
Example:
>pmctl status group photon-mgmt
Gid: 1001
Name: photon-mgmt
To add a new group, use the following command in the pmctl
tool:
pmctl group add <GroupName> <Gid>
or
pmctl group add <GroupName>
To remove a group, us the followong command in the omctl
tool:
pmctl group remove <GroupName> <Gid>
or
pmctl group remove <GroupName>
The following section list the cURL commands that you can use to fetch the groups details.
To fetch the group details, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET http://localhost/api/v1/system/group/view
To fetch a specific group details, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET http://localhost/api/v1/system/group/view/<GroupName>
pmctl
ToolYou can use the pmctl
tool to get the user details. The following section lists the commands to get the user details.
To get all the user details, use the following command in the pmctl
tool:
>pmctl status user
User Name: root
Uid: 0
Gid: 0
GECOS: root
Home Directory: /root
User Name: daemon
Uid: 1
Gid: 1
GECOS: daemon
Home Directory: /usr/sbin
User Name: bin
Uid: 2
Gid: 2
GECOS: bin
Home Directory: /bin
User Name: sys
Uid: 3
Gid: 3
GECOS: sys
Home Directory: /dev
User Name: photon-mgmt
Uid: 1001
Gid: 1001
Home Directory: /home/photon-mgmt
To add a new user, use the following command in the pmctl
tool:
pmctl user add <UserName> home-dir <HomeDir> groups <groupsList> uid <Uid> gid <Gid> shell <Shell> password <xxxxxxx>
or
pmctl user a <UserName> -d <HomeDir> -grp <groupsList> -u <Uid> -g <Gid> -s <Shell> -p <xxxxxxx>
To remove a user, use the following command in the pmctl
tool:
pmctl user remove <UserName>
or
pmctl user r <UserName>
To fetch user details, execute a GET request in the following format:
curl --unix-socket /run/photon-mgmt/mgmt.sock --request GET http://localhost/api/v1/system/user/view
You can use the pmctl
commands to manage the available packages and perform various actions on the packages. The following section lists the pmctl
commands for various services related to package management.
To list all the packages, use the following command in pmctl
:
pmctl pkg list
Example:
>pmctl pkg list
To list a specific package, use the following command in pmctl
:
pmctl pkg list <pkg>
Example:
>pmctl pkg list lsof
To get the details of a specific package, use the following command in pmctl
:
pmctl pkg info <pkg>
Example:
pmctl pkg info lsof
To download the package metadata, use the following command in pmctl
:
pmctl pkg makecache
Example:
>pmctl pkg makecache
To clean the package cache, use the following command in pmctl
:
pmctl pkg clean
Example:
>pmctl pkg clean
To list the repositories, use the following command in pmctl
:
pmctl pkg repolist
Example:
pmctl pkg repolist
To search a specific package, use the following command in pmctl
:
pmctl pkg search <pattern>
Example:
pmctl pkg search lsof
To get the update details of the packages, use the following commands in pmctl
:
> pmctl pkg updateinfo
> pmctl pkg updateinfo --list
> pmctl pkg updateinfo --info
To install a specific package, use the following command in pmctl
:
pmctl pkg install <pkg>
Example:
>pmctl install lsof
To update a specific package, use the following command in pmctl
:
pmctl pkg update <pkg>
Example:
pmctl pkg update lsof
To remove a specific package, use the following command in pmctl
:
pmctl pkg remove <pkg>
Example:
pmctl pkg remove lsof
To update all the packages, use th following command in pmctl
:
pmctl pkg update
Example:
pmctl pkg update
In pmctl
, run commands in the following format to use other common options:
> pmctl pkg [--allowerasing][--best][--cacheonly][--config=<file>][--disablerepo=<pattern>[,..]]
[--disableexcludes][--downloaddir=<dir>][--downloadonly][--enablerepo=<pattern>[,..]]
[--exclude=<pkg>][--installroot=<dir>][--noautoremove][--nogpgcheck][--noplugins]
[--rebootrequired][--refresh][--releaserver=<release>][--repoid=<repo>]
[--repofrompath=<repo>,<dir>][--security][--secseverity=<sev>][--setopt=<key=value>[,..]]
[--skipconflicts][--skipdigest][--skipobsletes][--skipsignature]
pmctl pkg --repoid=photon-debuginfo list lsof*
Use pmctl
command to manage the firewall nftables. The following section lists the command that you can use to manage the nftables.
To add an nftable, use the following command in pmctl
:
pmctl network add-nft-table name <TABLE> family <FAMILY>
Example:
>pmctl network add-nft-table name test99 family inet
To delete an nftable, use the following command in pmctl
:
pmctl network delete-nft-table name <TABLE> family <FAMILY>
Example:
>pmctl network delete-nft-table name test99 family inet
To show an nftable, use the following command in pmctl
:
pmctl network show-nft-table name <TABLE> family <FAMILY>
Example:
>pmctl network show-nft-table name test99 family inet
To show all the nftables, use the following command in pmctl
:
>pmctl network show-nft-table
To add an nftable chain, use the following command in pmctl
:
pmctl network add-nft-chain name <CHAIN> table <TABLE> family <FAMILY> hook <HOOK> priority <PRIORITY> type <TYPE> policy <POLICY>
Example:
>pmctl network add-nft-chain name chain1 table test99 family inet hook input priority 300 type filter policy drop
To delete an nftable chain, use the following command in pmctl
:
pmctl network delete-nft-chain name <CHAIN> table <TABLE> family <FAMILY>
Example:
>pmctl network delete-nft-chain name chain1 table test99 family inet
To show an nftable chain, use the following command in pmctl
:
pmctl network show-nft-chain name <CHAIN> table <TABLE> family <FAMILY>
Example:
>pmctl network show-nft-chain name chain1 table test99 family inet
To show all nftable chains, use the following command in pmctl
:
>pmctl network show-nft-chain
To save all nftables, use the following command in pmctl
:
>pmctl network nft-save
To run the nftables command, use the following command in pmctl
:
pmctl network nft-run <COMMAND>
Examples:
>pmctl network nft-run nft add table inet test99
>pmctl network nft-run nft add chain inet test99 my_chain '{ type filter hook input priority 0; }'
>pmctl network nft-run nft add rule inet test99 my_chain tcp dport {telnet, http, https} accept
>pmctl network nft-run nft delete rule inet test99 my_chain handle 3
>pmctl network nft-run nft delete chain inet test99 my_chain
>pmctl network nft-run nft delete table inet test99
To get the status of the network device property, use the following command in pmctl
:
pmctl status proc net path <PATH> property <PROPERTY>
Example:
pmctl status proc net path ipv6 property calipso_cache_bucket_size
Response:
Path: ipv6
Property: calipso_cache_bucket_size
Value: 10
To get the network device property configuration details, use the following command in pmctl
:
pmctl proc net path <PATH> property <PROPERTY> value <VALUE>
Example:
>pmctl proc net path ipv6 property calipso_cache_bucket_size value 12
To get the status of the network device link, use the following command in pmctl
:
pmctl status proc net path <PATH> dev <LINK> property <PROPERTY>
Example:
>pmctl status proc net path ipv6 dev ens37 property mtu
Response:
Path: ipv6
Link: ens37
Property: mtu
Value: 1300
To get the configuration details of the network device link, use the following command in pmctl
:
pmctl proc net path <PATH> dev <LINK> property <PROPERTY> value <VALUE>
Example:
>pmctl proc net path ipv6 dev ens37 property mtu value 1500
To get the property status of the virtual machine, use the following command in pmctl
:
pmctl status proc vm <PROPERTY>
Example:
>pmctl status proc vm page-cluster
Response:
Property: page-cluster
Value: 3
To get the property configuration details, use the following command in pmctl
:
pmctl proc vm <PROPERTY> <VALUE>
Example:
pmctl proc vm page-cluster 5
To get system property details, use the following command in pmctl
:
pmctl status proc system <PROPERTY>
Example:
>pmctl status proc system cpuinfo
To get the ARP status details, use the following command in pmctl
:
pmctl status proc arp
Example:
>pmctl status proc arp
Response:
IPAddress: 172.16.61.254
HWType: 0x1
Flags: 0x2
HWAddress: 00:50:56:f3:5d:48
Mask: *
Device: ens37
IPAddress: 172.16.61.254
HWType: 0x1
Flags: 0x2
HWAddress: 00:50:56:f3:5d:48
Mask: *
Device: ens33
IPAddress: 172.16.61.2
HWType: 0x1
Flags: 0x2
HWAddress: 00:50:56:f4:e7:22
Mask: *
Device: ens33
IPAddress: 172.16.61.2
HWType: 0x1
Flags: 0x2
HWAddress: 00:50:56:f4:e7:22
Mask: *
Device: ens37
To get the netstat details, use the following command in pmctl
:
pmctl status proc netstat <PROTOCOL>
Example:
>pmctl status proc netstat tcp
To get the process status details, use the following command in pmctl
:
pmctl status proc process <PID> <PROPERTY>
Example:
>pmctl status proc process 88157 pid-memory-percent
To get the protopidstat status details, use the following command in pmctl
:
pmctl status proc protopidstat <PID> <PROTOCOL>
Example:
>pmctl status proc protopidstat 89502 tcp