Change-Id: Iaf8a2e23e276d0273010d344a27667561899cba7
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/4155
Reviewed-by: Sharath George
Tested-by: Sharath George
| ... | ... |
@@ -1,29 +1,21 @@ |
| 1 | 1 |
 |
| 2 | 2 |
|
| 3 |
-**Update - January 19th, 2017** |
|
| 4 |
-**Updated Photon OS 1.0 binaries are available.** |
|
| 5 |
-We've been busy updating RPMs in our repository for months, now, to address both functional and security issues. However, our binaries have remained fixed since their release back in September 2015. In order to make it faster and easier to get a up-to-date Photon OS system, we've repackaged all of our binaries to include all of these RPM updates. For clarity, we'll call these updated binaries, which are still backed by the 1.0 repos - **1.0, Revision 2**. |
|
| 3 |
+**Welcome to VMware Photon OS: Linux Container Host** |
|
| 4 |
+----------------------------------------------------- |
|
| 5 | ||
| 6 | 6 |
|
| 7 |
-We recommend downloading these newer images and building new systems from these refreshed binaries, so that new systems won't have as many initial package updates. |
|
| 7 |
+This repository is intended for developers who want to modify Photon and build their own customized ISO images or contribute to the code base. |
|
| 8 | 8 |
|
| 9 |
-You can find the updated links in the [Download Guide in the github wiki](https://github.com/vmware/photon/wiki/Downloading-Photon-OS). |
|
| 9 |
+**Photon OS 2.0 is here!** |
|
| 10 |
+-------------------------- |
|
| 11 |
+Photon OS 2.0 introduces new security and OS management capabilities, along with new and updated packages for Cloud native applications and VMware appliances. |
|
| 10 | 12 |
|
| 11 |
-**VMware Photon: Minimal Linux Container Host** |
|
| 13 |
+- For download instructions and links to Photon OS binaries, go to the [Download Guide in the github wiki](https://github.com/vmware/photon/wiki/Downloading-Photon-OS). |
|
| 14 |
+- For an overview of changes, see [What's New in Photon OS 2.0 in the github wiki](https://github.com/vmware/photon/wiki/What-is-New-in-Photon-OS-2.0). |
|
| 12 | 15 |
|
| 13 |
-Photon OS is a minimal Linux container host designed to have a small footprint and tuned for VMware platforms. Photon is intended to invite collaboration around running containerized applications in a virtualized environment. |
|
| 16 |
+**Photon OS Resources** |
|
| 17 |
+----------------------- |
|
| 14 | 18 |
|
| 15 |
-- Optimized for vSphere - Validated on and tuned for VMware product and provider platforms. |
|
| 16 |
-- Container support - Supports Docker, rkt, and the Pivotal Garden container specifications. |
|
| 17 |
-- Efficient lifecycle management - contains a new, open-source, yum-compatible package manager that will help make the system as small as possible, but preserve the robust yum package management capabilities. |
|
| 18 |
- |
|
| 19 |
-This repository is intended for developers wishing to modify Photon and build their own customized ISO images or contribute to the code base. |
|
| 20 |
- |
|
| 21 |
-For instructions and links to download Photon OS binaries, see the [Download Guide in the github wiki](https://github.com/vmware/photon/wiki/Downloading-Photon-OS). |
|
| 22 |
- |
|
| 23 |
-For Security Updates, visit [Security-Advisories](https://github.com/vmware/photon/wiki/Security-Advisories). |
|
| 24 |
- |
|
| 25 |
-An official Vagrant box is available on Hashicorp Atlas, to get started: `vagrant init vmware/photon`. A plugin to support Photon OS guests in Vagrant is available at https://github.com/vmware/vagrant-guests-photon. Some users have found that our Vagrant box requires VirtualBox 4.3 or later. If you have issues, please check your version. |
|
| 26 |
- |
|
| 27 |
-For up-to-date documentation, see the [Docs](docs/) folder. |
|
| 19 |
+- **Documentation**: See the [Docs](docs/) folder. |
|
| 20 |
+- **Security Updates**: Visit [Security-Advisories](https://github.com/vmware/photon/wiki/Security-Advisories). |
|
| 21 |
+- **Vagrant box**: An official Vagrant box is available on Hashicorp Atlas, to get started: `vagrant init vmware/photon`. A plugin to support Photon OS guests in Vagrant is available at [https://github.com/vmware/vagrant-guests-photon](#https://github.com/vmware/vagrant-guests-photon). Some users have found that our Vagrant box requires VirtualBox 4.3 or later. If you have issues, please check your version. |
| 28 | 22 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,1587 @@ |
| 0 |
+# Network Configuration Manager - C API |
|
| 1 |
+ |
|
| 2 |
+Photon OS 2.0 provides a C API for the Network Configuration Manager. |
|
| 3 |
+ |
|
| 4 |
+- [About the Network Configuration Manager C API](#about-the-network-configuration-manager-c-api) |
|
| 5 |
+- [Interface Configuration APIs](#interface-configuration-apis) |
|
| 6 |
+- [IP Address Configuration APIs](#ip-address-configuration-apis) |
|
| 7 |
+- [Route Configuration APIs](#route-configuration-apis) |
|
| 8 |
+- [DNS Configuration APIs](#dns-configuration-apis) |
|
| 9 |
+- [DHCP Options DUID and IAID Configuration APIs](#dhcp-options-duid-and-iaid-configuration-apis) |
|
| 10 |
+- [NTP Configuration APIs](#ntp-configuration-apis) |
|
| 11 |
+- [Service Management APIs](#service-management-apis) |
|
| 12 |
+ |
|
| 13 |
+# About the Network Configuration Manager C API |
|
| 14 |
+ |
|
| 15 |
+Use the Network Configuration Manager C API to simplify common network configuration tasks for: |
|
| 16 |
+ |
|
| 17 |
+- interfaces |
|
| 18 |
+- IP addresses (IPv4 and IPv6 addresses) |
|
| 19 |
+- routes |
|
| 20 |
+- DNS server and domain settings |
|
| 21 |
+- DHCP DUID and IAID settings |
|
| 22 |
+- NTP server settings |
|
| 23 |
+- service management |
|
| 24 |
+- object parameters (interfaces and files) |
|
| 25 |
+ |
|
| 26 |
+## Header File |
|
| 27 |
+ |
|
| 28 |
+Header files for all the C APIs are defined in the following location: |
|
| 29 |
+ |
|
| 30 |
+[https://github.com/](https://github.com/vmware/pmd/tree/master/include) [vmware](https://github.com/vmware/pmd/tree/master/include) [/pmd/tree/master/include](https://github.com/vmware/pmd/tree/master/include) |
|
| 31 |
+ |
|
| 32 |
+To install the Network Configuration Manager header file, run the following command: |
|
| 33 |
+ |
|
| 34 |
+``tdnf install netmgmt-devel`` |
|
| 35 |
+n |
|
| 36 |
+Once installed, you can reference the header file in the following location: |
|
| 37 |
+ |
|
| 38 |
+``/usr/include/netmgmt/netmgr.h`` |
|
| 39 |
+ |
|
| 40 |
+## Freeing Memory |
|
| 41 |
+ |
|
| 42 |
+For all get APIs that take a pointer-to-pointer parameter, the caller has the responsibility to free the memory upon successful response from API by calling free(). |
|
| 43 |
+ |
|
| 44 |
+## Error Codes |
|
| 45 |
+ |
|
| 46 |
+All C API calls return 0 for success, or one of the following error codes for failure. |
|
| 47 |
+ |
|
| 48 |
+- 4097 - NM_ERR_INVALID_PARAMETER |
|
| 49 |
+- 4098 - NM_ERR_NOT_SUPPORTED |
|
| 50 |
+- 4099 - NM_ERR_OUT_OF_MEMORY |
|
| 51 |
+- 4100 - NM_ERR_VALUE_NOT_FOUND |
|
| 52 |
+- 4101 - NM_ERR_VALUE_EXISTS |
|
| 53 |
+- 4102 - NM_ERR_INVALID_INTERFACE |
|
| 54 |
+- 4103 - NM_ERR_INVALID_ADDRESS |
|
| 55 |
+- 4104 - NM_ERR_INVALID_MODE |
|
| 56 |
+- 4105 - NM_ERR_BAD_CONFIG_FILE |
|
| 57 |
+- 4106 - NM_ERR_WRITE_FAILED |
|
| 58 |
+- 4107 - NM_ERR_TIME_OUT |
|
| 59 |
+- 4108 - NM_ERR_DHCP_TIME_OUT |
|
| 60 |
+ |
|
| 61 |
+Use nm_get_error_info to retrieve information about an error code. |
|
| 62 |
+~~~~ |
|
| 63 |
+ const char \* |
|
| 64 |
+ nm_get_error_info( |
|
| 65 |
+ uint32_t nmErrCode |
|
| 66 |
+ );`` |
|
| 67 |
+~~~~ |
|
| 68 |
+# Interface Configuration APIs |
|
| 69 |
+ |
|
| 70 |
+The Photon OS 2.0 network manager C API enables you to manage network interfaces. |
|
| 71 |
+ |
|
| 72 |
+## Structure Declarations |
|
| 73 |
+ |
|
| 74 |
+### Link Mode |
|
| 75 |
+ |
|
| 76 |
+**Description** |
|
| 77 |
+ |
|
| 78 |
+Link mode. Available settings: |
|
| 79 |
+ |
|
| 80 |
+- ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager |
|
| 81 |
+- ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface |
|
| 82 |
+- ``LINK_MODE_UNKNOWN`` - the link mode is unknown |
|
| 83 |
+ |
|
| 84 |
+**Declaration** |
|
| 85 |
+~~~~ |
|
| 86 |
+ typedef enum _NET_LINK_MODE |
|
| 87 |
+ {
|
|
| 88 |
+ LINK_AUTO = 0, |
|
| 89 |
+ LINK_MANUAL, |
|
| 90 |
+ LINK_MODE_UNKNOWN |
|
| 91 |
+ } NET_LINK_MODE;`` |
|
| 92 |
+~~~~ |
|
| 93 |
+### Link State |
|
| 94 |
+ |
|
| 95 |
+**Description** |
|
| 96 |
+ |
|
| 97 |
+Link state. Available settings: |
|
| 98 |
+ |
|
| 99 |
+- ``LINK_DOWN`` - the link is being administratively down or has no carrier signal |
|
| 100 |
+- ``LINK_UP`` - the link is configured up and has carrier signal |
|
| 101 |
+- ``LINK_STATE_UNKNOWN`` - link state is unknown |
|
| 102 |
+ |
|
| 103 |
+**Declaration** |
|
| 104 |
+~~~~ |
|
| 105 |
+ typedef enum _NET_LINK_STATE |
|
| 106 |
+ {
|
|
| 107 |
+ LINK_DOWN = 0, |
|
| 108 |
+ LINK_UP, |
|
| 109 |
+ LINK_STATE_UNKNOWN, |
|
| 110 |
+ } NET_LINK_STATE; |
|
| 111 |
+~~~~ |
|
| 112 |
+### Link Information |
|
| 113 |
+ |
|
| 114 |
+**Description** |
|
| 115 |
+ |
|
| 116 |
+Link information. Includes the following information: |
|
| 117 |
+ |
|
| 118 |
+- ``pszInterfaceName`` - interface name |
|
| 119 |
+- ``pszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b") |
|
| 120 |
+- ``mtu`` - maximum transmission unit (MTU) |
|
| 121 |
+- ``mode`` - link mode (see above) |
|
| 122 |
+- ``state`` - link state (see above) |
|
| 123 |
+ |
|
| 124 |
+**Declaration** |
|
| 125 |
+~~~~ |
|
| 126 |
+ typedef struct _NET_LINK_INFO |
|
| 127 |
+ {
|
|
| 128 |
+ struct _NET_LINK_INFO \*pNext; |
|
| 129 |
+ char \*pszInterfaceName; |
|
| 130 |
+ char \*pszMacAddress; |
|
| 131 |
+ uint32_t mtu; |
|
| 132 |
+ NET_LINK_MODE mode; |
|
| 133 |
+ NET_LINK_STATE state; |
|
| 134 |
+ } NET_LINK_INFO, \*PNET_LINK_INFO; |
|
| 135 |
+~~~~ |
|
| 136 |
+## nm_set_link_mac_addr |
|
| 137 |
+ |
|
| 138 |
+**Description** |
|
| 139 |
+ |
|
| 140 |
+Set the MAC address of the interface. |
|
| 141 |
+ |
|
| 142 |
+**Declaration** |
|
| 143 |
+~~~~ |
|
| 144 |
+uint32_t |
|
| 145 |
+ |
|
| 146 |
+nm_set_link_mac_addr( |
|
| 147 |
+ |
|
| 148 |
+ const char \*pszInterfaceName, |
|
| 149 |
+ const char \*pszMacAddress |
|
| 150 |
+ ); |
|
| 151 |
+~~~~ |
|
| 152 |
+**Arguments** |
|
| 153 |
+ |
|
| 154 |
+- ``pszInterfaceName`` - interface name |
|
| 155 |
+- ``pszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b") |
|
| 156 |
+ |
|
| 157 |
+**Returns** |
|
| 158 |
+ |
|
| 159 |
+- success: 0 |
|
| 160 |
+- failure: error code |
|
| 161 |
+ |
|
| 162 |
+## nm_get_link_mac_addr |
|
| 163 |
+ |
|
| 164 |
+**Description** |
|
| 165 |
+ |
|
| 166 |
+Get the MAC address of the interface. |
|
| 167 |
+ |
|
| 168 |
+**Declaration** |
|
| 169 |
+~~~~ |
|
| 170 |
+uint32_t |
|
| 171 |
+ nm_get_link_mac_addr( |
|
| 172 |
+ const char \*pszInterfaceName, |
|
| 173 |
+ char \*\*ppszMacAddress |
|
| 174 |
+ ); |
|
| 175 |
+~~~~ |
|
| 176 |
+**Arguments** |
|
| 177 |
+ |
|
| 178 |
+- ``pszInterfaceName`` - interface name |
|
| 179 |
+- ``ppszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b") |
|
| 180 |
+ |
|
| 181 |
+**Returns** |
|
| 182 |
+ |
|
| 183 |
+- success: 0 |
|
| 184 |
+- failure: error code |
|
| 185 |
+ |
|
| 186 |
+## nm_set_link_mode |
|
| 187 |
+ |
|
| 188 |
+**Description** |
|
| 189 |
+ |
|
| 190 |
+Set the mode of the interface (auto or manual). |
|
| 191 |
+ |
|
| 192 |
+**Declaration** |
|
| 193 |
+~~~~ |
|
| 194 |
+uint32_t |
|
| 195 |
+ nm_set_link_mode( |
|
| 196 |
+ const char \*pszInterfaceName, |
|
| 197 |
+ NET_LINK_MODE mode |
|
| 198 |
+ ); |
|
| 199 |
+~~~~ |
|
| 200 |
+**Arguments** |
|
| 201 |
+ |
|
| 202 |
+- ``pszInterfaceName`` - interface name |
|
| 203 |
+- ``mode`` - link mode. One of the following values: |
|
| 204 |
+ - ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager |
|
| 205 |
+ - ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface |
|
| 206 |
+ - ``LINK_MODE_UNKNOWN`` - the link mode is unknown |
|
| 207 |
+ |
|
| 208 |
+**Returns** |
|
| 209 |
+ |
|
| 210 |
+- success: 0 |
|
| 211 |
+- failure: error code |
|
| 212 |
+ |
|
| 213 |
+## nm_get_link_mode |
|
| 214 |
+ |
|
| 215 |
+**Description** |
|
| 216 |
+ |
|
| 217 |
+Get the mode of the interface (auto or manual). |
|
| 218 |
+ |
|
| 219 |
+**Declaration** |
|
| 220 |
+~~~~ |
|
| 221 |
+uint32_t |
|
| 222 |
+ nm_get_link_mode( |
|
| 223 |
+ const char \*pszInterfaceName, |
|
| 224 |
+ NET_LINK_MODE \*pLinkMode |
|
| 225 |
+ ); |
|
| 226 |
+~~~~ |
|
| 227 |
+**Arguments** |
|
| 228 |
+ |
|
| 229 |
+- ``pszInterfaceName`` - interface name |
|
| 230 |
+- ``pLinkMode`` - link mode. One of the following values: |
|
| 231 |
+ - ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager |
|
| 232 |
+ - ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface |
|
| 233 |
+ - ``LINK_MODE_UNKNOWN`` - the link mode is unknown |
|
| 234 |
+ |
|
| 235 |
+**Returns** |
|
| 236 |
+ |
|
| 237 |
+- success: 0 |
|
| 238 |
+- failure: error code |
|
| 239 |
+ |
|
| 240 |
+## nm_set_link_mtu |
|
| 241 |
+ |
|
| 242 |
+**Description** |
|
| 243 |
+ |
|
| 244 |
+Set the maximum transmission unit (MTU) of the interface. |
|
| 245 |
+ |
|
| 246 |
+**Declaration** |
|
| 247 |
+~~~~ |
|
| 248 |
+uint32_t |
|
| 249 |
+ nm_set_link_mtu( |
|
| 250 |
+ const char \*pszInterfaceName, |
|
| 251 |
+ uint32_t mtu |
|
| 252 |
+ ); |
|
| 253 |
+~~~~ |
|
| 254 |
+**Arguments** |
|
| 255 |
+ |
|
| 256 |
+- ``pszInterfaceName`` - interface name |
|
| 257 |
+- ``mtu`` - maximum transmission unit (MTU) |
|
| 258 |
+ |
|
| 259 |
+**Returns** |
|
| 260 |
+ |
|
| 261 |
+- success: 0 |
|
| 262 |
+- failure: error code |
|
| 263 |
+ |
|
| 264 |
+## nm_get_link_mtu |
|
| 265 |
+ |
|
| 266 |
+**Description** |
|
| 267 |
+ |
|
| 268 |
+Get the maximum transmission unit (MTU) of the interface. |
|
| 269 |
+ |
|
| 270 |
+**Declaration** |
|
| 271 |
+~~~~ |
|
| 272 |
+nm_get_link_mtu |
|
| 273 |
+ uint32_t |
|
| 274 |
+ nm_get_link_mtu( |
|
| 275 |
+ const char \*pszInterfaceName, |
|
| 276 |
+ uint32_t \*pMtu |
|
| 277 |
+ ); |
|
| 278 |
+~~~~ |
|
| 279 |
+**Arguments** |
|
| 280 |
+ |
|
| 281 |
+- ``pszInterfaceName`` - interface name |
|
| 282 |
+- ``pMtu`` - maximum transmission unit (MTU) |
|
| 283 |
+ |
|
| 284 |
+**Returns** |
|
| 285 |
+ |
|
| 286 |
+- success: 0 |
|
| 287 |
+- failure: error code |
|
| 288 |
+ |
|
| 289 |
+## nm_set_link_state |
|
| 290 |
+ |
|
| 291 |
+**Description** |
|
| 292 |
+ |
|
| 293 |
+Set the link state of the interface (up or down). |
|
| 294 |
+ |
|
| 295 |
+**Declaration** |
|
| 296 |
+~~~~ |
|
| 297 |
+ uint32_t |
|
| 298 |
+ nm_set_link_state( |
|
| 299 |
+ const char \*pszInterfaceName, |
|
| 300 |
+ NET_LINK_STATE state |
|
| 301 |
+ ); |
|
| 302 |
+~~~~ |
|
| 303 |
+**Arguments** |
|
| 304 |
+ |
|
| 305 |
+- ``pszInterfaceName`` - interface name |
|
| 306 |
+- ``state`` - link state. One of the following values: |
|
| 307 |
+ - ``LINK_DOWN`` - the link is being administratively down or has no carrier signal. |
|
| 308 |
+ - ``LINK_UP`` - the link is configured up and has carrier signal. |
|
| 309 |
+ - ``LINK_STATE_UNKNOWN`` - the link state is unknown |
|
| 310 |
+ |
|
| 311 |
+**Returns** |
|
| 312 |
+ |
|
| 313 |
+- success: 0 |
|
| 314 |
+- failure: error code |
|
| 315 |
+ |
|
| 316 |
+## nm_get_link_state |
|
| 317 |
+ |
|
| 318 |
+**Description** |
|
| 319 |
+ |
|
| 320 |
+Get the link state of the interface (up or down). |
|
| 321 |
+ |
|
| 322 |
+**Declaration** |
|
| 323 |
+~~~~ |
|
| 324 |
+uint32_t |
|
| 325 |
+ nm_get_link_state( |
|
| 326 |
+ const char \*pszInterfaceName, |
|
| 327 |
+ NET_LINK_STATE \*pLinkState |
|
| 328 |
+ ); |
|
| 329 |
+~~~~ |
|
| 330 |
+**Arguments** |
|
| 331 |
+ |
|
| 332 |
+- ``pszInterfaceName`` - interface name |
|
| 333 |
+- ``pLinkState`` - link state. One of the following values: |
|
| 334 |
+ - ``LINK_DOWN`` - the link is being administratively down or has no carrier signal |
|
| 335 |
+ - ``LINK_UP`` - the link is configured up and has carrier signal |
|
| 336 |
+ - ``LINK_STATE_UNKNOWN`` - the link state is unknown |
|
| 337 |
+ |
|
| 338 |
+**Returns** |
|
| 339 |
+ |
|
| 340 |
+- success: 0 |
|
| 341 |
+- failure: error code |
|
| 342 |
+ |
|
| 343 |
+## nm_ifup |
|
| 344 |
+ |
|
| 345 |
+**Description** |
|
| 346 |
+ |
|
| 347 |
+Set the specified interface state to UP. Additionally, if the interface is configured to have an IP address, it waits for the interface to acquire the IP address, and then updates neighbors of its IP address via the address resolution protocol (ARP) messages. |
|
| 348 |
+ |
|
| 349 |
+**Declaration** |
|
| 350 |
+~~~~ |
|
| 351 |
+ uint32_t |
|
| 352 |
+ nm_ifup( |
|
| 353 |
+ const char \*pszInterfaceName |
|
| 354 |
+ ); |
|
| 355 |
+~~~~ |
|
| 356 |
+**Arguments** |
|
| 357 |
+ |
|
| 358 |
+- ``pszInterfaceName`` - interface name |
|
| 359 |
+ |
|
| 360 |
+**Returns** |
|
| 361 |
+ |
|
| 362 |
+- success: 0 |
|
| 363 |
+- failure: error code |
|
| 364 |
+ |
|
| 365 |
+## nm_ifdown |
|
| 366 |
+ |
|
| 367 |
+**Description** |
|
| 368 |
+ |
|
| 369 |
+Set the specified interface state to DOWN. |
|
| 370 |
+ |
|
| 371 |
+**Declaration** |
|
| 372 |
+~~~~ |
|
| 373 |
+uint32_t |
|
| 374 |
+ nm_ifdown( |
|
| 375 |
+ const char \*pszInterfaceName |
|
| 376 |
+ ); |
|
| 377 |
+~~~~ |
|
| 378 |
+**Arguments** |
|
| 379 |
+ |
|
| 380 |
+- ``pszInterfaceName`` - interface name |
|
| 381 |
+ |
|
| 382 |
+**Returns** |
|
| 383 |
+ |
|
| 384 |
+- success: 0 |
|
| 385 |
+- failure: error code |
|
| 386 |
+ |
|
| 387 |
+## nm_get_link_info |
|
| 388 |
+ |
|
| 389 |
+**Description** |
|
| 390 |
+ |
|
| 391 |
+Get link information for the interface. The caller is responsible for freeing ppLinkInfo by calling nm_free_link_info. |
|
| 392 |
+ |
|
| 393 |
+**Declaration** |
|
| 394 |
+~~~~ |
|
| 395 |
+uint32_t |
|
| 396 |
+ nm_get_link_info( |
|
| 397 |
+ const char \*pszInterfaceName, |
|
| 398 |
+ NET_LINK_INFO \*\*ppLinkInfo |
|
| 399 |
+ ); |
|
| 400 |
+~~~~ |
|
| 401 |
+**Arguments** |
|
| 402 |
+ |
|
| 403 |
+- ``pszInterfaceName`` - interface name |
|
| 404 |
+- ``ppLinkInfo``, which includes the following information: |
|
| 405 |
+ - \*``pszInterfaceName`` - interface name |
|
| 406 |
+ - \*``pszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b") |
|
| 407 |
+ - ``mtu`` - maximum transmission unit (MTU) |
|
| 408 |
+ - ``mode`` - One of the following values: |
|
| 409 |
+ - ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager |
|
| 410 |
+ - ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface |
|
| 411 |
+ - ``LINK_MODE_UNKNOWN`` - the link mode is unknown |
|
| 412 |
+ - ``state`` - One of the following values: |
|
| 413 |
+ - ``LINK_DOWN`` - the link is being administratively down or has no carrier signal |
|
| 414 |
+ - ``LINK_UP`` - the link is configured up and has carrier signal |
|
| 415 |
+ - ``LINK_STATE_UNKNOWN`` - the link state is unknown |
|
| 416 |
+ |
|
| 417 |
+**Returns** |
|
| 418 |
+ |
|
| 419 |
+- success: 0 |
|
| 420 |
+- failure: error code |
|
| 421 |
+ |
|
| 422 |
+## nm_free_link_info |
|
| 423 |
+ |
|
| 424 |
+**Description** |
|
| 425 |
+ |
|
| 426 |
+Frees the NET_LINK_INFO structure returned by a successful nm_get_link_info call. |
|
| 427 |
+ |
|
| 428 |
+**Declaration** |
|
| 429 |
+~~~~ |
|
| 430 |
+void |
|
| 431 |
+ nm_free_link_info( |
|
| 432 |
+ NET_LINK_INFO \*pNetLinkInfo |
|
| 433 |
+ ); |
|
| 434 |
+~~~~ |
|
| 435 |
+**Arguments** |
|
| 436 |
+ |
|
| 437 |
+- ``pNetLinkInfo``, which includes the following information: |
|
| 438 |
+ - \*``pszInterfaceName`` - interface name |
|
| 439 |
+ - \*``pszMacAddress`` - interface hardware address specified in a colon-separated format (for example: "00:0c:29:99:a5:7b") |
|
| 440 |
+ - ``mtu`` - maximum transmission unit (MTU) |
|
| 441 |
+ - ``mode`` - One of the following values: |
|
| 442 |
+ - ``LINK_AUTO`` - the specified interface is managed and configured by systemd network manager |
|
| 443 |
+ - ``LINK_MANUAL`` - systemd will not bring up or configure the specified interface |
|
| 444 |
+ - ``LINK_MODE_UNKNOWN`` - the link mode is unknown |
|
| 445 |
+ - ``state`` - One of the following values: |
|
| 446 |
+ - ``LINK_DOWN`` - the link is being administratively down or has no carrier signal |
|
| 447 |
+ - ``LINK_UP`` - the link is configured up and has carrier signal |
|
| 448 |
+ - ``LINK_STATE_UNKNOWN`` - the link state is unknown |
|
| 449 |
+ |
|
| 450 |
+**Returns** |
|
| 451 |
+ |
|
| 452 |
+- success: 0 |
|
| 453 |
+- failure: error code |
|
| 454 |
+ |
|
| 455 |
+# IP Address Configuration APIs |
|
| 456 |
+ |
|
| 457 |
+The Photon OS 2.0 network manager C API enables you to manage IP addresses for interfaces that are managed by systemd network manager. |
|
| 458 |
+ |
|
| 459 |
+## Structure Declarations |
|
| 460 |
+ |
|
| 461 |
+### IP Address Mode |
|
| 462 |
+ |
|
| 463 |
+**Description** |
|
| 464 |
+ |
|
| 465 |
+Defines the IP address mode. One of the following values: |
|
| 466 |
+ |
|
| 467 |
+- ``IPV4_ADDR_MODE_NONE`` - no IPv4 address configured on the interface |
|
| 468 |
+- ``IPV4_ADDR_MODE_STATIC`` - the interface is configured with a static IPv4 address |
|
| 469 |
+- ``IPV4_ADDR_MODE_DHCP`` - the interface is configured with a DHCP IPv4 address |
|
| 470 |
+ |
|
| 471 |
+**Declaration** |
|
| 472 |
+~~~~ |
|
| 473 |
+ typedef enum _NET_IPV4_ADDR_MODE |
|
| 474 |
+ {
|
|
| 475 |
+ IPV4_ADDR_MODE_NONE = 0, |
|
| 476 |
+ IPV4_ADDR_MODE_STATIC, |
|
| 477 |
+ IPV4_ADDR_MODE_DHCP, |
|
| 478 |
+ IPV4_ADDR_MODE_MAX |
|
| 479 |
+ } NET_IPV4_ADDR_MODE; |
|
| 480 |
+~~~~ |
|
| 481 |
+### Address Type |
|
| 482 |
+ |
|
| 483 |
+**Description** |
|
| 484 |
+ |
|
| 485 |
+Defines the type of IP address. One of the following options: |
|
| 486 |
+ |
|
| 487 |
+- ``STATIC_IPV4`` - static IPv4 address |
|
| 488 |
+- ``STATIC_IPV6`` - static IPv6 address |
|
| 489 |
+- ``DHCP_IPV4`` - DHCP IPv4 address |
|
| 490 |
+- ``DHCP_IPV6`` - DHCP IPv6 address |
|
| 491 |
+- ``AUTO_IPV6`` - stateless dynamic IPv6 address |
|
| 492 |
+- ``LINK_LOCAL_IPV6`` - link local IPv6 address |
|
| 493 |
+ |
|
| 494 |
+**Declaration** |
|
| 495 |
+~~~~ |
|
| 496 |
+ typedef enum _NET_ADDR_TYPE |
|
| 497 |
+ {
|
|
| 498 |
+ STATIC_IPV4 = 0x00000001, |
|
| 499 |
+ STATIC_IPV6 = 0x00000002, |
|
| 500 |
+ DHCP_IPV4 = 0x00000010, |
|
| 501 |
+ DHCP_IPV6 = 0x00000020, |
|
| 502 |
+ AUTO_IPV6 = 0x00000040, |
|
| 503 |
+ LINK_LOCAL_IPV6 = 0x00000080, |
|
| 504 |
+ } NET_ADDR_TYPE; |
|
| 505 |
+~~~~ |
|
| 506 |
+### IP Addresses |
|
| 507 |
+ |
|
| 508 |
+**Description** |
|
| 509 |
+ |
|
| 510 |
+Defines IP addresses. |
|
| 511 |
+ |
|
| 512 |
+- ``pszInterfaceName`` - interface name |
|
| 513 |
+- ``type`` - address type |
|
| 514 |
+- ``pszIPAddrPrefix`` - IP address |
|
| 515 |
+ |
|
| 516 |
+**Declarations** |
|
| 517 |
+~~~~ |
|
| 518 |
+ typedef struct _NET_IP_ADDR |
|
| 519 |
+ {
|
|
| 520 |
+ char \*pszInterfaceName; |
|
| 521 |
+ NET_ADDR_TYPE type; |
|
| 522 |
+ char \*pszIPAddrPrefix; |
|
| 523 |
+ } NET_IP_ADDR, \*PNET_IP_ADDR; |
|
| 524 |
+~~~~ |
|
| 525 |
+## nm_set_ipv4_addr_gateway |
|
| 526 |
+ |
|
| 527 |
+**Description** |
|
| 528 |
+ |
|
| 529 |
+Set the IPv4 address and (optionally) the default gateway address for the interface. |
|
| 530 |
+ |
|
| 531 |
+**Declaration** |
|
| 532 |
+~~~~ |
|
| 533 |
+ uint32_t |
|
| 534 |
+ |
|
| 535 |
+ nm_set_ipv4_addr_gateway( |
|
| 536 |
+ |
|
| 537 |
+ const char \*pszInterfaceName, |
|
| 538 |
+ NET_IPV4_ADDR_MODE mode, |
|
| 539 |
+ const char \*pszIPv4AddrPrefix, |
|
| 540 |
+ const char \*pszIPv4Gateway |
|
| 541 |
+ ); |
|
| 542 |
+~~~~ |
|
| 543 |
+**Arguments** |
|
| 544 |
+ |
|
| 545 |
+- ``pszInterfaceName`` - interface name |
|
| 546 |
+- ``mode`` - IP address mode; one of the following values: |
|
| 547 |
+ - ``IPV4_ADDR_MODE_NONE`` |
|
| 548 |
+ - ``IPV4_ADDR_MODE_STATIC`` |
|
| 549 |
+ - ``IPV4_ADDR_MODE_DHCP`` |
|
| 550 |
+- ``pszIPv4AddrPrefix`` - IPv4 address specified in dot-decimal / prefix notation (for example, 10.10.10.101/23). If the prefix is not specified, then a /32 prefix is assumed. |
|
| 551 |
+- ``pszIPv4Gateway`` - IPv4 gateway (optional) specified in the dot-decimal format (for example,10.10.20.30). |
|
| 552 |
+ |
|
| 553 |
+**Returns** |
|
| 554 |
+ |
|
| 555 |
+- success: 0 |
|
| 556 |
+- failure: error code |
|
| 557 |
+ |
|
| 558 |
+## nm_get_ipv4_addr_gateway |
|
| 559 |
+ |
|
| 560 |
+**Description** |
|
| 561 |
+ |
|
| 562 |
+Get the IPv4 address and the default gateway address for the interface. |
|
| 563 |
+ |
|
| 564 |
+**Declaration** |
|
| 565 |
+~~~~ |
|
| 566 |
+uint32_t |
|
| 567 |
+ nm_get_ipv4_addr_gateway( |
|
| 568 |
+ const char \*pszInterfaceName, |
|
| 569 |
+ NET_IPV4_ADDR_MODE \*pMode, |
|
| 570 |
+ char \*\*ppszIPv4AddrPrefix, |
|
| 571 |
+ char \*\*ppszIPv4Gateway |
|
| 572 |
+ ); |
|
| 573 |
+~~~~ |
|
| 574 |
+**Arguments** |
|
| 575 |
+ |
|
| 576 |
+- ``pszInterfaceName`` - interface name |
|
| 577 |
+- ``pmode`` - IP mode; one of the following values: |
|
| 578 |
+ - ``IPV4_ADDR_MODE_NONE`` |
|
| 579 |
+ - ``IPV4_ADDR_MODE_STATIC`` |
|
| 580 |
+ - ``IPV4_ADDR_MODE_DHCP`` |
|
| 581 |
+- ``ppszIPv4AddrPrefix`` - IPv4 address returned in dot-decimal / prefix notation (for example, 10.10.10.101/23). If the prefix is not specified, then a /32 prefix is assumed. |
|
| 582 |
+- ``ppszIPv4Gateway`` - IPv4 gateway (optional) returned in the dot-decimal format (for example,10.10.10.250). |
|
| 583 |
+ |
|
| 584 |
+**Returns** |
|
| 585 |
+ |
|
| 586 |
+- success: 0 |
|
| 587 |
+- failure: error code |
|
| 588 |
+ |
|
| 589 |
+## nm_add_static_ipv6_addr |
|
| 590 |
+ |
|
| 591 |
+**Description** |
|
| 592 |
+ |
|
| 593 |
+Add an IPv6 address to the specified interface. |
|
| 594 |
+ |
|
| 595 |
+**Declaration** |
|
| 596 |
+~~~~ |
|
| 597 |
+uint32_t |
|
| 598 |
+ nm_add_static_ipv6_addr( |
|
| 599 |
+ const char \*pszInterfaceName, |
|
| 600 |
+ const char \*pszIPv6AddrPrefix |
|
| 601 |
+ ); |
|
| 602 |
+~~~~ |
|
| 603 |
+**Arguments** |
|
| 604 |
+ |
|
| 605 |
+- ``pszInterfaceName`` - interface name |
|
| 606 |
+- ``pszIPv6AddrPrefix`` - IPv6 address specified in the standard colon-separated IPv6 address format followed by the prefix (for example, 2010:a1:b2::25/64). If the not prefix is specified, then a /128 prefix is assumed. |
|
| 607 |
+ |
|
| 608 |
+**Returns** |
|
| 609 |
+ |
|
| 610 |
+- success: 0 |
|
| 611 |
+- failure: error code |
|
| 612 |
+ |
|
| 613 |
+## nm_delete_static_ipv6_addr |
|
| 614 |
+ |
|
| 615 |
+**Description** |
|
| 616 |
+ |
|
| 617 |
+Delete a static IPv6 address from the interface. |
|
| 618 |
+ |
|
| 619 |
+**Declaration** |
|
| 620 |
+~~~~ |
|
| 621 |
+uint32_t |
|
| 622 |
+ nm_delete_static_ipv6_addr( |
|
| 623 |
+ const char \*pszInterfaceName, |
|
| 624 |
+ const char \*pszIPv6AddrPrefix |
|
| 625 |
+ ); |
|
| 626 |
+~~~~ |
|
| 627 |
+**Arguments** |
|
| 628 |
+ |
|
| 629 |
+- ``pszInterfaceName`` - interface name |
|
| 630 |
+- ``pszIPv6AddrPrefix`` - IPv6 address specified in the standard colon-separated IPv6 address format followed by the prefix (for example, 2010:a1:b2::25/64). If the not prefix is specified, then a /128 prefix is assumed. |
|
| 631 |
+ |
|
| 632 |
+**Returns** |
|
| 633 |
+ |
|
| 634 |
+- success: 0 |
|
| 635 |
+- failure: error code |
|
| 636 |
+ |
|
| 637 |
+## nm_set_ipv6_addr_mode |
|
| 638 |
+ |
|
| 639 |
+**Description** |
|
| 640 |
+ |
|
| 641 |
+Set the mode for the interface. |
|
| 642 |
+ |
|
| 643 |
+**Declaration** |
|
| 644 |
+~~~~ |
|
| 645 |
+uint32_t |
|
| 646 |
+ nm_set_ipv6_addr_mode( |
|
| 647 |
+ const char \*pszInterfaceName, |
|
| 648 |
+ uint32_t enableDhcp, |
|
| 649 |
+ uint32_t enableAutoconf |
|
| 650 |
+ ); |
|
| 651 |
+~~~~ |
|
| 652 |
+**Arguments** |
|
| 653 |
+ |
|
| 654 |
+- ``pszInterfaceName`` - interface name |
|
| 655 |
+- ``enableDhcp`` - enable (1) or disable (0) DHCP; enabling configures the interface to acquire a DHCP IPv6 address. |
|
| 656 |
+- ``enableAutoconf`` - enable (1) or disable (0) autoconf; enabling configures the interface to acquire a stateless autoconfiguration IPv6 address. |
|
| 657 |
+ |
|
| 658 |
+**Returns** |
|
| 659 |
+ |
|
| 660 |
+- success: 0 |
|
| 661 |
+- failure: error code |
|
| 662 |
+ |
|
| 663 |
+## nm_get_ipv6_addr_mode |
|
| 664 |
+ |
|
| 665 |
+**Description** |
|
| 666 |
+ |
|
| 667 |
+Get the mode for the interface. |
|
| 668 |
+ |
|
| 669 |
+**Declaration** |
|
| 670 |
+~~~~ |
|
| 671 |
+ uint32_t |
|
| 672 |
+ nm_get_ipv6_addr_mode( |
|
| 673 |
+ const char \*pszInterfaceName, |
|
| 674 |
+ uint32_t \*pDhcpEnabled, |
|
| 675 |
+ uint32_t \*pAutoconfEnabled |
|
| 676 |
+ ); |
|
| 677 |
+~~~~ |
|
| 678 |
+**Arguments** |
|
| 679 |
+ |
|
| 680 |
+- ``pszInterfaceName`` - interface name |
|
| 681 |
+- ``pDhcpEnabled`` - returns whether IPv6 DHCP is enabled (1) or disabled (0). |
|
| 682 |
+- ``pAutoconfEnabled`` - returns whether IPv6 stateless autoconfiguration is enabled (1) or disabled (0). |
|
| 683 |
+ |
|
| 684 |
+**Returns** |
|
| 685 |
+ |
|
| 686 |
+- success: 0 |
|
| 687 |
+- failure: error code |
|
| 688 |
+ |
|
| 689 |
+## nm_get_ip_addr |
|
| 690 |
+ |
|
| 691 |
+**Description** |
|
| 692 |
+ |
|
| 693 |
+Get the IP address for the interface. |
|
| 694 |
+ |
|
| 695 |
+**Declaration** |
|
| 696 |
+~~~~ |
|
| 697 |
+uint32_t |
|
| 698 |
+ nm_get_ip_addr( |
|
| 699 |
+ const char \*pszInterfaceName, |
|
| 700 |
+ uint32_t addrTypes, |
|
| 701 |
+ size_t \*pCount, |
|
| 702 |
+ NET_IP_ADDR \*\*\*pppIpAddrList |
|
| 703 |
+ ); |
|
| 704 |
+~~~~ |
|
| 705 |
+**Arguments** |
|
| 706 |
+ |
|
| 707 |
+- ``pszInterfaceName`` - interface name |
|
| 708 |
+- ``addrTypes`` - type of IP address; one of the following values: |
|
| 709 |
+ - ``STATIC_IPV4`` |
|
| 710 |
+ - ``STATIC_IPV6`` |
|
| 711 |
+ - ``DHCP_IPV4`` |
|
| 712 |
+ - ``DHCP_IPV6`` |
|
| 713 |
+ - ``AUTO_IPV6`` |
|
| 714 |
+ - ``LINK_LOCAL_IPV6`` |
|
| 715 |
+- ``pCount`` - number of IP address structures in the pppIpAddrList array returned by the API call. |
|
| 716 |
+- ``pppIpAddrList`` - array of NET_IP_ADDR elements that includes the following: |
|
| 717 |
+ - ``pszInterfaceName`` |
|
| 718 |
+ - ``type`` |
|
| 719 |
+ - ``pszIPAddrPrefix`` |
|
| 720 |
+ |
|
| 721 |
+**Returns** |
|
| 722 |
+ |
|
| 723 |
+- success: 0 |
|
| 724 |
+- failure: error code |
|
| 725 |
+ |
|
| 726 |
+## nm_set_ipv6_gateway |
|
| 727 |
+ |
|
| 728 |
+**Description** |
|
| 729 |
+ |
|
| 730 |
+Set the default IPv6 gateway for the interface. |
|
| 731 |
+ |
|
| 732 |
+**Declaration** |
|
| 733 |
+~~~~ |
|
| 734 |
+ uint32_t |
|
| 735 |
+ nm_set_ipv6_gateway( |
|
| 736 |
+ const char \*pszInterfaceName, |
|
| 737 |
+ const char \*pszIPv6Gateway |
|
| 738 |
+ ); |
|
| 739 |
+~~~~ |
|
| 740 |
+**Arguments** |
|
| 741 |
+ |
|
| 742 |
+- ``pszInterfaceName`` - interface name |
|
| 743 |
+- ``pszIPv6Gateway`` - IPv6 gateway specified in the standard colon-separated IPv6 address format (for example, 2010:125::100) |
|
| 744 |
+ |
|
| 745 |
+**Returns** |
|
| 746 |
+ |
|
| 747 |
+- success: 0 |
|
| 748 |
+- failure: error code |
|
| 749 |
+ |
|
| 750 |
+## nm_get_ipv6_gateway |
|
| 751 |
+ |
|
| 752 |
+**Description** |
|
| 753 |
+ |
|
| 754 |
+Get the default IPv6 gateway for the interface. |
|
| 755 |
+ |
|
| 756 |
+**Declaration** |
|
| 757 |
+~~~~ |
|
| 758 |
+ uint32_t |
|
| 759 |
+ nm_get_ipv6_gateway( |
|
| 760 |
+ const char \*pszInterfaceName, |
|
| 761 |
+ char \*\*ppszIPv6Gateway |
|
| 762 |
+ ); |
|
| 763 |
+~~~~ |
|
| 764 |
+**Arguments** |
|
| 765 |
+ |
|
| 766 |
+- ``pszInterfaceName`` - interface name |
|
| 767 |
+- ``ppszIPv6Gateway`` - IPv6 gateway specified in the standard colon-separated IPv6 address format (for example, 2010:125::100) |
|
| 768 |
+ |
|
| 769 |
+**Returns** |
|
| 770 |
+ |
|
| 771 |
+- success: 0 |
|
| 772 |
+- failure: error code |
|
| 773 |
+ |
|
| 774 |
+# Route Configuration APIs |
|
| 775 |
+ |
|
| 776 |
+The Photon OS 2.0 network manager C API enables you to manage static IP routes configuration. |
|
| 777 |
+ |
|
| 778 |
+## Structure Declarations |
|
| 779 |
+ |
|
| 780 |
+### Route Scope |
|
| 781 |
+ |
|
| 782 |
+**Description** |
|
| 783 |
+ |
|
| 784 |
+Defines the scope of a route. One of the following options. |
|
| 785 |
+ |
|
| 786 |
+- ``GLOBAL_ROUTE`` - route to a destination one or more hops away |
|
| 787 |
+- ``LINK_ROUTE`` - route to a destination on the local network |
|
| 788 |
+- ``HOST_ROUTE`` - route to a destination address on the local host |
|
| 789 |
+ |
|
| 790 |
+**Declaration** |
|
| 791 |
+~~~~ |
|
| 792 |
+ typedef enum _NET_ROUTE_SCOPE |
|
| 793 |
+ {
|
|
| 794 |
+ GLOBAL_ROUTE = 0, |
|
| 795 |
+ LINK_ROUTE, |
|
| 796 |
+ HOST_ROUTE, |
|
| 797 |
+ NET_ROUTE_SCOPE_MAX |
|
| 798 |
+ } NET_ROUTE_SCOPE; |
|
| 799 |
+~~~~ |
|
| 800 |
+### IP Route |
|
| 801 |
+ |
|
| 802 |
+**Description** |
|
| 803 |
+ |
|
| 804 |
+Defines an IP route. Includes the following information: |
|
| 805 |
+ |
|
| 806 |
+- ``pszInterfaceName`` - interface through which the specified destination network can be reached |
|
| 807 |
+- ``pszDestNetwork`` - destination IP network reached by the specified route |
|
| 808 |
+- ``pszSourceNetwork`` - source network for the specified route |
|
| 809 |
+- ``pszGateway`` - IP gateway through which the specified destination network can be reached |
|
| 810 |
+- ``scope`` - scope of this route entry; one of the following values: GLOBAL_ROUTE, LINK_ROUTE, or HOST_ROUTE as defined above |
|
| 811 |
+- ``metric`` - metric of this route, an unsigned integer |
|
| 812 |
+- ``table`` - identifier for the route table to which this route belongs. |
|
| 813 |
+ |
|
| 814 |
+**Declaration** |
|
| 815 |
+~~~~ |
|
| 816 |
+ typedef struct _NET_IP_ROUTE |
|
| 817 |
+ {
|
|
| 818 |
+ char \*pszInterfaceName; |
|
| 819 |
+ char \*pszDestNetwork; |
|
| 820 |
+ char \*pszSourceNetwork; |
|
| 821 |
+ char \*pszGateway; |
|
| 822 |
+ NET_ROUTE_SCOPE scope; |
|
| 823 |
+ uint32_t metric; |
|
| 824 |
+ uint32_t table; |
|
| 825 |
+ } NET_IP_ROUTE, \*PNET_IP_ROUTE; |
|
| 826 |
+~~~~ |
|
| 827 |
+## nm_add_static_ip_route |
|
| 828 |
+ |
|
| 829 |
+**Description** |
|
| 830 |
+ |
|
| 831 |
+Add a static IP route. |
|
| 832 |
+ |
|
| 833 |
+**Declaration** |
|
| 834 |
+~~~~ |
|
| 835 |
+uint32_t |
|
| 836 |
+ nm_add_static_ip_route( |
|
| 837 |
+ NET_IP_ROUTE \*pRoute |
|
| 838 |
+ ); |
|
| 839 |
+~~~~ |
|
| 840 |
+**Arguments** |
|
| 841 |
+ |
|
| 842 |
+- ``pRoute`` - static IP route |
|
| 843 |
+ |
|
| 844 |
+**Returns** |
|
| 845 |
+ |
|
| 846 |
+- success: 0 |
|
| 847 |
+- failure: error code |
|
| 848 |
+ |
|
| 849 |
+## nm_delete_static_ip_route |
|
| 850 |
+ |
|
| 851 |
+**Description** |
|
| 852 |
+ |
|
| 853 |
+Delete a static IP route. |
|
| 854 |
+ |
|
| 855 |
+**Declaration** |
|
| 856 |
+~~~~ |
|
| 857 |
+ uint32_t |
|
| 858 |
+ nm_delete_static_ip_route( |
|
| 859 |
+ NET_IP_ROUTE \*pRoute |
|
| 860 |
+ ); |
|
| 861 |
+~~~~ |
|
| 862 |
+**Arguments** |
|
| 863 |
+ |
|
| 864 |
+- ``pRoute`` - static IP route |
|
| 865 |
+ |
|
| 866 |
+**Returns** |
|
| 867 |
+ |
|
| 868 |
+- success: 0 |
|
| 869 |
+- failure: error code |
|
| 870 |
+ |
|
| 871 |
+## nm_get_static_ip_routes |
|
| 872 |
+ |
|
| 873 |
+**Description** |
|
| 874 |
+ |
|
| 875 |
+Get the static IP routes for an interface. |
|
| 876 |
+ |
|
| 877 |
+**Declaration** |
|
| 878 |
+~~~~ |
|
| 879 |
+ uint32_t |
|
| 880 |
+ nm_get_static_ip_routes( |
|
| 881 |
+ const char \*pszInterfaceName, |
|
| 882 |
+ size_t \*pCount, |
|
| 883 |
+ NET_IP_ROUTE \*\*\*pppRouteList |
|
| 884 |
+ ); |
|
| 885 |
+~~~~ |
|
| 886 |
+**Arguments** |
|
| 887 |
+ |
|
| 888 |
+- ``pszInterfaceName`` - interface name |
|
| 889 |
+- ``pCount`` - number of NET_IP_ROUTE elements returned in the pppRouteList array by the API call upon success |
|
| 890 |
+- ``pppRouteList`` - array of static IP routes |
|
| 891 |
+ |
|
| 892 |
+**Returns** |
|
| 893 |
+ |
|
| 894 |
+- success: 0 |
|
| 895 |
+- failure: error code |
|
| 896 |
+ |
|
| 897 |
+# DNS Configuration APIs |
|
| 898 |
+ |
|
| 899 |
+The Photon OS 2.0 network manager C API enables you to manage the DNS and Domains configuration. |
|
| 900 |
+ |
|
| 901 |
+## Structure Declarations |
|
| 902 |
+ |
|
| 903 |
+### DNS Mode |
|
| 904 |
+ |
|
| 905 |
+**Description** |
|
| 906 |
+ |
|
| 907 |
+DNS mode. Any of the following values: |
|
| 908 |
+ |
|
| 909 |
+- ``DNS_MODE_INVALID`` - DNS mode is unknown |
|
| 910 |
+- ``STATIC_DNS`` - DNS servers are statically configured |
|
| 911 |
+- ``DHCP_DNS`` - DNS servers configuration is acquired from DHCP protocol. |
|
| 912 |
+ |
|
| 913 |
+**Declaration** |
|
| 914 |
+~~~~ |
|
| 915 |
+ typedef enum _NET_DNS_MODE |
|
| 916 |
+ {
|
|
| 917 |
+ DNS_MODE_INVALID = 0, |
|
| 918 |
+ STATIC_DNS, |
|
| 919 |
+ DHCP_DNS, |
|
| 920 |
+ DNS_MODE_MAX, |
|
| 921 |
+ } NET_DNS_MODE; |
|
| 922 |
+~~~~ |
|
| 923 |
+## nm_set_dns_servers |
|
| 924 |
+ |
|
| 925 |
+**Description** |
|
| 926 |
+ |
|
| 927 |
+Set the DNS servers list for the interface. |
|
| 928 |
+ |
|
| 929 |
+**Declaration** |
|
| 930 |
+~~~~ |
|
| 931 |
+uint32_t |
|
| 932 |
+ nm_set_dns_servers( |
|
| 933 |
+ const char \*pszInterfaceName, |
|
| 934 |
+ NET_DNS_MODE mode, |
|
| 935 |
+ size_t count, |
|
| 936 |
+ const char \*\*ppszDnsServers |
|
| 937 |
+ ); |
|
| 938 |
+~~~~ |
|
| 939 |
+**Arguments** |
|
| 940 |
+ |
|
| 941 |
+- ``pszInterfaceName`` - interface name (optional, can be NULL) |
|
| 942 |
+- ``mode`` - DNS mode. One of the following values: |
|
| 943 |
+ - ``DNS_MODE_INVALID`` = 0 |
|
| 944 |
+ - ``DNS_MODE_MA`` |
|
| 945 |
+ - ``DHCP_DNS`` |
|
| 946 |
+ - ``STATIC_DNS`` |
|
| 947 |
+- ``count`` - number of NUL terminated DNS server entries passed in the ppszDnsServers array to the API call (for example, 10.10.10.200 or 2020::40) |
|
| 948 |
+- ``ppszDnsServers`` - array of DNS servers |
|
| 949 |
+ |
|
| 950 |
+**Returns** |
|
| 951 |
+ |
|
| 952 |
+- success: 0 |
|
| 953 |
+- failure: error code |
|
| 954 |
+ |
|
| 955 |
+## nm_add_dns_server |
|
| 956 |
+ |
|
| 957 |
+**Description** |
|
| 958 |
+ |
|
| 959 |
+Add a server to the DNS servers list associated with an interface. |
|
| 960 |
+ |
|
| 961 |
+**Declaration** |
|
| 962 |
+~~~~ |
|
| 963 |
+uint32_t |
|
| 964 |
+ nm_add_dns_server( |
|
| 965 |
+ const char \*pszInterfaceName, |
|
| 966 |
+ const char \*pszDnsServer |
|
| 967 |
+ ); |
|
| 968 |
+~~~~ |
|
| 969 |
+**Arguments** |
|
| 970 |
+ |
|
| 971 |
+- ``pszInterfaceName`` - interface name (optional, can be NULL) |
|
| 972 |
+- ``ppszDnsServer`` - server to add to the DNS server list |
|
| 973 |
+ |
|
| 974 |
+**Returns** |
|
| 975 |
+ |
|
| 976 |
+- success: 0 |
|
| 977 |
+- failure: error code |
|
| 978 |
+ |
|
| 979 |
+## nm_delete_dns_server |
|
| 980 |
+ |
|
| 981 |
+**Description** |
|
| 982 |
+ |
|
| 983 |
+Delete a server from the DNS servers list associated with an interface. |
|
| 984 |
+ |
|
| 985 |
+**Declaration** |
|
| 986 |
+~~~~ |
|
| 987 |
+ uint32_t |
|
| 988 |
+ nm_delete_dns_server( |
|
| 989 |
+ const char \*pszInterfaceName, |
|
| 990 |
+ const char \*pszDnsServer |
|
| 991 |
+ ); |
|
| 992 |
+~~~~ |
|
| 993 |
+**Arguments** |
|
| 994 |
+ |
|
| 995 |
+- ``pszInterfaceName`` - interface name (optional, can be NULL) |
|
| 996 |
+- ``ppszDnsServer`` - server to remove from the DNS server list |
|
| 997 |
+ |
|
| 998 |
+**Returns** |
|
| 999 |
+ |
|
| 1000 |
+- success: 0 |
|
| 1001 |
+- failure: error code |
|
| 1002 |
+ |
|
| 1003 |
+## nm_get_dns_servers |
|
| 1004 |
+ |
|
| 1005 |
+**Description** |
|
| 1006 |
+ |
|
| 1007 |
+Get the the DNS servers list for the interface. |
|
| 1008 |
+ |
|
| 1009 |
+**Declaration** |
|
| 1010 |
+~~~~ |
|
| 1011 |
+uint32_t |
|
| 1012 |
+ nm_get_dns_servers( |
|
| 1013 |
+ const char \*pszInterfaceName, |
|
| 1014 |
+ NET_DNS_MODE \*pMode, |
|
| 1015 |
+ size_t \*pCount, |
|
| 1016 |
+ char \*\*\*pppszDnsServers |
|
| 1017 |
+ ); |
|
| 1018 |
+~~~~ |
|
| 1019 |
+**Arguments** |
|
| 1020 |
+ |
|
| 1021 |
+- ``pszInterfaceName`` - interface name (optional, can be NULL) |
|
| 1022 |
+- ``pMode`` - DNS mode. One of the following values: |
|
| 1023 |
+ - ``DNS_MODE_INVALID`` |
|
| 1024 |
+ - ``DHCP_DNS`` |
|
| 1025 |
+ - ``STATIC_DNS`` |
|
| 1026 |
+- ``pCount`` - number of NUL terminated DNS server entries in the pppszDnsServers array returned by the API call (for example, 10.10.10.200 or 2020::40) |
|
| 1027 |
+- ``pppszDnsServers`` - array of DNS servers |
|
| 1028 |
+ |
|
| 1029 |
+**Returns** |
|
| 1030 |
+ |
|
| 1031 |
+- success: 0 |
|
| 1032 |
+- failure: error code |
|
| 1033 |
+ |
|
| 1034 |
+## nm_set_dns_domains |
|
| 1035 |
+ |
|
| 1036 |
+**Description** |
|
| 1037 |
+ |
|
| 1038 |
+Set the DNS domain list. |
|
| 1039 |
+ |
|
| 1040 |
+**Declaration** |
|
| 1041 |
+~~~~ |
|
| 1042 |
+uint32_t |
|
| 1043 |
+ nm_set_dns_domains( |
|
| 1044 |
+ const char \*pszInterfaceName, |
|
| 1045 |
+ size_t count, |
|
| 1046 |
+ const char \*\*ppszDnsDomains |
|
| 1047 |
+ ); |
|
| 1048 |
+~~~~ |
|
| 1049 |
+**Arguments** |
|
| 1050 |
+ |
|
| 1051 |
+- ``pszInterfaceName`` - interface name (optional, can be NULL) |
|
| 1052 |
+- ``count`` - number of DNS domains specified in the ppszDnsDomains array to the API call (for example, if count = 2, then there are two elements: ppszDnsDomains[0] and ppszDnsDomains[1]) |
|
| 1053 |
+- ``ppszDnsDomains`` - array of DNS domains |
|
| 1054 |
+ |
|
| 1055 |
+**Returns** |
|
| 1056 |
+ |
|
| 1057 |
+- success: 0 |
|
| 1058 |
+- failure: error code |
|
| 1059 |
+ |
|
| 1060 |
+## nm_add_dns_domain |
|
| 1061 |
+ |
|
| 1062 |
+**Description** |
|
| 1063 |
+ |
|
| 1064 |
+Add a DNS domain to the DNS domain list. |
|
| 1065 |
+ |
|
| 1066 |
+**Declaration** |
|
| 1067 |
+~~~~ |
|
| 1068 |
+uint32_t |
|
| 1069 |
+ nm_add_dns_domain( |
|
| 1070 |
+ const char \*pszInterfaceName, |
|
| 1071 |
+ const char \*pszDnsDomain |
|
| 1072 |
+ ); |
|
| 1073 |
+~~~~ |
|
| 1074 |
+**Arguments** |
|
| 1075 |
+ |
|
| 1076 |
+- ``pszInterfaceName`` - interface name (optional, can be NULL) |
|
| 1077 |
+- ``pszDnsDomain`` - DNS domain to add to the list |
|
| 1078 |
+ |
|
| 1079 |
+**Returns** |
|
| 1080 |
+ |
|
| 1081 |
+- success: 0 |
|
| 1082 |
+- failure: error code |
|
| 1083 |
+ |
|
| 1084 |
+## nm_delete_dns_domain |
|
| 1085 |
+ |
|
| 1086 |
+**Description** |
|
| 1087 |
+ |
|
| 1088 |
+Delete a DNS domain from the DNS domain list. |
|
| 1089 |
+ |
|
| 1090 |
+**Declaration** |
|
| 1091 |
+~~~~ |
|
| 1092 |
+uint32_t |
|
| 1093 |
+ nm_delete_dns_domain( |
|
| 1094 |
+ const char \*pszInterfaceName, |
|
| 1095 |
+ const char \*pszDnsDomain |
|
| 1096 |
+ ); |
|
| 1097 |
+~~~~ |
|
| 1098 |
+**Arguments** |
|
| 1099 |
+ |
|
| 1100 |
+- ``pszInterfaceName`` - interface name (optional, can be NULL) |
|
| 1101 |
+- ``pszDnsDomain`` - DNS domain to remove from the list |
|
| 1102 |
+ |
|
| 1103 |
+**Returns** |
|
| 1104 |
+ |
|
| 1105 |
+- success: 0 |
|
| 1106 |
+- failure: error code |
|
| 1107 |
+ |
|
| 1108 |
+## nm_get_dns_domains |
|
| 1109 |
+ |
|
| 1110 |
+**Description** |
|
| 1111 |
+ |
|
| 1112 |
+Get the list of DNS domains. |
|
| 1113 |
+ |
|
| 1114 |
+**Declaration** |
|
| 1115 |
+~~~~ |
|
| 1116 |
+uint32_t |
|
| 1117 |
+ nm_get_dns_domains( |
|
| 1118 |
+ const char \*pszInterfaceName, |
|
| 1119 |
+ size_t \*pCount, |
|
| 1120 |
+ char \*\*\*pppszDnsDomains |
|
| 1121 |
+ ); |
|
| 1122 |
+~~~~ |
|
| 1123 |
+**Arguments** |
|
| 1124 |
+ |
|
| 1125 |
+- ``pszInterfaceName`` - interface name (optional, can be NULL) |
|
| 1126 |
+- ``pCount`` - number of DNS domains returned in the pppszDnsDomains from the API call (for example, if count = 2, then there are two elements: ppszDnsDomains[0] and ppszDnsDomains[1]) |
|
| 1127 |
+- ``pppszDnsDomains`` - array of DNS domains |
|
| 1128 |
+ |
|
| 1129 |
+**Returns** |
|
| 1130 |
+ |
|
| 1131 |
+- success: 0 |
|
| 1132 |
+- failure: error code |
|
| 1133 |
+ |
|
| 1134 |
+# DHCP Options DUID and IAID Configuration APIs |
|
| 1135 |
+ |
|
| 1136 |
+The Photon OS 2.0 network manager C API enables you to manage DHCP DUID and Interface IAID. |
|
| 1137 |
+ |
|
| 1138 |
+## nm_set_iaid |
|
| 1139 |
+ |
|
| 1140 |
+**Description** |
|
| 1141 |
+ |
|
| 1142 |
+Set the IAID for the interface. |
|
| 1143 |
+ |
|
| 1144 |
+**Declaration** |
|
| 1145 |
+~~~~ |
|
| 1146 |
+uint32_t |
|
| 1147 |
+ nm_set_iaid( |
|
| 1148 |
+ const char \*pszInterfaceName, |
|
| 1149 |
+ uint32_t iaid |
|
| 1150 |
+ ); |
|
| 1151 |
+~~~~ |
|
| 1152 |
+**Arguments** |
|
| 1153 |
+ |
|
| 1154 |
+- ``pszInterfaceName`` - interface name |
|
| 1155 |
+- ``iaid`` - interface association identifier (IAID) |
|
| 1156 |
+ |
|
| 1157 |
+**Returns** |
|
| 1158 |
+ |
|
| 1159 |
+- success: 0 |
|
| 1160 |
+- failure: error code |
|
| 1161 |
+ |
|
| 1162 |
+## nm_get_iaid |
|
| 1163 |
+ |
|
| 1164 |
+**Description** |
|
| 1165 |
+ |
|
| 1166 |
+Get the IAID for the interface. |
|
| 1167 |
+ |
|
| 1168 |
+**Declaration** |
|
| 1169 |
+~~~~ |
|
| 1170 |
+uint32_t |
|
| 1171 |
+ nm_get_iaid( |
|
| 1172 |
+ const char \*pszInterfaceName, |
|
| 1173 |
+ uint32_t \*pIaid |
|
| 1174 |
+ ); |
|
| 1175 |
+~~~~ |
|
| 1176 |
+**Arguments** |
|
| 1177 |
+ |
|
| 1178 |
+- ``pszInterfaceName`` - interface name |
|
| 1179 |
+- ``pIaid`` - interface association identifier (IAID) |
|
| 1180 |
+ |
|
| 1181 |
+**Returns** |
|
| 1182 |
+ |
|
| 1183 |
+- success: 0 |
|
| 1184 |
+- failure: error code |
|
| 1185 |
+ |
|
| 1186 |
+## nm_set_duid |
|
| 1187 |
+ |
|
| 1188 |
+**Description** |
|
| 1189 |
+ |
|
| 1190 |
+Set the DUID for the interface. |
|
| 1191 |
+ |
|
| 1192 |
+**Declaration** |
|
| 1193 |
+~~~~ |
|
| 1194 |
+uint32_t |
|
| 1195 |
+ nm_set_duid( |
|
| 1196 |
+ const char \*pszInterfaceName, |
|
| 1197 |
+ const char \*pszDuid |
|
| 1198 |
+ ); |
|
| 1199 |
+~~~~ |
|
| 1200 |
+**Arguments** |
|
| 1201 |
+ |
|
| 1202 |
+- ``pszInterfaceName`` - interface name (optional, specify NULL to set system global DUID configuration) |
|
| 1203 |
+- ``pszDuid`` - DHCP unique identifier (DUID) |
|
| 1204 |
+ |
|
| 1205 |
+**Returns** |
|
| 1206 |
+ |
|
| 1207 |
+- success: 0 |
|
| 1208 |
+- failure: error code |
|
| 1209 |
+ |
|
| 1210 |
+## nm_get_duid |
|
| 1211 |
+ |
|
| 1212 |
+**Description** |
|
| 1213 |
+ |
|
| 1214 |
+Get the DUID for the interface. |
|
| 1215 |
+ |
|
| 1216 |
+**Declaration** |
|
| 1217 |
+~~~~ |
|
| 1218 |
+uint32_t |
|
| 1219 |
+ nm_get_duid( |
|
| 1220 |
+ const char \*pszInterfaceName, |
|
| 1221 |
+ char \*\*ppszDuid |
|
| 1222 |
+ ); |
|
| 1223 |
+~~~~ |
|
| 1224 |
+**Arguments** |
|
| 1225 |
+ |
|
| 1226 |
+- ``pszInterfaceName`` - interface name (optional, specify NULL to query system global DUID configuration) |
|
| 1227 |
+- ``ppszDuid`` - DHCP unique identifier (DUID) |
|
| 1228 |
+ |
|
| 1229 |
+**Returns** |
|
| 1230 |
+ |
|
| 1231 |
+- success: 0 |
|
| 1232 |
+- failure: error code |
|
| 1233 |
+ |
|
| 1234 |
+# NTP Configuration APIs |
|
| 1235 |
+ |
|
| 1236 |
+The Photon OS 2.0 network manager C API enables you to manage NTP servers configured for the system. |
|
| 1237 |
+ |
|
| 1238 |
+## nm_set_ntp_servers |
|
| 1239 |
+ |
|
| 1240 |
+**Description** |
|
| 1241 |
+ |
|
| 1242 |
+Set the list of NTP servers. |
|
| 1243 |
+ |
|
| 1244 |
+**Declaration** |
|
| 1245 |
+~~~~ |
|
| 1246 |
+ uint32_t |
|
| 1247 |
+ nm_set_ntp_servers( |
|
| 1248 |
+ size_t count, |
|
| 1249 |
+ const char \*\*ppszNtpServers |
|
| 1250 |
+ ); |
|
| 1251 |
+~~~~ |
|
| 1252 |
+**Arguments** |
|
| 1253 |
+ |
|
| 1254 |
+- ``count`` - number of NTP servers in the ppszNtpServers array passed to the API call. |
|
| 1255 |
+- ``ppszNtpServers`` - array of NTP servers |
|
| 1256 |
+ |
|
| 1257 |
+**Returns** |
|
| 1258 |
+ |
|
| 1259 |
+- success: 0 |
|
| 1260 |
+- failure: error code |
|
| 1261 |
+ |
|
| 1262 |
+## nm_add_ntp_servers |
|
| 1263 |
+ |
|
| 1264 |
+**Description** |
|
| 1265 |
+ |
|
| 1266 |
+Add a server to the NTP servers list. |
|
| 1267 |
+ |
|
| 1268 |
+**Declaration** |
|
| 1269 |
+~~~~ |
|
| 1270 |
+ uint32_t |
|
| 1271 |
+ nm_add_ntp_servers( |
|
| 1272 |
+ size_t count, |
|
| 1273 |
+ const char \*\*ppszNtpServers |
|
| 1274 |
+ ); |
|
| 1275 |
+~~~~ |
|
| 1276 |
+**Arguments** |
|
| 1277 |
+ |
|
| 1278 |
+- ``count`` - number of NTP servers to add (specified in the ppszNtpServers array) passed to the API call. |
|
| 1279 |
+- ``ppszNtpServers`` - array of NTP servers to add |
|
| 1280 |
+ |
|
| 1281 |
+**Returns** |
|
| 1282 |
+ |
|
| 1283 |
+- success: 0 |
|
| 1284 |
+- failure: error code |
|
| 1285 |
+ |
|
| 1286 |
+## nm_delete_ntp_servers |
|
| 1287 |
+ |
|
| 1288 |
+**Description** |
|
| 1289 |
+ |
|
| 1290 |
+Delete a server from the NTP servers list. |
|
| 1291 |
+ |
|
| 1292 |
+**Declaration** |
|
| 1293 |
+~~~~ |
|
| 1294 |
+ uint32_t |
|
| 1295 |
+ nm_delete_ntp_servers( |
|
| 1296 |
+ size_t count, |
|
| 1297 |
+ const char \*\*ppszNtpServers |
|
| 1298 |
+ ); |
|
| 1299 |
+~~~~ |
|
| 1300 |
+**Arguments** |
|
| 1301 |
+ |
|
| 1302 |
+- ``count`` - number of NTP servers to delete (specified in the ppszNtpServers array) passed to the API call |
|
| 1303 |
+- ``ppszNtpServers`` - array of NTP servers to delete |
|
| 1304 |
+ |
|
| 1305 |
+**Returns** |
|
| 1306 |
+ |
|
| 1307 |
+- success: 0 |
|
| 1308 |
+- failure: error code |
|
| 1309 |
+ |
|
| 1310 |
+## nm_get_ntp_servers |
|
| 1311 |
+ |
|
| 1312 |
+**Description** |
|
| 1313 |
+ |
|
| 1314 |
+Get the NTP servers list. |
|
| 1315 |
+ |
|
| 1316 |
+**Declaration** |
|
| 1317 |
+~~~~ |
|
| 1318 |
+ uint32_t |
|
| 1319 |
+ nm_get_ntp_servers( |
|
| 1320 |
+ size_t \*pCount, |
|
| 1321 |
+ char \*\*\*pppszNtpServers |
|
| 1322 |
+ ); |
|
| 1323 |
+~~~~ |
|
| 1324 |
+**Arguments** |
|
| 1325 |
+ |
|
| 1326 |
+- ``pCount`` - number of NTP servers in the pppszNtpServers array returned from the API call |
|
| 1327 |
+- ``pppszNtpServers`` - array of NTP servers |
|
| 1328 |
+ |
|
| 1329 |
+**Returns** |
|
| 1330 |
+ |
|
| 1331 |
+- success: 0 |
|
| 1332 |
+- failure: error code |
|
| 1333 |
+ |
|
| 1334 |
+Other APIs |
|
| 1335 |
+ |
|
| 1336 |
+## nm_set_hostname |
|
| 1337 |
+ |
|
| 1338 |
+**Description** |
|
| 1339 |
+ |
|
| 1340 |
+Set the host name for the system. |
|
| 1341 |
+ |
|
| 1342 |
+**Declaration** |
|
| 1343 |
+~~~~ |
|
| 1344 |
+ uint32_t |
|
| 1345 |
+ nm_set_hostname( |
|
| 1346 |
+ const char \*pszHostname |
|
| 1347 |
+ ); |
|
| 1348 |
+~~~~ |
|
| 1349 |
+**Arguments** |
|
| 1350 |
+ |
|
| 1351 |
+- ``pszHostname`` - host name |
|
| 1352 |
+ |
|
| 1353 |
+**Returns** |
|
| 1354 |
+ |
|
| 1355 |
+- success: 0 |
|
| 1356 |
+- failure: error code |
|
| 1357 |
+ |
|
| 1358 |
+## nm_get_hostname |
|
| 1359 |
+ |
|
| 1360 |
+**Description** |
|
| 1361 |
+ |
|
| 1362 |
+Get the host name for the system. |
|
| 1363 |
+ |
|
| 1364 |
+**Declaration** |
|
| 1365 |
+~~~~ |
|
| 1366 |
+ uint32_t |
|
| 1367 |
+ nm_get_hostname( |
|
| 1368 |
+ char \*\*ppszHostname |
|
| 1369 |
+ ); |
|
| 1370 |
+~~~~ |
|
| 1371 |
+**Arguments** |
|
| 1372 |
+ |
|
| 1373 |
+- ``ppszHostname`` - host name |
|
| 1374 |
+ |
|
| 1375 |
+**Returns** |
|
| 1376 |
+ |
|
| 1377 |
+- success: 0 |
|
| 1378 |
+- failure: error code |
|
| 1379 |
+ |
|
| 1380 |
+## nm_wait_for_link_up |
|
| 1381 |
+ |
|
| 1382 |
+**Description** |
|
| 1383 |
+ |
|
| 1384 |
+Wait for the specified interface to come up. |
|
| 1385 |
+ |
|
| 1386 |
+**Declaration** |
|
| 1387 |
+~~~~ |
|
| 1388 |
+ uint32_t |
|
| 1389 |
+ nm_wait_for_link_up( |
|
| 1390 |
+ const char \*pszInterfaceName, |
|
| 1391 |
+ uint32_t timeout |
|
| 1392 |
+ ); |
|
| 1393 |
+~~~~ |
|
| 1394 |
+**Arguments** |
|
| 1395 |
+ |
|
| 1396 |
+- ``pszInterfaceName`` - interface name |
|
| 1397 |
+- ``timeout`` - maximum time (in seconds) to wait (until the link is up) before timing out of the request; specify 0 for no timeout (wait indefinitely) |
|
| 1398 |
+ |
|
| 1399 |
+**Returns** |
|
| 1400 |
+ |
|
| 1401 |
+- success: 0 |
|
| 1402 |
+- failure: error code |
|
| 1403 |
+ |
|
| 1404 |
+## nm_wait_for_ip |
|
| 1405 |
+ |
|
| 1406 |
+**Description** |
|
| 1407 |
+ |
|
| 1408 |
+Wait for the interface to acquire an IP address of the specified IP address type. |
|
| 1409 |
+ |
|
| 1410 |
+**Declaration** |
|
| 1411 |
+~~~~ |
|
| 1412 |
+ uint32_t |
|
| 1413 |
+ nm_wait_for_ip( |
|
| 1414 |
+ const char \*pszInterfaceName, |
|
| 1415 |
+ uint32_t timeout, |
|
| 1416 |
+ NET_ADDR_TYPE addrTypes |
|
| 1417 |
+ ); |
|
| 1418 |
+~~~~ |
|
| 1419 |
+**Arguments** |
|
| 1420 |
+ |
|
| 1421 |
+- ``pszInterfaceName`` - interface name |
|
| 1422 |
+- ``timeout`` - maximum time (in seconds) to wait (until the link has an IP address of the specified address type) before timing out of the request; specify 0 for no timeout (wait indefinitely) |
|
| 1423 |
+- ``addrTypes`` - type of IP address; one of the following values: |
|
| 1424 |
+ - ``STATIC_IPV4`` |
|
| 1425 |
+ - ``STATIC_IPV6`` |
|
| 1426 |
+ - ``DHCP_IPV4`` |
|
| 1427 |
+ - ``DHCP_IPV6`` |
|
| 1428 |
+ - ``AUTO_IPV6`` |
|
| 1429 |
+ - ``LINK_LOCAL_IPV6`` |
|
| 1430 |
+ |
|
| 1431 |
+**Returns** |
|
| 1432 |
+ |
|
| 1433 |
+- success: 0 |
|
| 1434 |
+- failure: error code |
|
| 1435 |
+ |
|
| 1436 |
+## nm_set_network_param |
|
| 1437 |
+ |
|
| 1438 |
+**Description** |
|
| 1439 |
+ |
|
| 1440 |
+Set the value of a network parameter for an object. |
|
| 1441 |
+ |
|
| 1442 |
+**Declaration** |
|
| 1443 |
+~~~~ |
|
| 1444 |
+uint32_t |
|
| 1445 |
+ nm_set_network_param( |
|
| 1446 |
+ const char \*pszObjectName, |
|
| 1447 |
+ const char \*pszParamName, |
|
| 1448 |
+ const char \*pszParamValue |
|
| 1449 |
+ ); |
|
| 1450 |
+~~~~ |
|
| 1451 |
+**Arguments** |
|
| 1452 |
+ |
|
| 1453 |
+- ``pszObjectName`` - an interface name (for example, "eth0") or a file name (for example, /etc/systemd/resolved.conf) |
|
| 1454 |
+- ``pszParamName`` - name of a parameter associated with the object; specified in the format SectionName_KeyName (for example, Link_MTUBytes represents the MtuBytes key in [Link] section in [https://www.freedesktop.org/software/systemd/man/systemd.network.html](https://www.freedesktop.org/software/systemd/man/systemd.network.html)) |
|
| 1455 |
+- ``pszParamValue`` - points to the parameter value to set; you can add (+) or remove (-) a parameter by prepending the parameter name with + or -. For example: |
|
| 1456 |
+ |
|
| 1457 |
+netmgr net_info --set --object eth1 --paramname +Network_Address --paramvalue "10.10.10.1/24" |
|
| 1458 |
+ |
|
| 1459 |
+**Returns** |
|
| 1460 |
+ |
|
| 1461 |
+- success: 0 |
|
| 1462 |
+- failure: error code |
|
| 1463 |
+ |
|
| 1464 |
+## nm_get_network_param |
|
| 1465 |
+ |
|
| 1466 |
+**Description** |
|
| 1467 |
+ |
|
| 1468 |
+Get the value of a network parameter associated with an object. |
|
| 1469 |
+ |
|
| 1470 |
+**Declaration** |
|
| 1471 |
+~~~~ |
|
| 1472 |
+ uint32_t |
|
| 1473 |
+ nm_get_network_param( |
|
| 1474 |
+ const char \*pszObjectName, |
|
| 1475 |
+ const char \*pszParamName, |
|
| 1476 |
+ char \*\*ppszParamValue |
|
| 1477 |
+ ); |
|
| 1478 |
+~~~~ |
|
| 1479 |
+**Arguments** |
|
| 1480 |
+ |
|
| 1481 |
+- ``pszObjectName`` - an interface name (for example, "eth0") or a file name (for example, /etc/systemd/resolved.conf) |
|
| 1482 |
+- ``pszParamName`` - name of a parameter associated with the object; returned in the format SectionName_KeyName (for example, Link_MTUBytes represents the MtuBytes key in [Link] section in [https://www.freedesktop.org/software/systemd/man/systemd.network.html](https://www.freedesktop.org/software/systemd/man/systemd.network.html)) |
|
| 1483 |
+- ``ppszParamValue`` - parameter value |
|
| 1484 |
+ |
|
| 1485 |
+**Returns** |
|
| 1486 |
+ |
|
| 1487 |
+- success: 0 |
|
| 1488 |
+- failure: error code |
|
| 1489 |
+ |
|
| 1490 |
+# Service Management APIs |
|
| 1491 |
+ |
|
| 1492 |
+## nm_stop_network_service |
|
| 1493 |
+ |
|
| 1494 |
+**Description** |
|
| 1495 |
+ |
|
| 1496 |
+Stop the network service. |
|
| 1497 |
+ |
|
| 1498 |
+**Declaration** |
|
| 1499 |
+~~~~ |
|
| 1500 |
+ uint32_t |
|
| 1501 |
+ nm_stop_network_service(); |
|
| 1502 |
+~~~~ |
|
| 1503 |
+**Returns** |
|
| 1504 |
+ |
|
| 1505 |
+- success: 0 |
|
| 1506 |
+- failure: error code |
|
| 1507 |
+ |
|
| 1508 |
+## nm_restart_network_service |
|
| 1509 |
+ |
|
| 1510 |
+**Description** |
|
| 1511 |
+ |
|
| 1512 |
+Restart the network service. |
|
| 1513 |
+ |
|
| 1514 |
+**Declaration** |
|
| 1515 |
+~~~~ |
|
| 1516 |
+ uint32_t |
|
| 1517 |
+ nm_restart_network_service(); |
|
| 1518 |
+~~~~ |
|
| 1519 |
+**Returns** |
|
| 1520 |
+ |
|
| 1521 |
+- success: 0 |
|
| 1522 |
+- failure: error code |
|
| 1523 |
+ |
|
| 1524 |
+nm_stop_dns_service |
|
| 1525 |
+ |
|
| 1526 |
+**Description** |
|
| 1527 |
+ |
|
| 1528 |
+Stop the DNS service. |
|
| 1529 |
+ |
|
| 1530 |
+**Declaration** |
|
| 1531 |
+~~~~ |
|
| 1532 |
+uint32_t |
|
| 1533 |
+ nm_stop_dns_service(); |
|
| 1534 |
+~~~~ |
|
| 1535 |
+**Returns** |
|
| 1536 |
+ |
|
| 1537 |
+- success: 0 |
|
| 1538 |
+- failure: error code |
|
| 1539 |
+ |
|
| 1540 |
+## nm_restart_dns_service |
|
| 1541 |
+ |
|
| 1542 |
+**Description** |
|
| 1543 |
+ |
|
| 1544 |
+Restart the DNS service. |
|
| 1545 |
+ |
|
| 1546 |
+**Declaration** |
|
| 1547 |
+~~~~ |
|
| 1548 |
+ uint32_t |
|
| 1549 |
+ nm_restart_dns_service(); |
|
| 1550 |
+~~~~ |
|
| 1551 |
+**Returns** |
|
| 1552 |
+ |
|
| 1553 |
+- success: 0 |
|
| 1554 |
+- failure: error code |
|
| 1555 |
+ |
|
| 1556 |
+## nm_stop_ntp_service |
|
| 1557 |
+ |
|
| 1558 |
+**Description** |
|
| 1559 |
+ |
|
| 1560 |
+Stop the NTP service. |
|
| 1561 |
+ |
|
| 1562 |
+**Declaration** |
|
| 1563 |
+~~~~ |
|
| 1564 |
+ uint32_t |
|
| 1565 |
+ nm_stop_ntp_service(); |
|
| 1566 |
+~~~~ |
|
| 1567 |
+**Returns** |
|
| 1568 |
+ |
|
| 1569 |
+- success: 0 |
|
| 1570 |
+- failure: error code |
|
| 1571 |
+ |
|
| 1572 |
+## nm_restart_ntp_service |
|
| 1573 |
+ |
|
| 1574 |
+**Description** |
|
| 1575 |
+ |
|
| 1576 |
+Restart the NTP service. |
|
| 1577 |
+ |
|
| 1578 |
+**Declaration** |
|
| 1579 |
+~~~~ |
|
| 1580 |
+ uint32_t |
|
| 1581 |
+ nm_restart_ntp_service(); |
|
| 1582 |
+~~~~ |
|
| 1583 |
+**Returns** |
|
| 1584 |
+ |
|
| 1585 |
+- success: 0 |
|
| 1586 |
+- failure: error code |
|
| 0 | 1587 |
\ No newline at end of file |
| 1 | 1588 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,784 @@ |
| 0 |
+# Network Configuration Manager - Python API |
|
| 1 |
+Photon OS 2.0 provides a Python API for the Network Configuration Manager. |
|
| 2 |
+ |
|
| 3 |
+- [Setup Instructions](#setup-instructions) |
|
| 4 |
+- [Initialization Steps](#initialization-steps) |
|
| 5 |
+- [Get Online Help](#get-online-help) |
|
| 6 |
+- [Basic Information](#basic-information) |
|
| 7 |
+- [Interface Configuration](#interface-configuration) |
|
| 8 |
+- [IP Address Configuration](#ip-address-configuration) |
|
| 9 |
+- [DNS Configuration](#dns-configuration) |
|
| 10 |
+- [DHCP Options, DUID, and IAID Configuration](#dhcp-options-duid-and-iaid-configuration) |
|
| 11 |
+- [NTP Servers](#ntp-servers) |
|
| 12 |
+ |
|
| 13 |
+# Setup Instructions |
|
| 14 |
+ |
|
| 15 |
+To set up and run the latest version of the Network Manager API for Python: |
|
| 16 |
+~~~~ |
|
| 17 |
+# tdnf install pmd pmd-python3 |
|
| 18 |
+# systemctl start pmd |
|
| 19 |
+~~~~ |
|
| 20 |
+# Initialization Steps |
|
| 21 |
+~~~~ |
|
| 22 |
+# python3 |
|
| 23 |
+>>> import pmd |
|
| 24 |
+>>> net = pmd.server().net |
|
| 25 |
+>>> net._command_ |
|
| 26 |
+~~~~ |
|
| 27 |
+# Get Online Help |
|
| 28 |
+ |
|
| 29 |
+Get help for all commands. |
|
| 30 |
+~~~~ |
|
| 31 |
+>>> help(net) |
|
| 32 |
+~~~~ |
|
| 33 |
+Get help for a specific command. |
|
| 34 |
+~~~~ |
|
| 35 |
+>>> help(net.add_ntp_servers) |
|
| 36 |
+-in function add_ntp_servers: |
|
| 37 |
+add_ntp_servers(...) method of [server.net](http://server.net/) instance |
|
| 38 |
+ net.add_ntp_servers(ntpservers = ["20.20.20.20", "25.30.40.70"]) |
|
| 39 |
+ adds ntp servers. returns success: 0, failure: exception. |
|
| 40 |
+(END) |
|
| 41 |
+~~~~ |
|
| 42 |
+ |
|
| 43 |
+# Basic Information |
|
| 44 |
+ |
|
| 45 |
+### get_system_network_info |
|
| 46 |
+ |
|
| 47 |
+Get network information details that are common to the entire system. |
|
| 48 |
+ |
|
| 49 |
+**Syntax** |
|
| 50 |
+~~~~ |
|
| 51 |
+net.get_system_network_info() |
|
| 52 |
+~~~~ |
|
| 53 |
+**Returns** |
|
| 54 |
+ |
|
| 55 |
+- details about the system network (DUID, DNS mode, DNS server list, DNS domain list, NTP server list) |
|
| 56 |
+ |
|
| 57 |
+**Example** |
|
| 58 |
+~~~~ |
|
| 59 |
+>>> system_network_info = netmgmt.get_system_network_info() |
|
| 60 |
+ |
|
| 61 |
+>>> type (system_network_info) |
|
| 62 |
+ |
|
| 63 |
+<class 'list'> |
|
| 64 |
+ |
|
| 65 |
+>>> print ( system_network_info) |
|
| 66 |
+ |
|
| 67 |
+[{DUID: 00:02:11:22:33:44:55:66:77:20, DNS Mode: (null), DNS ServerList: ['10.10.100.100', '20.20.200.10'], DNS domain list: [' [abcd.com](http://abcd.com)'], NTP ServerList: (null)}]
|
|
| 68 |
+~~~~ |
|
| 69 |
+### get_err_info |
|
| 70 |
+ |
|
| 71 |
+Get information about the specified error number. |
|
| 72 |
+ |
|
| 73 |
+**Syntax** |
|
| 74 |
+~~~~ |
|
| 75 |
+net.get_err_info(error = <error_number>) |
|
| 76 |
+~~~~ |
|
| 77 |
+**Parameters** |
|
| 78 |
+ |
|
| 79 |
+- error - error number |
|
| 80 |
+ |
|
| 81 |
+Here is the list of error numbers: |
|
| 82 |
+ |
|
| 83 |
+- 4097 - invalid parameter |
|
| 84 |
+- 4098 - not supported |
|
| 85 |
+- 4099 - out of memory |
|
| 86 |
+- 4100 - value not found |
|
| 87 |
+- 4101 - value exists |
|
| 88 |
+- 4102 - invalid interface |
|
| 89 |
+- 4103 - invalid mode |
|
| 90 |
+- 4104 - bad configuration file |
|
| 91 |
+- 4105 - write failed |
|
| 92 |
+- 4106 - timout |
|
| 93 |
+- 4107 - DCHP timeout |
|
| 94 |
+ |
|
| 95 |
+**Returns** |
|
| 96 |
+ |
|
| 97 |
+- success: 0 |
|
| 98 |
+- failure: exception |
|
| 99 |
+ |
|
| 100 |
+Example |
|
| 101 |
+~~~~ |
|
| 102 |
+>> net.get_err_info(error = 4097) |
|
| 103 |
+ |
|
| 104 |
+'invalid parameter' |
|
| 105 |
+~~~~ |
|
| 106 |
+# Interface Configuration |
|
| 107 |
+ |
|
| 108 |
+Use these commands to manage the configuration for a network interface. |
|
| 109 |
+ |
|
| 110 |
+### get_link_info |
|
| 111 |
+ |
|
| 112 |
+Get the link info for the specified interface or for all interfaces (if no interface is specified). |
|
| 113 |
+ |
|
| 114 |
+**Syntax** |
|
| 115 |
+~~~~ |
|
| 116 |
+net.get_link_info(ifname = interface_name) |
|
| 117 |
+~~~~ |
|
| 118 |
+**Parameters** |
|
| 119 |
+ |
|
| 120 |
+- ``ifname`` - interface name (optional) |
|
| 121 |
+ |
|
| 122 |
+**Returns** |
|
| 123 |
+ |
|
| 124 |
+- success: link info |
|
| 125 |
+- failure: exception |
|
| 126 |
+ |
|
| 127 |
+### get_link_macaddr |
|
| 128 |
+ |
|
| 129 |
+Get the MAC address for the specified interface or for all interfaces (if no interface is specified). |
|
| 130 |
+ |
|
| 131 |
+**Syntax** |
|
| 132 |
+~~~~ |
|
| 133 |
+net.get_link_macaddr(ifname = interface_name) |
|
| 134 |
+~~~~ |
|
| 135 |
+**Parameters** |
|
| 136 |
+ |
|
| 137 |
+- ``ifname`` - interface name (optional) |
|
| 138 |
+ |
|
| 139 |
+**Returns** |
|
| 140 |
+ |
|
| 141 |
+- success: MAC address |
|
| 142 |
+- failure: exception |
|
| 143 |
+ |
|
| 144 |
+### get_link_mode |
|
| 145 |
+ |
|
| 146 |
+Get the link mode for the specified interface (auto or manual), or for all interfaces (if no interface is specified). |
|
| 147 |
+ |
|
| 148 |
+**Syntax** |
|
| 149 |
+~~~~ |
|
| 150 |
+net.get_link_mode(ifname = interface_name) |
|
| 151 |
+~~~~ |
|
| 152 |
+**Parameters** |
|
| 153 |
+ |
|
| 154 |
+- ``ifname`` - interface name (optional) |
|
| 155 |
+ |
|
| 156 |
+**Returns** |
|
| 157 |
+ |
|
| 158 |
+- success: link mode (auto, manual, or unknown) |
|
| 159 |
+- failure: exception |
|
| 160 |
+ |
|
| 161 |
+### get_link_mtu |
|
| 162 |
+ |
|
| 163 |
+Get the MTU of the specified interface or for all interfaces (if no interface is specified). |
|
| 164 |
+ |
|
| 165 |
+**Syntax** |
|
| 166 |
+~~~~ |
|
| 167 |
+net.get_link_mtu(ifname = interface_name) |
|
| 168 |
+~~~~ |
|
| 169 |
+**Parameters** |
|
| 170 |
+ |
|
| 171 |
+- ``ifname`` - interface name (optional) |
|
| 172 |
+ |
|
| 173 |
+**Returns** |
|
| 174 |
+ |
|
| 175 |
+- success: link MTU |
|
| 176 |
+- failure: exception |
|
| 177 |
+ |
|
| 178 |
+### get_link_state |
|
| 179 |
+ |
|
| 180 |
+Get the link state of the specified interface or for all interfaces (if no interface is specified). |
|
| 181 |
+ |
|
| 182 |
+**Syntax** |
|
| 183 |
+~~~~ |
|
| 184 |
+net.get_link_state(ifname = interface_name) |
|
| 185 |
+~~~~ |
|
| 186 |
+**Parameters** |
|
| 187 |
+ |
|
| 188 |
+- ``ifname`` - interface name (optional) |
|
| 189 |
+ |
|
| 190 |
+**Returns** |
|
| 191 |
+ |
|
| 192 |
+- success: link state (up, down, unknown) |
|
| 193 |
+- failure: exception |
|
| 194 |
+ |
|
| 195 |
+### set_link_down |
|
| 196 |
+ |
|
| 197 |
+Bring down the specified interface. |
|
| 198 |
+ |
|
| 199 |
+**Syntax** |
|
| 200 |
+~~~~ |
|
| 201 |
+net.set_link_down(ifname = interface_name) |
|
| 202 |
+~~~~ |
|
| 203 |
+**Parameters** |
|
| 204 |
+ |
|
| 205 |
+- ``ifname`` - interface name |
|
| 206 |
+ |
|
| 207 |
+**Returns** |
|
| 208 |
+ |
|
| 209 |
+- success: 0 |
|
| 210 |
+- failure: exception |
|
| 211 |
+ |
|
| 212 |
+### set_link_macaddr |
|
| 213 |
+ |
|
| 214 |
+Set the MAC address of the specified interface. |
|
| 215 |
+ |
|
| 216 |
+**Syntax** |
|
| 217 |
+~~~~ |
|
| 218 |
+net.set_link_macaddr(ifname = interface_name, macaddr = mac_address) |
|
| 219 |
+~~~~ |
|
| 220 |
+**Parameters** |
|
| 221 |
+ |
|
| 222 |
+- ``ifname`` - interface name |
|
| 223 |
+- ``macaddr`` = MAC address |
|
| 224 |
+ |
|
| 225 |
+**Returns** |
|
| 226 |
+ |
|
| 227 |
+- success: 0 |
|
| 228 |
+- failure: exception |
|
| 229 |
+ |
|
| 230 |
+### set_link_mode |
|
| 231 |
+ |
|
| 232 |
+Set the mode (auto or manual) of the specifed interface. |
|
| 233 |
+ |
|
| 234 |
+**Syntax** |
|
| 235 |
+~~~~ |
|
| 236 |
+net.set_link_mode(ifname = interface_name, link_mode = [auto, manual]) |
|
| 237 |
+~~~~ |
|
| 238 |
+**Parameters** |
|
| 239 |
+ |
|
| 240 |
+- ``ifname`` - interface name |
|
| 241 |
+- ``link_mode`` - auto or manual |
|
| 242 |
+ |
|
| 243 |
+**Returns** |
|
| 244 |
+ |
|
| 245 |
+- success: 0 |
|
| 246 |
+- failure: exception |
|
| 247 |
+ |
|
| 248 |
+### set_link_mtu |
|
| 249 |
+ |
|
| 250 |
+Set the MTU for the specified interface. |
|
| 251 |
+ |
|
| 252 |
+**Syntax** |
|
| 253 |
+~~~~ |
|
| 254 |
+net.set_link_mtu(ifname = interface_name, mtu = mtu) |
|
| 255 |
+~~~~ |
|
| 256 |
+**Parameters** |
|
| 257 |
+ |
|
| 258 |
+- ``ifname`` - interface name |
|
| 259 |
+- ``mtu`` - ``mtu`` |
|
| 260 |
+ |
|
| 261 |
+**Returns** |
|
| 262 |
+ |
|
| 263 |
+- success: 0 |
|
| 264 |
+- failure: exception |
|
| 265 |
+ |
|
| 266 |
+### set_link_state |
|
| 267 |
+ |
|
| 268 |
+Set the state (up or down) of the specified interface. |
|
| 269 |
+ |
|
| 270 |
+**Syntax** |
|
| 271 |
+~~~~ |
|
| 272 |
+net.set_link_state(ifname = interface_name, link_state = [down, up]) |
|
| 273 |
+~~~~ |
|
| 274 |
+**Parameters** |
|
| 275 |
+ |
|
| 276 |
+- ``ifname`` - interface name |
|
| 277 |
+- ``link_state`` - down or up |
|
| 278 |
+ |
|
| 279 |
+**Returns** |
|
| 280 |
+ |
|
| 281 |
+- success: 0 |
|
| 282 |
+- failure: exception |
|
| 283 |
+ |
|
| 284 |
+### set_link_up |
|
| 285 |
+ |
|
| 286 |
+Brings up the specified interface. |
|
| 287 |
+ |
|
| 288 |
+**Syntax** |
|
| 289 |
+~~~~ |
|
| 290 |
+net.set_link_up(ifname = interface_name) |
|
| 291 |
+~~~~ |
|
| 292 |
+**Parameters** |
|
| 293 |
+ |
|
| 294 |
+- ``ifname`` - interface name |
|
| 295 |
+- ``link_state`` - down or up |
|
| 296 |
+ |
|
| 297 |
+**Returns** |
|
| 298 |
+ |
|
| 299 |
+- success: 0 |
|
| 300 |
+- failure: exception |
|
| 301 |
+ |
|
| 302 |
+# IP Address Configuration |
|
| 303 |
+ |
|
| 304 |
+Use these commands to manage IP address configuration for a network interface. |
|
| 305 |
+ |
|
| 306 |
+### add_static_ipv6_addr |
|
| 307 |
+ |
|
| 308 |
+Add a static IPv6 address to the specified interface. |
|
| 309 |
+ |
|
| 310 |
+**Syntax** |
|
| 311 |
+~~~~ |
|
| 312 |
+net.add_static_ipv6_addr(ifname = interface_name, addr_prefix = ipv6address_prefix) |
|
| 313 |
+~~~~ |
|
| 314 |
+**Parameters** |
|
| 315 |
+ |
|
| 316 |
+- ``ifname`` - interface name |
|
| 317 |
+- ``addr_prefix`` - IPv6 address prefix |
|
| 318 |
+ |
|
| 319 |
+**Returns** |
|
| 320 |
+ |
|
| 321 |
+- success: 0 |
|
| 322 |
+- failure: exception |
|
| 323 |
+ |
|
| 324 |
+### del_static_ipv6_addr |
|
| 325 |
+ |
|
| 326 |
+Delete a static IPv6 address from the specified interface. |
|
| 327 |
+ |
|
| 328 |
+**Syntax** |
|
| 329 |
+~~~~ |
|
| 330 |
+net.del_static_ipv6_addr(ifname = interface_name, addr_prefix = ipv6address_prefix) |
|
| 331 |
+~~~~ |
|
| 332 |
+**Parameters** |
|
| 333 |
+ |
|
| 334 |
+- ``ifname`` - interface name |
|
| 335 |
+- ``addr_prefix`` - IPv6 address prefix |
|
| 336 |
+ |
|
| 337 |
+**Returns** |
|
| 338 |
+ |
|
| 339 |
+- success: 0 |
|
| 340 |
+- failure: exception |
|
| 341 |
+ |
|
| 342 |
+### get_ipv4_addr_gateway |
|
| 343 |
+ |
|
| 344 |
+Get the IPv4 address with the prefix and gateway for the specified interface. |
|
| 345 |
+ |
|
| 346 |
+**Syntax** |
|
| 347 |
+~~~~ |
|
| 348 |
+net.get_ipv4_addr_gateway(ifname = interface_name) |
|
| 349 |
+~~~~ |
|
| 350 |
+**Parameters** |
|
| 351 |
+ |
|
| 352 |
+- ``ifname`` - interface name |
|
| 353 |
+ |
|
| 354 |
+**Returns** |
|
| 355 |
+ |
|
| 356 |
+- success: IPv4 address with the prefix and gateway |
|
| 357 |
+- failure: exception |
|
| 358 |
+ |
|
| 359 |
+### get_ipv6_addr |
|
| 360 |
+ |
|
| 361 |
+Get the list of IPv6 addresses for the specified interface. |
|
| 362 |
+ |
|
| 363 |
+**Syntax** |
|
| 364 |
+~~~~ |
|
| 365 |
+net.get_ipv6_addr(ifname = interface_name) |
|
| 366 |
+~~~~ |
|
| 367 |
+**Parameters** |
|
| 368 |
+ |
|
| 369 |
+- ``ifname`` - interface name |
|
| 370 |
+ |
|
| 371 |
+**Returns** |
|
| 372 |
+ |
|
| 373 |
+- success: IPv6 address list |
|
| 374 |
+- failure: exception |
|
| 375 |
+ |
|
| 376 |
+### get_ipv6_addr_mode |
|
| 377 |
+ |
|
| 378 |
+Get the address mode for the specified interface to determine whether DHCPv6, autoconf are enabled or disabled. |
|
| 379 |
+ |
|
| 380 |
+**Syntax** |
|
| 381 |
+~~~~ |
|
| 382 |
+net.get_ipv6_addr_mode(ifname = interface_name) |
|
| 383 |
+~~~~ |
|
| 384 |
+**Parameters** |
|
| 385 |
+ |
|
| 386 |
+- ``ifname`` - interface name |
|
| 387 |
+ |
|
| 388 |
+**Returns** |
|
| 389 |
+ |
|
| 390 |
+- Status for DHCPv6, autoconf (True=enabled, False=disabled) |
|
| 391 |
+- failure: exception |
|
| 392 |
+ |
|
| 393 |
+### get_ipv6_gateway |
|
| 394 |
+ |
|
| 395 |
+Get the IPv6 gateway for the specified interface. |
|
| 396 |
+ |
|
| 397 |
+**Syntax** |
|
| 398 |
+~~~~ |
|
| 399 |
+net.get_ipv6_gateway(ifname = interface_name) |
|
| 400 |
+~~~~ |
|
| 401 |
+**Parameters** |
|
| 402 |
+ |
|
| 403 |
+- ``ifname`` - interface name |
|
| 404 |
+ |
|
| 405 |
+**Returns** |
|
| 406 |
+ |
|
| 407 |
+- success: IPv6 gateway |
|
| 408 |
+- failure: exception |
|
| 409 |
+ |
|
| 410 |
+### set_ipv4_addr_gateway |
|
| 411 |
+ |
|
| 412 |
+Set the IPv4 address with the prefix and gateway for the specified interface. |
|
| 413 |
+ |
|
| 414 |
+**Syntax** |
|
| 415 |
+~~~~ |
|
| 416 |
+net.get_ipv4_addr_gateway(ifname = interface_name, addr_mode = [dhcp, static, none], addr_prefix = ipv4addressprefix, gateway = ipv4gateway) |
|
| 417 |
+~~~~ |
|
| 418 |
+**Parameters** |
|
| 419 |
+ |
|
| 420 |
+- ``ifname`` - interface name |
|
| 421 |
+- ``addr_mode`` - address mode - dhcp, static, or none |
|
| 422 |
+- ``addr_prefix`` - IPv4 address or prefix |
|
| 423 |
+- ``gateway`` - IPv4 gateway |
|
| 424 |
+ |
|
| 425 |
+**Returns** |
|
| 426 |
+ |
|
| 427 |
+- success: 0 |
|
| 428 |
+- failure: exception |
|
| 429 |
+ |
|
| 430 |
+### set_ipv6_addr_mode |
|
| 431 |
+ |
|
| 432 |
+Set the address mode for the specified interface. |
|
| 433 |
+ |
|
| 434 |
+**Syntax** |
|
| 435 |
+~~~~ |
|
| 436 |
+net.set_ipv6_addr_mode(ifname = interface_name, enable_dhcp = [True, False], enable_autoconf = [True, False]) |
|
| 437 |
+~~~~ |
|
| 438 |
+**Parameters** |
|
| 439 |
+ |
|
| 440 |
+- ``ifname`` - interface name |
|
| 441 |
+- ``enable_dhcp`` - True to enable, False to disable |
|
| 442 |
+- ``enable_autoconf`` - True to enable, False to disable |
|
| 443 |
+ |
|
| 444 |
+**Returns** |
|
| 445 |
+ |
|
| 446 |
+- success: 0 |
|
| 447 |
+- failure: exception |
|
| 448 |
+ |
|
| 449 |
+### set_ipv6_gateway |
|
| 450 |
+ |
|
| 451 |
+Set the IPv6 gateway for the specified interface. |
|
| 452 |
+ |
|
| 453 |
+**Syntax** |
|
| 454 |
+~~~~ |
|
| 455 |
+net.set_ipv6_gateway(ifname = interface_name, gateway = ipv6gateway) |
|
| 456 |
+~~~~ |
|
| 457 |
+**Parameters** |
|
| 458 |
+ |
|
| 459 |
+- ``ifname`` - interface name |
|
| 460 |
+- ``gateway`` - IPv6 gateway |
|
| 461 |
+ |
|
| 462 |
+**Returns** |
|
| 463 |
+ |
|
| 464 |
+- success: 0 |
|
| 465 |
+- failure: exception |
|
| 466 |
+ |
|
| 467 |
+# DNS Configuration |
|
| 468 |
+ |
|
| 469 |
+Use these commands to manage DNS domains and servers for a network interface. |
|
| 470 |
+ |
|
| 471 |
+### get_dns_domains |
|
| 472 |
+ |
|
| 473 |
+Get the list of DNS domains for the specified interface. |
|
| 474 |
+ |
|
| 475 |
+**Syntax** |
|
| 476 |
+~~~~ |
|
| 477 |
+net.get_dns_domains(ifname = interface_name) |
|
| 478 |
+~~~~ |
|
| 479 |
+**Parameters** |
|
| 480 |
+ |
|
| 481 |
+- ``ifname`` - interface name |
|
| 482 |
+ |
|
| 483 |
+**Returns** |
|
| 484 |
+ |
|
| 485 |
+- success: list of DNS domains |
|
| 486 |
+- failure: exception |
|
| 487 |
+ |
|
| 488 |
+### get_dns_servers |
|
| 489 |
+ |
|
| 490 |
+Get the list of DNS servers and the mode for the specified interface. |
|
| 491 |
+ |
|
| 492 |
+**Syntax** |
|
| 493 |
+~~~~ |
|
| 494 |
+net.get_dns_servers(ifname = interface_name) |
|
| 495 |
+~~~~ |
|
| 496 |
+**Parameters** |
|
| 497 |
+ |
|
| 498 |
+- ``ifname`` - interface name |
|
| 499 |
+ |
|
| 500 |
+**Returns** |
|
| 501 |
+ |
|
| 502 |
+- success: list of DNS servers and mode |
|
| 503 |
+- failure: exception |
|
| 504 |
+ |
|
| 505 |
+### set_dns_domains |
|
| 506 |
+ |
|
| 507 |
+Set the list of DNS domains for the specified interface. |
|
| 508 |
+ |
|
| 509 |
+**Syntax** |
|
| 510 |
+~~~~ |
|
| 511 |
+net.set_dns_domains(domains = ["domain1","domain2",...], ifname = interface_name) |
|
| 512 |
+~~~~ |
|
| 513 |
+**Parameters** |
|
| 514 |
+ |
|
| 515 |
+- ``domains`` - comma-separated list of one or more domains |
|
| 516 |
+- ``ifname`` - interface name |
|
| 517 |
+ |
|
| 518 |
+**Returns** |
|
| 519 |
+ |
|
| 520 |
+- success: 0 |
|
| 521 |
+- failure: exception |
|
| 522 |
+ |
|
| 523 |
+### set_dns_servers |
|
| 524 |
+ |
|
| 525 |
+Set the list of DNS servers for the specified interface. |
|
| 526 |
+ |
|
| 527 |
+**Syntax** |
|
| 528 |
+~~~~ |
|
| 529 |
+net.set_dns_servers(dns_mode = [dhcp, static], servers = ["server1","server2", ...], ifname = interface_name) |
|
| 530 |
+~~~~ |
|
| 531 |
+**Parameters** |
|
| 532 |
+ |
|
| 533 |
+- ``dns_mode`` - dhcp or static |
|
| 534 |
+- ``servers`` - comma-separate list of one or more servers |
|
| 535 |
+- ``ifname`` - interface name |
|
| 536 |
+ |
|
| 537 |
+**Returns** |
|
| 538 |
+ |
|
| 539 |
+- success: 0 |
|
| 540 |
+- failure: exception |
|
| 541 |
+ |
|
| 542 |
+# DHCP Options DUID and IAID Configuration |
|
| 543 |
+ |
|
| 544 |
+### get_link_iaid |
|
| 545 |
+ |
|
| 546 |
+Get the IAID for the specified interface. |
|
| 547 |
+ |
|
| 548 |
+**Syntax** |
|
| 549 |
+~~~~ |
|
| 550 |
+net.get_link_iaid(ifname = interface) |
|
| 551 |
+~~~~ |
|
| 552 |
+**Parameters** |
|
| 553 |
+ |
|
| 554 |
+- ``ifname`` - interface name |
|
| 555 |
+ |
|
| 556 |
+**Returns** |
|
| 557 |
+ |
|
| 558 |
+- success: IAID |
|
| 559 |
+- failure: exception |
|
| 560 |
+ |
|
| 561 |
+### set_link_iaid |
|
| 562 |
+ |
|
| 563 |
+Set the IAID for the specified interface. |
|
| 564 |
+ |
|
| 565 |
+**Syntax** |
|
| 566 |
+~~~~ |
|
| 567 |
+net.set_link_iaid(ifname = interface_name, iaid = <iaid>) |
|
| 568 |
+~~~~ |
|
| 569 |
+**Parameters** |
|
| 570 |
+ |
|
| 571 |
+- ``ifname`` - interface name |
|
| 572 |
+- iaid - IAID |
|
| 573 |
+ |
|
| 574 |
+**Returns** |
|
| 575 |
+ |
|
| 576 |
+- success: 0 |
|
| 577 |
+- failure: exception |
|
| 578 |
+ |
|
| 579 |
+### get_dhcp_duid |
|
| 580 |
+ |
|
| 581 |
+Get the DCHP DUID. |
|
| 582 |
+ |
|
| 583 |
+**Syntax** |
|
| 584 |
+~~~~ |
|
| 585 |
+net.get_dhcp_duid(ifname = interface_name) |
|
| 586 |
+~~~~ |
|
| 587 |
+**Parameters** |
|
| 588 |
+ |
|
| 589 |
+- ``ifname`` - interface name (optional) |
|
| 590 |
+ |
|
| 591 |
+**Returns** |
|
| 592 |
+ |
|
| 593 |
+- success: DUID |
|
| 594 |
+- failure: exception |
|
| 595 |
+ |
|
| 596 |
+### set_dhcp_duid |
|
| 597 |
+ |
|
| 598 |
+Set the DCHP DUID. |
|
| 599 |
+ |
|
| 600 |
+**Syntax** |
|
| 601 |
+~~~~ |
|
| 602 |
+net.set_dhcp_duid(ifname = interface_name duid = duid) |
|
| 603 |
+~~~~ |
|
| 604 |
+**Parameters** |
|
| 605 |
+ |
|
| 606 |
+- ``ifname`` - interface name (optional) |
|
| 607 |
+- ``duid`` - DUID to set |
|
| 608 |
+ |
|
| 609 |
+**Returns** |
|
| 610 |
+ |
|
| 611 |
+- success: 0 |
|
| 612 |
+- failure: exception |
|
| 613 |
+ |
|
| 614 |
+# NTP Servers |
|
| 615 |
+ |
|
| 616 |
+Use these commands to manage the NTP servers list. |
|
| 617 |
+ |
|
| 618 |
+### add_ntp_servers |
|
| 619 |
+ |
|
| 620 |
+Add one or more NTP servers to the NTP servers list. |
|
| 621 |
+ |
|
| 622 |
+**Syntax** |
|
| 623 |
+~~~~ |
|
| 624 |
+net.add_ntp_servers(ntpservers = ["server1", "server2", ...]) |
|
| 625 |
+~~~~ |
|
| 626 |
+**Parameters** |
|
| 627 |
+ |
|
| 628 |
+- ``ntpservers`` - Comma-separated list of NTP servers to add to the list. |
|
| 629 |
+ |
|
| 630 |
+**Returns** |
|
| 631 |
+ |
|
| 632 |
+- success: 0 |
|
| 633 |
+- failure: exception |
|
| 634 |
+ |
|
| 635 |
+### del_ntp_servers |
|
| 636 |
+ |
|
| 637 |
+Remove one or more NTP servers from the NTP servers list. |
|
| 638 |
+ |
|
| 639 |
+**Syntax** |
|
| 640 |
+~~~~ |
|
| 641 |
+net.del_ntp_servers(ntpservers = ["server1", "server2", ...]) |
|
| 642 |
+~~~~ |
|
| 643 |
+**Parameters** |
|
| 644 |
+ |
|
| 645 |
+- ``ntpservers`` - Comma-separated list of NTP servers to remove from the list. |
|
| 646 |
+ |
|
| 647 |
+**Returns** |
|
| 648 |
+ |
|
| 649 |
+- success: 0 |
|
| 650 |
+- failure: exception |
|
| 651 |
+ |
|
| 652 |
+### get_ntp_servers |
|
| 653 |
+ |
|
| 654 |
+Get the NTP servers list. |
|
| 655 |
+ |
|
| 656 |
+**Syntax** |
|
| 657 |
+~~~~ |
|
| 658 |
+net.get_ntp_servers() |
|
| 659 |
+~~~~ |
|
| 660 |
+**Returns** |
|
| 661 |
+ |
|
| 662 |
+- success: NTP servers list |
|
| 663 |
+- failure: exception |
|
| 664 |
+ |
|
| 665 |
+### set_ntp_servers |
|
| 666 |
+ |
|
| 667 |
+Set the NTP servers list. |
|
| 668 |
+ |
|
| 669 |
+**Syntax** |
|
| 670 |
+~~~~ |
|
| 671 |
+net.set_ntp_servers(ntpservers = ["server1", "server2", ...]) |
|
| 672 |
+~~~~ |
|
| 673 |
+**Parameters** |
|
| 674 |
+ |
|
| 675 |
+- ``ntpservers`` - Comma-separated list of NTP servers to remove from the list. |
|
| 676 |
+ |
|
| 677 |
+**Returns** |
|
| 678 |
+ |
|
| 679 |
+- success: 0 |
|
| 680 |
+- failure: exception |
|
| 681 |
+ |
|
| 682 |
+### get_hostname |
|
| 683 |
+ |
|
| 684 |
+Get the host name. |
|
| 685 |
+ |
|
| 686 |
+**Syntax** |
|
| 687 |
+ |
|
| 688 |
+net.get_hostname() |
|
| 689 |
+ |
|
| 690 |
+**Returns** |
|
| 691 |
+ |
|
| 692 |
+- success: host name |
|
| 693 |
+- failure: exception |
|
| 694 |
+ |
|
| 695 |
+### set_hostname |
|
| 696 |
+ |
|
| 697 |
+Set the host name. |
|
| 698 |
+ |
|
| 699 |
+**Syntax** |
|
| 700 |
+~~~~ |
|
| 701 |
+net.set_hostname(hostname) |
|
| 702 |
+~~~~ |
|
| 703 |
+**Parameters** |
|
| 704 |
+ |
|
| 705 |
+- ``hostname`` - name to assign to the host |
|
| 706 |
+ |
|
| 707 |
+**Returns** |
|
| 708 |
+ |
|
| 709 |
+- success: 0 |
|
| 710 |
+- failure: exception |
|
| 711 |
+ |
|
| 712 |
+### wait_for_ip |
|
| 713 |
+ |
|
| 714 |
+Wait for the specified interface to acquire a valid IP address of the specified IP address type. |
|
| 715 |
+ |
|
| 716 |
+**Syntax** |
|
| 717 |
+~~~~ |
|
| 718 |
+net.wait_for_ip(ifname = interface_name, timeout = timeout, addrtypes = [ipv4, ipv6, static_ipv4, static_ipv6, dhcp_ipv4, dhcp_ipv6, auto_ipv6, link_local_ipv6]) |
|
| 719 |
+~~~~ |
|
| 720 |
+**Parameters** |
|
| 721 |
+ |
|
| 722 |
+- ``ifname`` - interface name |
|
| 723 |
+- ``timeout`` - maximum time (in seconds) to wait (until the link is up) before timing out of the request; specify 0 for no timeout (wait indefinitely) |
|
| 724 |
+- ``addrtypes`` - one of the following address types: ipv4, ipv6, static_ipv4, static_ipv6, dhcp_ipv4, dhcp_ipv6, auto_ipv6, or link_local_ipv6 |
|
| 725 |
+ |
|
| 726 |
+**Returns** |
|
| 727 |
+ |
|
| 728 |
+- success: 0 (when the link has an IP of the specified type) |
|
| 729 |
+- failure: exception (for example, timeout expired) |
|
| 730 |
+ |
|
| 731 |
+### wait_for_link_up |
|
| 732 |
+ |
|
| 733 |
+Wait for the specified interface to come up. |
|
| 734 |
+ |
|
| 735 |
+**Syntax** |
|
| 736 |
+~~~~ |
|
| 737 |
+net.wait_for_link_up(ifname = interface_name, timeout = timeout) |
|
| 738 |
+~~~~ |
|
| 739 |
+**Parameters** |
|
| 740 |
+ |
|
| 741 |
+- ``ifname`` - interface name |
|
| 742 |
+- ``timeout`` - maximum time (in seconds) to wait (until the link is up) before timing out of the request; specify 0 for no timeout (wait indefinitely) |
|
| 743 |
+ |
|
| 744 |
+**Returns** |
|
| 745 |
+ |
|
| 746 |
+- success: 0 (when link is up) |
|
| 747 |
+- failure: exception (for example, timeout expired) |
|
| 748 |
+ |
|
| 749 |
+### get_network_param |
|
| 750 |
+ |
|
| 751 |
+Get the specified network configuration parameter for the specified interface or filename. |
|
| 752 |
+ |
|
| 753 |
+**Syntax** |
|
| 754 |
+~~~~ |
|
| 755 |
+net.get_network_param(object = IfName or Filename, paramname = SectionName_KeyName) |
|
| 756 |
+~~~~ |
|
| 757 |
+**Parameters** |
|
| 758 |
+ |
|
| 759 |
+- ``object`` - an interface name (for example, "eth0") or a file name (for example, /etc/systemd/resolved.conf) |
|
| 760 |
+- ``paramname`` - name of a parameter associated with the object; specified in the format SectionName_KeyName (for example, Link_MTUBytes represents the MtuBytes key in [Link] section in [https://www.freedesktop.org/software/systemd/man/systemd.network.html](https://www.freedesktop.org/software/systemd/man/systemd.network.html)) |
|
| 761 |
+ |
|
| 762 |
+**Returns** |
|
| 763 |
+ |
|
| 764 |
+- success: 0 |
|
| 765 |
+- failure: exception |
|
| 766 |
+ |
|
| 767 |
+### set_network_param |
|
| 768 |
+ |
|
| 769 |
+Set the value of a network configuration parameter for the specified interface or filename. |
|
| 770 |
+ |
|
| 771 |
+**Syntax** |
|
| 772 |
+~~~~ |
|
| 773 |
+net.set_network_param(object = interface_name or filename, paramname = SectionName_KeyName, paramvalue = key_value) |
|
| 774 |
+~~~~ |
|
| 775 |
+**Parameters** |
|
| 776 |
+ |
|
| 777 |
+- ``object`` - an interface name (for example, "eth0") or a file name (for example, /etc/systemd/resolved.conf) |
|
| 778 |
+- ``paramname`` - name of a parameter associated with the object; specified in the format SectionName_KeyName (for example, Link_MTUBytes represents the MtuBytes key in [Link] section in [https://www.freedesktop.org/software/systemd/man/systemd.network.html](https://www.freedesktop.org/software/systemd/man/systemd.network.html)) |
|
| 779 |
+ |
|
| 780 |
+**Returns** |
|
| 781 |
+ |
|
| 782 |
+- success: 0 |
|
| 783 |
+- failure: exception |
|
| 0 | 784 |
\ No newline at end of file |
| ... | ... |
@@ -7,7 +7,8 @@ |
| 7 | 7 |
Version](#looking-at-the-differences-between-the-minimal-and-the-full-version) |
| 8 | 8 |
- [The Root Account and the `sudo` and `su` |
| 9 | 9 |
Commands](#the-root-account-and-the-sudo-and-su-commands) |
| 10 |
-- [Quick Start](#quick-start) |
|
| 10 |
+- [Getting Start for Photon OS 2.0](#getting-started-with-photon-os) |
|
| 11 |
+- [Quick Start for Photon OS 1.0](#quick-start-for-photon-os) |
|
| 11 | 12 |
- [Obtaining the ISO from Bintray and Creating a Photon OS VM |
| 12 | 13 |
in VMware |
| 13 | 14 |
Workstation](#obtaining-the-iso-from-bintray-and-creating-a-photon-os-vm-in-vmware-workstation) |
| ... | ... |
@@ -19,8 +20,6 @@ |
| 19 | 19 |
- [Root Password Rules](#root-password-rules) |
| 20 | 20 |
- [Permitting Root Login with |
| 21 | 21 |
SSH](#permitting-root-login-with-ssh) |
| 22 |
- - [Deploying Photon OS on a Mac with |
|
| 23 |
- AppCatalyst](#deploying-photon-os-on-a-mac-with-appcatalyst) |
|
| 24 | 22 |
- [PXE Boot](#pxe-boot) |
| 25 | 23 |
- [Kickstart](#kickstart) |
| 26 | 24 |
- [Checking the Version and Build |
| ... | ... |
@@ -37,6 +36,8 @@ |
| 37 | 37 |
Branch](#adding-the-dev-repository-to-get-new-packages-from-the-github-dev-branch) |
| 38 | 38 |
- [Managing Services with |
| 39 | 39 |
systemd](#managing-services-with-systemd) |
| 40 |
+ - [Using the Photon Management Daemon](#using-the-photon-management-daemon) |
|
| 41 |
+ - [Using the Network Configuration Manager](#using-the-network-configuration-manager) |
|
| 40 | 42 |
- [Viewing Services](#viewing-services) |
| 41 | 43 |
- [Controlling Services](#controlling-services) |
| 42 | 44 |
- [Creating a Startup Service](#creating-a-startup-service) |
| ... | ... |
@@ -193,20 +194,33 @@ A later section covers tdnf. |
| 193 | 193 |
|
| 194 | 194 |
This guide assumes that you are logged in to Photon OS with the root account and running commands as root. The sudo program comes with the full version of Photon OS. On the minimal version, you must install sudo with tdnf if you want to use it. As an alternative to installing sudo on the minimal version, you can switch users as needed with the `su` command to run commands that require root privileges. |
| 195 | 195 |
|
| 196 |
-## Quick Start |
|
| 196 |
+## Getting Started with Photon OS |
|
| 197 |
+ |
|
| 198 |
+**NOTE:** This section applies to Photon OS w.0 only. |
|
| 199 |
+ |
|
| 200 |
+To get started with Photon OS 2.0, refer to the installation instructions for your target environment: |
|
| 201 |
+- [Running Photon OS on VMware vSphere](#https://github.com/vmware/photon/wiki/Running-Photon-OS-on-vSphere) |
|
| 202 |
+- [Running Photon OS on VMware Fusion](#https://github.com/vmware/photon/wiki/Running-Project-Photon-on-Fusion) |
|
| 203 |
+- [Running Photon OS on VMware Workstation](#https://github.com/vmware/photon/wiki/Running-Photon-OS-on-vSphere) |
|
| 204 |
+- [Running Photon OS on Amazon EC2](#https://github.com/vmware/photon/wiki/Running-Photon-OS-on-Amazon-Elastic-Cloud-Compute) |
|
| 205 |
+- [Running Photon OS on Google Compute Engine](#https://github.com/vmware/photon/wiki/Running-Photon-OS-on-Google-Compute-Engine) |
|
| 206 |
+- [Running Photon OS on Microsoft Azure](#https://github.com/vmware/photon/wiki/Running-Photon-OS-on-Microsoft-Azure) |
|
| 207 |
+ |
|
| 208 |
+## Quick Start for Photon OS |
|
| 209 |
+ |
|
| 210 |
+**NOTE:** This section applies to Photon OS 1.0 only. |
|
| 197 | 211 |
|
| 198 | 212 |
This section helps you get Photon OS up and running quickly and easily. There are several ways to deploy Photon OS for free within a matter of minutes: |
| 199 | 213 |
|
| 200 | 214 |
* Obtain the ISO from Bintray and use it to create a virtual machine running Photon OS. |
| 201 | 215 |
* Install the OVA for the minimal version of Photon OS in VMware vSphere. |
| 202 | 216 |
* Rapidly deploy the OVA for the minimal version of Photon OS in VMware Workstation 12 Pro. |
| 203 |
-* Install VMware AppCatalyst for free on a Mac and launch a virtual machine running Photon OS, which is included with AppCatalyst. |
|
| 204 | 217 |
|
| 205 | 218 |
### Obtaining the ISO from Bintray and Creating a Photon OS VM in VMware Workstation |
| 206 | 219 |
|
| 207 | 220 |
The full version of Photon OS installs from an ISO in VMware Workstation and other hypervisors in a matter of minutes. Photon OS is a free download from the Bintray web site. |
| 208 | 221 |
|
| 209 |
-This section demonstrates how to create a virtual machine running Photon OS in VMware Workstation 12 Pro. If you are using a different hypervisor, the example set by this section should help you install it in your system. If you work on a Mac, see the section on deploying Photon OS on a Mac with VMware AppCatalyst below. For instructions on how to install Photon OS from an ISO in VMware vSphere, see [Installing Photon OS on VMware vSphere from an ISO Image](https://github.com/vmware/photon/wiki/Running-Project-Photon-on-vSphere). |
|
| 222 |
+This section demonstrates how to create a virtual machine running Photon OS in VMware Workstation 12 Pro. If you are using a different hypervisor, the example set by this section should help you install it in your system. For instructions on how to install Photon OS from an ISO in VMware vSphere, see [Installing Photon OS on VMware vSphere from an ISO Image](https://github.com/vmware/photon/wiki/Running-Project-Photon-on-vSphere). |
|
| 210 | 223 |
|
| 211 | 224 |
1. Go to the following Bintray URL and download the ISO for the general availability release of Photon OS: |
| 212 | 225 |
|
| ... | ... |
@@ -308,63 +322,6 @@ You can then connect to the Photon OS machine with the root account over SSH: |
| 308 | 308 |
|
| 309 | 309 |
steve@ubuntu:~$ ssh root@198.51.100.131 |
| 310 | 310 |
|
| 311 |
-### Deploying Photon OS on a Mac with AppCatalyst |
|
| 312 |
- |
|
| 313 |
-VMware AppCatalyst brings the data center to your Mac desktop. AppCatalyst furnishes a Mac computer with a free hypervisor for creating virtual machines that run Photon OS, which is bundled with AppCatalyst. |
|
| 314 |
- |
|
| 315 |
-Driven by an API and a command-line interface, AppCatalyst empowers you to replicate a cluster of virtual machines on a Mac to build containerized applications with microservices on Photon OS. AppCatalyst also integrates with Vagrant. AppCatalyst is a technology preview. |
|
| 316 |
- |
|
| 317 |
-AppCatalyst is optimized for cloud-native application workloads. A common use case of developers is to run a desktop hypervisor so they can install a Linux machine, and for many developers, this setup takes place on a Mac. For these developers, a common use case for the desktop hypervisor is running Docker to accelerate the development and testing of their code. |
|
| 318 |
- |
|
| 319 |
-By bundling Photon OS with AppCatalyst, VMware streamlines the workflow of getting a Docker engine running on a Linux machine inside a hypervisor on a Mac. |
|
| 320 |
- |
|
| 321 |
-Here's how to install AppCatalyst, create a VM running Photon OS, and run a Docker container--all in a matter of minutes. The technology preview version of AppCatalyst requires Mac OS X 10.9 or later. |
|
| 322 |
- |
|
| 323 |
-First, turn off Fusion if you are running it on your Mac. |
|
| 324 |
- |
|
| 325 |
-Second, download AppCatalyst from the following URL and then install the `.dmg` file by following the instructions in the installation wizard: |
|
| 326 |
- |
|
| 327 |
- https://www.vmware.com/cloudnative/appcatalyst-download |
|
| 328 |
- |
|
| 329 |
-After the wizard finishes installing AppCatalyst, you're ready to run the application. AppCatalyst does not appear in the Applications directory. Instead, in Terminal, run the following command: |
|
| 330 |
- |
|
| 331 |
- /opt/vmware/appcatalyst/bin/appcatalyst |
|
| 332 |
- |
|
| 333 |
-The following command creates a VM named `photonos1` by taking advantage of the template for Photon OS that is built into AppCatalyst: |
|
| 334 |
- |
|
| 335 |
- /opt/vmware/appcatalyst/bin/appcatalyst vm create photonos1 |
|
| 336 |
- |
|
| 337 |
-By default, the VMs that you create reside in the `AppCatalyst` subdirectory of the user's `/Documents` directory. |
|
| 338 |
- |
|
| 339 |
-Next, make sure that there are no machines running in VMware Fusion and that it is shut down, and then turn on the VM by running this command. |
|
| 340 |
- |
|
| 341 |
- /opt/vmware/appcatalyst/bin/appcatalyst vmpower on photonos1 |
|
| 342 |
- |
|
| 343 |
-Obtain the IP address of the VM so you can establish an SSH connection to it: |
|
| 344 |
- |
|
| 345 |
- /opt/vmware/appcatalyst/bin/appcatalyst guest getip photonos1 |
|
| 346 |
- |
|
| 347 |
-You can then connect to the VM with the SSH keys included with AppCatalyst by running the following command and replacing the example IP address with the IP address of your VM: |
|
| 348 |
- |
|
| 349 |
- ssh -i /opt/vmware/appcatalyst/etc/appcatalyst_insecure_ssh_key photon@198.51.100.131 |
|
| 350 |
- |
|
| 351 |
-Photon OS includes Docker. From your SSH terminal connection to the Photon OS virtual machine, you can launch a Docker container that, for example, downloads Ubuntu from the Docker repository and runs it in the Photon OS VM in AppCatalyst on your Mac: |
|
| 352 |
- |
|
| 353 |
- systemctl start docker |
|
| 354 |
- docker run -i -t ubuntu:14.04 /bin/bash |
|
| 355 |
- |
|
| 356 |
-When you are done, exit the Ubuntu machine to stop the Docker container to conserve system resources. |
|
| 357 |
- |
|
| 358 |
-Photon OS also gives you the option of running a Docker container that, in turn, runs an instance of Photon OS: |
|
| 359 |
- |
|
| 360 |
- docker run -i -t photon /bin/bash |
|
| 361 |
- |
|
| 362 |
-If you need to troubleshoot, the log files for AppCatalyst reside here: |
|
| 363 |
- |
|
| 364 |
- /Users/<your_username>/Library/Logs/VMware |
|
| 365 |
- |
|
| 366 |
-Virtual machines in AppCatalyst can be managed through its API. For more information, see the [AppCatalyst documentation](http://getappcatalyst.com/docs/Tech_Preview_August/) and the [AppCatalyst community site](https://communities.vmware.com/community/vmtn/devops/vmware-appcatalyst). |
|
| 367 |
- |
|
| 368 | 311 |
### PXE Boot |
| 369 | 312 |
|
| 370 | 313 |
Photon OS works with the Preboot Execution Environment, or PXE, to boot by retrieving software from a PXE server over a network connection. For instructions on how to set Photon OS to boot from a PXE server, see [Network PXE Boot](https://github.com/vmware/photon/blob/master/docs/PXE-boot.md). |
| ... | ... |
@@ -394,9 +351,7 @@ You can view its help information like this: |
| 394 | 394 |
tdnf --help |
| 395 | 395 |
tdnf -h |
| 396 | 396 |
|
| 397 |
-In the minimal version of Photon OS, tdnf serves as the sole package manager to streamline the operating system. The full version of Photon OS includes yum, a common utility that checks for, downloads, and automatically installs RPM packages. On the minimal version of Photon OS, you can install yum by using tdnf if you are unconcerned with the size of the operating system: |
|
| 398 |
- |
|
| 399 |
- tdnf install yum |
|
| 397 |
+**Photon OS 1.0 only**: In the minimal version of Photon OS, tdnf serves as the sole package manager to streamline the operating system. The full version of Photon OS includes yum, a common utility that checks for, downloads, and automatically installs RPM packages. On the minimal version of Photon OS, you can install yum by using tdnf if you are unconcerned with the size of the operating system: ``tdnf install yum`` |
|
| 400 | 398 |
|
| 401 | 399 |
### Configuration Files and Repositories |
| 402 | 400 |
|
| ... | ... |
@@ -421,20 +376,23 @@ The repositories appear in /etc/yum.repos.d/ with `.repo` file extensions: |
| 421 | 421 |
photon-updates.repo |
| 422 | 422 |
photon.repo |
| 423 | 423 |
|
| 424 |
+**Note:** Photon OS 1.0 (only) also includes the lightwave.repo. |
|
| 425 |
+ |
|
| 424 | 426 |
You can list the the repositories by using the `tdnf repolist` command. Tdnf filters the results with `enabled`, `disabled`, and `all`. Running the command without specifying an argument returns the enabled repositories: |
| 425 | 427 |
|
| 426 | 428 |
tdnf repolist |
| 427 | 429 |
repo id repo name status |
| 428 |
- lightwave VMware Lightwave 1.0(x86_64) enabled |
|
| 429 |
- photon-updates VMware Photon Linux 1.0(x86_64)Updates enabled |
|
| 430 |
- photon-extras VMware Photon Extras 1.0(x86_64) enabled |
|
| 431 |
- photon VMware Photon Linux 1.0(x86_64) enabled |
|
| 430 |
+ photon-updates VMware Photon Linux 2.0(x86_64)Updates enabled |
|
| 431 |
+ photon-extras VMware Photon Extras 2.0(x86_64) enabled |
|
| 432 |
+ photon VMware Photon Linux 2.0(x86_64) enabled |
|
| 433 |
+ |
|
| 434 |
+**Note:** Photon OS 1.0 (only) also includes the lightwave repository. |
|
| 432 | 435 |
|
| 433 | 436 |
The photon-iso.repo, however, does not appear in the list of repositories because it is unavailable on the virtual machine from which these examples are taken. Photon-iso.repo is the default repository; it points to /media/cdrom. The contents of photon-iso.repo look like this: |
| 434 | 437 |
|
| 435 | 438 |
cat /etc/yum.repos.d/photon-iso.repo |
| 436 | 439 |
[photon-iso] |
| 437 |
- name=VMWare Photon Linux 1.0(x86_64) |
|
| 440 |
+ name=VMWare Photon Linux 2.0(x86_64) |
|
| 438 | 441 |
baseurl=file:///mnt/cdrom/RPMS |
| 439 | 442 |
gpgkey=file:///etc/pki/rpm-gpg/VMWARE-RPM-GPG-KEY |
| 440 | 443 |
gpgcheck=1 |
| ... | ... |
@@ -464,19 +422,21 @@ The command purges the repository data from the cache: |
| 464 | 464 |
|
| 465 | 465 |
You can add the following options to `tdnf` commands. If the option to override a configuration is unavailable in a command, consider adding it to the configuration file, /etc/tdnf/tdnf.conf. |
| 466 | 466 |
|
| 467 |
- OPTION DESCRIPTION |
|
| 468 |
- --allowerasing Allow erasing of installed packages to resolve dependencies |
|
| 469 |
- --assumeno Answer no for all questions |
|
| 470 |
- --best Try the best available package versions in transactions |
|
| 471 |
- --debugsolver Dump data aiding in dependency solver debugging info. |
|
| 472 |
- --disablerepo=<repoid> Disable specific repositories by an id or a glob. |
|
| 473 |
- --enablerepo=<repoid> Enable specific repositories |
|
| 474 |
- -h, --help Display help |
|
| 475 |
- --refresh Set metadata as expired before running command |
|
| 476 |
- --nogpgcheck Skip gpg check on packages |
|
| 477 |
- --rpmverbosity=<debug level name> Debug level for rpm |
|
| 478 |
- --version Print version and exit |
|
| 479 |
- -y, --assumeyes Answer yes to all questions |
|
| 467 |
+ OPTION DESCRIPTION |
|
| 468 |
+ --allowerasing Allow erasing of installed packages to resolve dependencies |
|
| 469 |
+ --assumeno Answer no for all questions |
|
| 470 |
+ --best Try the best available package versions in transactions |
|
| 471 |
+ --debugsolver Dump data aiding in dependency solver debugging info. |
|
| 472 |
+ --disablerepo=<repoid> Disable specific repositories by an id or a glob. |
|
| 473 |
+ --enablerepo=<repoid> Enable specific repositories |
|
| 474 |
+ -h, --help Display help |
|
| 475 |
+ --refresh Set metadata as expired before running command |
|
| 476 |
+ --nogpgcheck Skip gpg check on packages |
|
| 477 |
+ --rpmverbosity=<debug level name> |
|
| 478 |
+ Debug level for rpm |
|
| 479 |
+ --version Print version and exit |
|
| 480 |
+ -y, --assumeyes Answer yes to all questions |
|
| 481 |
+ -q, --quiet Quiet operation |
|
| 480 | 482 |
|
| 481 | 483 |
Here is an example that adds the short form of the `assumeyes` option to the install command: |
| 482 | 484 |
|
| ... | ... |
@@ -487,6 +447,8 @@ Here is an example that adds the short form of the `assumeyes` option to the ins |
| 487 | 487 |
|
| 488 | 488 |
### Commands |
| 489 | 489 |
|
| 490 |
+**check**: Checks for problems in installed and available packages for all enabled repositories. Command has no arguments. You can use ``--enablerepo`` and ``--disablerepo`` to control the repos used. Supported in Photon OS 2.0 (only). |
|
| 491 |
+ |
|
| 490 | 492 |
**check-local**: This command resolves dependencies by using the local RPMs to help check RPMs for quality assurance before publishing them. To check RPMs with this command, you must create a local directory and place your RPMs in it. The command, which includes no options, takes the path to the local directory containing the RPMs as its argument. The command does not, however, recursively parse directories; it checks the RPMs only in the directory that you specify. For example, after creating a directory named `/tmp/myrpms` and placing your RPMs in it, you can run the following command to check them: |
| 491 | 493 |
|
| 492 | 494 |
tdnf check-local /tmp/myrpms |
| ... | ... |
@@ -911,6 +873,80 @@ Here is a healthy result of the command: |
| 911 | 911 |
|
| 912 | 912 |
Because Photon OS relies on systemd to manage services, you should employ the systemd suite of commands, not deprecated init.d commands or other deprecated commands, to manage networking. |
| 913 | 913 |
|
| 914 |
+### Using the Photon Management Daemon |
|
| 915 |
+ |
|
| 916 |
+The Photon Management Daemon (PMD) that ships with Photon OS 2.0 provides the remote management of a Photon instance via several APIs: a command line client (pmd-cli), a REST API, and a Python API. The PMD provides the ability to manage network interfaces, packages, firewalls, users, and user groups. |
|
| 917 |
+ |
|
| 918 |
+#### Installing the pmd Package |
|
| 919 |
+ |
|
| 920 |
+The pmd package is included with your Photon OS 2.0 distribution. To make sure that you have the latest version, you can run: |
|
| 921 |
+~~~~ |
|
| 922 |
+# tdnf install pmd |
|
| 923 |
+# systemctl start pmd |
|
| 924 |
+~~~~ |
|
| 925 |
+#### Available APIs |
|
| 926 |
+ |
|
| 927 |
+##### pmd-cli |
|
| 928 |
+ |
|
| 929 |
+The pmd-cli utility enables Photon customers to invoke API requests securely on local and remote servers. For details, see [Photon Management Daemon Command-line Interface (pmd-cli)](#https://github.com/vmware/photon/blob/master/docs/pmd-cli.md). |
|
| 930 |
+ |
|
| 931 |
+##### PMD REST API |
|
| 932 |
+ |
|
| 933 |
+The PMD REST API is an openapi 2.0 specification. Once the pmd package is installed, you can use a Swagger UI tool to browse the REST API specifications (/etc/pmd/restapispec.json). |
|
| 934 |
+You can also browse it using the copenapi_cli tool that comes with the pmd package: |
|
| 935 |
+~~~~ |
|
| 936 |
+# copenapi_cli --apispec /etc/pmd/restapispec.json |
|
| 937 |
+~~~~ |
|
| 938 |
+For more information about the copenapi_cli tool, refer to [github.com/vmware/copenapi](#https://github.com/vmware/copenapi). |
|
| 939 |
+ |
|
| 940 |
+##### PMD Python API |
|
| 941 |
+ |
|
| 942 |
+Python3 is included with your Photon OS 2.0 distribution. PMD Python interfaces are available for python3 (pmd-python3) and python2 (pmd-python2). You can use tdnf to ensure that the latest version is installed: |
|
| 943 |
+~~~~ |
|
| 944 |
+# tdnf install pmd-python3 |
|
| 945 |
+# systemctl start pmd |
|
| 946 |
+~~~~ |
|
| 947 |
+To navigate the help documentation for the pmd Python packages: |
|
| 948 |
+~~~~ |
|
| 949 |
+# python3 |
|
| 950 |
+>>> import pmd |
|
| 951 |
+>>> net = pmd.server().net |
|
| 952 |
+>>> help(pmd) |
|
| 953 |
+~~~~ |
|
| 954 |
+To show help text for individual interfaces: |
|
| 955 |
+~~~~ |
|
| 956 |
+>>> help(pmd.server().net) |
|
| 957 |
+>>> help(pmd.server().pkg) |
|
| 958 |
+>>> help(pmd.server().firewall) |
|
| 959 |
+>>> help(pmd.server().user) |
|
| 960 |
+~~~~ |
|
| 961 |
+For details about the network commands, see also the [Network Configuration Manager - Python API](#https://github.com/vmware/photon/blob/master/docs/netmgr.python.md). |
|
| 962 |
+ |
|
| 963 |
+##### PMD C Documentation |
|
| 964 |
+ |
|
| 965 |
+PMD C APIs are defined in the header files (pmd_fwmgmt.h, pmd_netmgr.h, pmd_pkgmgmt.h, pmd_usermgmt.h) that are stored in the following location: |
|
| 966 |
+~~~~ |
|
| 967 |
+[https://github.com/vmware/pmd/tree/master/include](#https://github.com/vmware/pmd/tree/master/include) |
|
| 968 |
+~~~~ |
|
| 969 |
+For details about the network commands, see also the [Network Configuration Manager - C API](#https://github.com/vmware/photon/blob/master/docs/netmgr.c.md). |
|
| 970 |
+ |
|
| 971 |
+### Using the Network Configuration Manager |
|
| 972 |
+ |
|
| 973 |
+The Network Configuration Manager library that ships with Photon OS 2.0 provides a collection of C, Python, and CLI APIs that simplify common onfiguration tasks for: |
|
| 974 |
+- interfaces |
|
| 975 |
+- IP addresses (IPv4 and IPv6 addresses) |
|
| 976 |
+- routes |
|
| 977 |
+- DNS server and domain settings |
|
| 978 |
+- DHCP DUID and IAID settings |
|
| 979 |
+- NTP server settings |
|
| 980 |
+- service management |
|
| 981 |
+- object parameters (interfaces and files) |
|
| 982 |
+ |
|
| 983 |
+For additional details, see: |
|
| 984 |
+- **CLI** - see the ``-net`` commands in the [Photon Management Daemon Command-line Interface (pmd-cli)](#https://github.com/vmware/photon/blob/master/docs/pmd-cli.md) |
|
| 985 |
+- **C APIs** - [Network Configuration Manager - C API](#https://github.com/vmware/photon/blob/master/docs/netmgr.c.md) |
|
| 986 |
+- **Python APIs** - [Network Configuration Manager - Python API](#https://github.com/vmware/photon/blob/master/docs/netmgr.python.md) |
|
| 987 |
+ |
|
| 914 | 988 |
### Use `ip` and `ss` Commands Instead of `ifconfig` and `netstat` |
| 915 | 989 |
|
| 916 | 990 |
Although the `ifconfig` command and the `netstat` command work on Photon OS, VMware recommends that you use the `ip` or `ss` commands. The `ipconfig` and `netstat` commands are deprecated. |
| 917 | 991 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,481 @@ |
| 0 |
+# Photon Management Daemon Command-line Interface (pmd-cli) |
|
| 1 |
+ |
|
| 2 |
+Photon OS 2.0 provides the Photon Management Daemon command line interface (pmd-cli). |
|
| 3 |
+ |
|
| 4 |
+- [Setup Steps](#setup-steps) |
|
| 5 |
+- [Syntax](#syntax) |
|
| 6 |
+- [Firewall Management](#firewall-management) |
|
| 7 |
+- [Network Management](#network-management) |
|
| 8 |
+- [Package Management](#package-management) |
|
| 9 |
+- [User Management](#user-management) |
|
| 10 |
+ |
|
| 11 |
+# Setup Steps |
|
| 12 |
+ |
|
| 13 |
+The pmd-cli utility is included with your Photon OS 2.0 distribution. To make sure that you have the latest version, you can run: |
|
| 14 |
+~~~~ |
|
| 15 |
+tndf install pmd-cli |
|
| 16 |
+~~~~ |
|
| 17 |
+# Syntax |
|
| 18 |
+~~~~ |
|
| 19 |
+pmd-cli [connection_auth_options] <component> <command> [command_options] |
|
| 20 |
+~~~~ |
|
| 21 |
+Passed-in parameter values can be enclosed in single (') or double-quotes (") as long as you use matching characters to denote the beginning and end of the value. Unless a parameter value contains special characters or spaces, you can also omit quotes altogether. |
|
| 22 |
+ |
|
| 23 |
+## Connection / Authorization Options |
|
| 24 |
+ |
|
| 25 |
+### Local Connections |
|
| 26 |
+ |
|
| 27 |
+For local connections, you omit the connection and authorization options: |
|
| 28 |
+~~~~ |
|
| 29 |
+pmd-cli <component> <cmd> <options> |
|
| 30 |
+~~~~ |
|
| 31 |
+Permissions for the currently logged-in user apply when executing commands. This is the same as specifying --servername localhost. |
|
| 32 |
+ |
|
| 33 |
+### Remote Connections |
|
| 34 |
+ |
|
| 35 |
+For connecting to a remote server (a server other than the local server), you specify two connection / authorization options: |
|
| 36 |
+ |
|
| 37 |
+- ``--servername``: name of the server |
|
| 38 |
+- ``--user``: username of a user account on the server |
|
| 39 |
+ |
|
| 40 |
+**Note:** For authentication, you can specify the username (–user <username>) on the command line, but never the password. For security reasons, the system must prompt you for the password. |
|
| 41 |
+ |
|
| 42 |
+What follows are three options for remote connections. |
|
| 43 |
+ |
|
| 44 |
+**System User** |
|
| 45 |
+~~~~ |
|
| 46 |
+pmd-cli --servername <server> --user <username> |
|
| 47 |
+~~~~ |
|
| 48 |
+**Lightwave User** |
|
| 49 |
+ |
|
| 50 |
+Before using this method, the pmd server must be joined or should be part of embedded Lightwave. |
|
| 51 |
+~~~~ |
|
| 52 |
+pmd-cli --servername <server> --user <username> --domain <lightwave_domain> |
|
| 53 |
+~~~~ |
|
| 54 |
+**Kerberos spn** |
|
| 55 |
+ |
|
| 56 |
+Before using this method, the client must run kinit successfully. |
|
| 57 |
+~~~~ |
|
| 58 |
+pmd-cli --servername <server> --spn <service_principal_name> |
|
| 59 |
+~~~~ |
|
| 60 |
+## Component |
|
| 61 |
+ |
|
| 62 |
+``<component>`` is one of the following values: |
|
| 63 |
+ |
|
| 64 |
+- ``firewall`` |
|
| 65 |
+- ``net`` |
|
| 66 |
+- ``pkg`` |
|
| 67 |
+- ``usr`` |
|
| 68 |
+ |
|
| 69 |
+# Firewall Management |
|
| 70 |
+ |
|
| 71 |
+The Photon Management Daemon provides CLI commands to help you get information about the firewall. |
|
| 72 |
+ |
|
| 73 |
+## Syntax |
|
| 74 |
+~~~~ |
|
| 75 |
+pmd-cli [connection_auth_options] firewall <command> [command_options] |
|
| 76 |
+~~~~ |
|
| 77 |
+## firewall help |
|
| 78 |
+ |
|
| 79 |
+Get help for firewall CLI commands. |
|
| 80 |
+~~~~ |
|
| 81 |
+pmd-cli firewall help |
|
| 82 |
+~~~~ |
|
| 83 |
+## firewall rules |
|
| 84 |
+ |
|
| 85 |
+Get a list of the current persistent firewall rules. |
|
| 86 |
+~~~~ |
|
| 87 |
+pmd-cli firewall rules [command-options] |
|
| 88 |
+~~~~ |
|
| 89 |
+This command returns information about each firewall rule, such as the chain to which it belongs, the policy to enforce, the table to manipulate, and so on. |
|
| 90 |
+ |
|
| 91 |
+Add a new firewall rule. |
|
| 92 |
+~~~~ |
|
| 93 |
+pmd-cli firewall rules --chain <chain_name> --add <rule_specification> |
|
| 94 |
+~~~~ |
|
| 95 |
+Example: |
|
| 96 |
+~~~~ |
|
| 97 |
+pmd-cli firewall rules --chain INPUT --add "-p tcp -m tcp --dport 21 -j ACCEPT" |
|
| 98 |
+~~~~ |
|
| 99 |
+**Note:** To confirm that the firewall rule was added, run iptables -S. Running pmd-cli firewall rules lists only persistent rules. |
|
| 100 |
+ |
|
| 101 |
+Delete a new firewall rule. |
|
| 102 |
+~~~~ |
|
| 103 |
+pmd-cli firewall rules --chain <chain_name> --delete <rule_specification> |
|
| 104 |
+~~~~ |
|
| 105 |
+**Note:** To confirm that the firewall rule was removed, run iptables -S. Running pmd-cli firewall rules lists only persistent rules. |
|
| 106 |
+ |
|
| 107 |
+## firewall version |
|
| 108 |
+ |
|
| 109 |
+Get the version number of the fwmgmt component on the server. |
|
| 110 |
+~~~~ |
|
| 111 |
+pmd-cli firewall version |
|
| 112 |
+~~~~ |
|
| 113 |
+# Network Management |
|
| 114 |
+ |
|
| 115 |
+The Photon Management Daemon provides CLI commands to help you manage network interfaces. |
|
| 116 |
+ |
|
| 117 |
+## Syntax |
|
| 118 |
+~~~~ |
|
| 119 |
+pmd-cli [connection_auth_options] net <command> [command_options] |
|
| 120 |
+~~~~ |
|
| 121 |
+Many of these commands require the interface name (–interface <ifname>). IP addresses can be specified in dot-decimal notation or as prefixes. Other command options are described below. |
|
| 122 |
+ |
|
| 123 |
+## net link_info |
|
| 124 |
+ |
|
| 125 |
+Get the mac address, mtu, link state, and link mode for the specified interface. |
|
| 126 |
+~~~~ |
|
| 127 |
+pmd-cli net link_info --get --interface <ifame> |
|
| 128 |
+~~~~ |
|
| 129 |
+Set the MAC address, mode (manual or auto), link state (up or down), link mode (manual or auto), and MTU for the specified interface. |
|
| 130 |
+~~~~ |
|
| 131 |
+pmd-cli net link_info --set --interface <ifname> --macaddr <mac_address> --mode <manual|auto> --state <up|down> --mtu <mtu> |
|
| 132 |
+~~~~ |
|
| 133 |
+## net ip4_address |
|
| 134 |
+ |
|
| 135 |
+Get the IPv4 address for the specified interface. |
|
| 136 |
+~~~~ |
|
| 137 |
+pmd-cli net ip4_address --get --interface <ifame> |
|
| 138 |
+~~~~ |
|
| 139 |
+Set the IPv4 address (dot-decimal or prefix notation), mode (dhcp, static, or none), and (optionally) the default gateway for the specified interface. |
|
| 140 |
+~~~~ |
|
| 141 |
+pmd-cli net ip4_address --set --interface <ifname> --mode <dhcp|static|none> --addr <IPv4Address/prefix> --gateway <gateway_address> |
|
| 142 |
+~~~~ |
|
| 143 |
+## net ip6_address |
|
| 144 |
+ |
|
| 145 |
+Get IPv6 address(es) for the specified interface. |
|
| 146 |
+~~~~ |
|
| 147 |
+pmd-cli net ip6_address --get --interface <ifame> |
|
| 148 |
+~~~~ |
|
| 149 |
+Add one or more IPv6 addresses (comma-separated list in dot-decimal or prefix notation) to the specified interface. |
|
| 150 |
+~~~~ |
|
| 151 |
+pmd-cli net ip6_address --add --interface <ifame> --addrlist <IPv6Addr1/prefix,IPv6Addr2/prefix,...> |
|
| 152 |
+~~~~ |
|
| 153 |
+Delete one or more IPv6 addresses (comma-separated list in dot-decimal or prefix notation) from the specified interface. |
|
| 154 |
+~~~~ |
|
| 155 |
+pmd-cli net ip6_address --del --interface <ifame> --addrlist <IPv6Addr1/prefix,IPv6Addr2/prefix,...> |
|
| 156 |
+~~~~ |
|
| 157 |
+Set the DHCP mode (1=enable, 0=disable) and autoconfigure settings (1=enable, 0=disable) for the specified interface. |
|
| 158 |
+~~~~ |
|
| 159 |
+pmd-cli net ip6_address --set --interface <ifname> --dhcp <1|0> --autoconf <1|0> |
|
| 160 |
+~~~~ |
|
| 161 |
+## net ip_route |
|
| 162 |
+ |
|
| 163 |
+Get the static IP route for the specified interface. |
|
| 164 |
+~~~~ |
|
| 165 |
+pmd-cli net ip_route --get --interface <ifame> |
|
| 166 |
+~~~~ |
|
| 167 |
+Add the static IP route (gateway IP, destination network, and metric) to the specified interface. |
|
| 168 |
+~~~~ |
|
| 169 |
+pmd-cli net ip_route --add --interface <ifname> --gateway <GatewayIP> --destination <DestinationNetwork/prefix> --metric <N> |
|
| 170 |
+~~~~ |
|
| 171 |
+Delete the specified static IP route from the specified interface. |
|
| 172 |
+~~~~ |
|
| 173 |
+pmd-cli net ip_route --del --interface <ifname> --destination <DestIP/N> |
|
| 174 |
+~~~~ |
|
| 175 |
+## net dns_servers |
|
| 176 |
+ |
|
| 177 |
+Get the list of DNS servers. |
|
| 178 |
+~~~~ |
|
| 179 |
+pmd-cli net dns_servers --get |
|
| 180 |
+~~~~ |
|
| 181 |
+Set the DNS mode (dhcp or static) for one or more DNS servers (comma-separated list). |
|
| 182 |
+~~~~ |
|
| 183 |
+pmd-cli net dns_servers --set --mode <dhcp|static> --servers <server1,server2,...> |
|
| 184 |
+~~~~ |
|
| 185 |
+Add a DNS server to the list of DNS servers. |
|
| 186 |
+~~~~ |
|
| 187 |
+pmd-cli net dns_servers --add --servers <server> |
|
| 188 |
+~~~~ |
|
| 189 |
+Remove the specified DNS server from the list of DNS servers. |
|
| 190 |
+~~~~ |
|
| 191 |
+pmd-cli net dns_servers --del --servers <server> |
|
| 192 |
+~~~~ |
|
| 193 |
+## net dns_domains |
|
| 194 |
+ |
|
| 195 |
+Get the list of DNS domains. |
|
| 196 |
+~~~~ |
|
| 197 |
+pmd-cli net dns_domains --get |
|
| 198 |
+~~~~ |
|
| 199 |
+Set the list of DNS domains (one or more DNS domains in a comma-separated list). |
|
| 200 |
+~~~~ |
|
| 201 |
+pmd-cli net dns_domains --set --domains <domain1,domain2,...> |
|
| 202 |
+~~~~ |
|
| 203 |
+Add a DNS domain to the list of DNS domains. |
|
| 204 |
+~~~~ |
|
| 205 |
+pmd-cli net dns_domains --add --domains <domain1> |
|
| 206 |
+~~~~ |
|
| 207 |
+Delete a DNS domain from the list of DNS domains. |
|
| 208 |
+~~~~ |
|
| 209 |
+pmd-cli net dns_domains --del --domains <domain1> |
|
| 210 |
+~~~~ |
|
| 211 |
+## net dhcp_duid |
|
| 212 |
+ |
|
| 213 |
+Get the DHCP DUID per interface for all interfaces in the system. |
|
| 214 |
+~~~~ |
|
| 215 |
+pmd-cli net dhcp_duid --get |
|
| 216 |
+~~~~ |
|
| 217 |
+Set the DHCP DUID for all interfaces in the system. |
|
| 218 |
+~~~~ |
|
| 219 |
+pmd-cli net dhcp_duid --set --duid <duid> |
|
| 220 |
+~~~~ |
|
| 221 |
+## net if_iaid |
|
| 222 |
+ |
|
| 223 |
+Get the IAID for the specified interface. |
|
| 224 |
+~~~~ |
|
| 225 |
+pmd-cli net if_iaid --get --interface <ifname> |
|
| 226 |
+~~~~ |
|
| 227 |
+Set the IAID for the specified interface. |
|
| 228 |
+~~~~ |
|
| 229 |
+pmd-cli net if_iaid --set --interface <ifname> --iaid <iaid> |
|
| 230 |
+~~~~ |
|
| 231 |
+## net ntp_servers |
|
| 232 |
+ |
|
| 233 |
+Get the NTP servers list. |
|
| 234 |
+~~~~ |
|
| 235 |
+pmd-cli net ntp_servers --get |
|
| 236 |
+~~~~ |
|
| 237 |
+Set the NTP servers list. |
|
| 238 |
+~~~~ |
|
| 239 |
+pmd-cli net ntp_servers --set --servers <server1,server2,...> |
|
| 240 |
+~~~~ |
|
| 241 |
+Add the specified server to the NTP servers list. |
|
| 242 |
+~~~~ |
|
| 243 |
+pmd-cli net ntp_servers --add --servers <server> |
|
| 244 |
+~~~~ |
|
| 245 |
+Delete the specified server from the NTP servers list. |
|
| 246 |
+~~~~ |
|
| 247 |
+pmd-cli net ntp_servers --del --servers <server> |
|
| 248 |
+~~~~ |
|
| 249 |
+## net hostname |
|
| 250 |
+ |
|
| 251 |
+Get the system hostname. |
|
| 252 |
+~~~~ |
|
| 253 |
+pmd-cli net hostname --get |
|
| 254 |
+~~~~ |
|
| 255 |
+Set the system hostname. |
|
| 256 |
+~~~~ |
|
| 257 |
+pmd-cli net hostname --set --name <hostname> |
|
| 258 |
+~~~~ |
|
| 259 |
+## net wait_for_link |
|
| 260 |
+ |
|
| 261 |
+Wait for the specified network interface to be up and usable (it can send and receive packets). |
|
| 262 |
+~~~~ |
|
| 263 |
+pmd-cli net wait_for_link --interface <ifname> --timeout <timeout> |
|
| 264 |
+~~~~ |
|
| 265 |
+The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely). |
|
| 266 |
+ |
|
| 267 |
+**Note:** You might need to use net wait_for_ip to wait until you can send and receive IP packets. |
|
| 268 |
+ |
|
| 269 |
+## net wait_for_ip |
|
| 270 |
+ |
|
| 271 |
+Wait for the specified interface to acquire a valid IP address for the specified address type. |
|
| 272 |
+~~~~ |
|
| 273 |
+pmd-cli net wait_for_ip --interface <ifname> --timeout <timeout> --addrtype <ipv4,ipv6,static_ipv4,static_ipv6,dhcp_ipv4,dhcp_ipv6,auto_ipv6,link_local_ipv6> |
|
| 274 |
+~~~~ |
|
| 275 |
+The timeout (in seconds) specifies the maximum time to wait. Specify 0 for no timeout (wait indefinitely). |
|
| 276 |
+ |
|
| 277 |
+## net error_info |
|
| 278 |
+ |
|
| 279 |
+Get error information about the specified error code. |
|
| 280 |
+~~~~ |
|
| 281 |
+pmd-cli net error_info --errcode <error_code> |
|
| 282 |
+~~~~ |
|
| 283 |
+Here is a list of error codes: |
|
| 284 |
+ |
|
| 285 |
+- 4097 - invalid parameter |
|
| 286 |
+- 4098 - not supported |
|
| 287 |
+- 4099 - out of memory |
|
| 288 |
+- 4100 - value not found |
|
| 289 |
+- 4101 - value exists |
|
| 290 |
+- 4102 - invalid interface |
|
| 291 |
+- 4103 - invalid mode |
|
| 292 |
+- 4104 - bad configuration file |
|
| 293 |
+- 4105 - write failed |
|
| 294 |
+- 4106 - timout |
|
| 295 |
+- 4107 - DCHP timeout |
|
| 296 |
+ |
|
| 297 |
+## net net_info |
|
| 298 |
+ |
|
| 299 |
+Get the specified network configuration parameter for the specified object. |
|
| 300 |
+~~~~ |
|
| 301 |
+pmd-cli net net_info --get --object <ifname or filename> --paramname <param_name> |
|
| 302 |
+~~~~ |
|
| 303 |
+**Note:** The object can be an interface name (for example, "eth0") or a file name (for example, /etc/systemd/resolved.conf). |
|
| 304 |
+ |
|
| 305 |
+Set the value of the specified network configuration parameter for the specified object (interface or file). |
|
| 306 |
+~~~~ |
|
| 307 |
+pmd-cli net net_info --set --object <ifname or filename> --paramname <param_name> --paramvalue <param_value> |
|
| 308 |
+~~~~ |
|
| 309 |
+**Note** : You can add (+) or remove (-) a parameter by prepending the parameter name with + or -. |
|
| 310 |
+ |
|
| 311 |
+# Package Management |
|
| 312 |
+ |
|
| 313 |
+The Photon Management Daemon provides CLI commands to help you manage packages and repositories. |
|
| 314 |
+ |
|
| 315 |
+## Syntax |
|
| 316 |
+~~~~ |
|
| 317 |
+pmd-cli [connection options] pkg <command> [command options] |
|
| 318 |
+~~~~ |
|
| 319 |
+If a command allows for multiple package names, simply specify on the command line, separated by spaces. |
|
| 320 |
+~~~~ |
|
| 321 |
+pmd-cli pkg info <package_name_1> <package_name_2> <package_name_3> ... |
|
| 322 |
+~~~~ |
|
| 323 |
+## pkg help |
|
| 324 |
+ |
|
| 325 |
+Get help text for pkg CLI commands. |
|
| 326 |
+~~~~ |
|
| 327 |
+pmd-cli pkg help |
|
| 328 |
+~~~~ |
|
| 329 |
+## pkg count |
|
| 330 |
+ |
|
| 331 |
+Get the total number of packages in all repos (including installed). |
|
| 332 |
+~~~~ |
|
| 333 |
+pmd-cli pkg count |
|
| 334 |
+~~~~ |
|
| 335 |
+## pkg distro-sync |
|
| 336 |
+ |
|
| 337 |
+Synchronize installed packages to the latest available versions. If no packages are specified, then all available packages are synchronized. |
|
| 338 |
+~~~~ |
|
| 339 |
+pmd-cli pkg distro-sync |
|
| 340 |
+~~~~ |
|
| 341 |
+## pkg downgrade |
|
| 342 |
+ |
|
| 343 |
+Downgrade the specified package(s). If no packages are specified, then all available packages are downgraded. |
|
| 344 |
+~~~~ |
|
| 345 |
+pmd-cli pkg downgrade <package_name> |
|
| 346 |
+~~~~ |
|
| 347 |
+## pkg erase |
|
| 348 |
+ |
|
| 349 |
+Remove the specified package(s). |
|
| 350 |
+~~~~ |
|
| 351 |
+pmd-cli pkg erase <package_name> |
|
| 352 |
+~~~~ |
|
| 353 |
+## pkg info |
|
| 354 |
+ |
|
| 355 |
+Get general information about the specified package(s), such as name, version, release, repository, install size, and so on. |
|
| 356 |
+~~~~ |
|
| 357 |
+pmd-cli pkg info <package_name> |
|
| 358 |
+~~~~ |
|
| 359 |
+If no packages are specified, then this command returns information about all packages. |
|
| 360 |
+~~~~ |
|
| 361 |
+## pkg install |
|
| 362 |
+~~~~ |
|
| 363 |
+Install the specified package(s). Update the package if an update is available. |
|
| 364 |
+~~~~ |
|
| 365 |
+pmd-cli pkg install <package_name> |
|
| 366 |
+~~~~ |
|
| 367 |
+## pkg list |
|
| 368 |
+ |
|
| 369 |
+Get a list of packages or groups of packages. |
|
| 370 |
+~~~~ |
|
| 371 |
+pmd-cli pkg list |
|
| 372 |
+~~~~ |
|
| 373 |
+You can filter by group: all, available, installed, extras, obsoletes, recent, and upgrades. |
|
| 374 |
+~~~~ |
|
| 375 |
+pmd-cli pkg list upgrades |
|
| 376 |
+~~~~ |
|
| 377 |
+You can also filter by wildcards. |
|
| 378 |
+~~~~ |
|
| 379 |
+pmd-cli pkg list ph\* |
|
| 380 |
+~~~~ |
|
| 381 |
+## pkg reinstall |
|
| 382 |
+ |
|
| 383 |
+Reinstall the specified package(s). |
|
| 384 |
+~~~~ |
|
| 385 |
+pmd-cli pkg reinstall <package_name> |
|
| 386 |
+~~~~ |
|
| 387 |
+## pkg repolist |
|
| 388 |
+ |
|
| 389 |
+Get a list of the configured software repositories. |
|
| 390 |
+~~~~ |
|
| 391 |
+pmd-cli pkg repolist |
|
| 392 |
+~~~~ |
|
| 393 |
+This command returns a list of the configured software repositories, including the repository ID, repitory name, and status. |
|
| 394 |
+ |
|
| 395 |
+## pkg update |
|
| 396 |
+ |
|
| 397 |
+Update the specified package(s). |
|
| 398 |
+~~~~ |
|
| 399 |
+pmd-cli pkg update <package_name> |
|
| 400 |
+~~~~ |
|
| 401 |
+If no parameters are specified, then all available packages are updated. |
|
| 402 |
+ |
|
| 403 |
+## pkg updateinfo |
|
| 404 |
+ |
|
| 405 |
+Get the update information on all enabled repositories (status = enabled). If this command returns nothing, then the update information may not exist on the server. |
|
| 406 |
+~~~~ |
|
| 407 |
+pmd-cli pkg updateinfo |
|
| 408 |
+~~~~ |
|
| 409 |
+# User Management |
|
| 410 |
+ |
|
| 411 |
+The Photon Management Daemon provides CLI commands to help you manage users and user groups. |
|
| 412 |
+ |
|
| 413 |
+## Syntax |
|
| 414 |
+~~~~ |
|
| 415 |
+pmd-cli [connection options] usr <command> [command options] |
|
| 416 |
+~~~~ |
|
| 417 |
+## usr help |
|
| 418 |
+ |
|
| 419 |
+Display help text for user commands. |
|
| 420 |
+~~~~ |
|
| 421 |
+pmd-cli usr users |
|
| 422 |
+~~~~ |
|
| 423 |
+## usr users |
|
| 424 |
+ |
|
| 425 |
+Get a list of users. This command returns information about each user, including their user name, user ID, user group (if applicable), home directory, and default shell. |
|
| 426 |
+~~~~ |
|
| 427 |
+pmd-cli usr users |
|
| 428 |
+~~~~ |
|
| 429 |
+## usr useradd |
|
| 430 |
+ |
|
| 431 |
+Add a new user. Specify the username. |
|
| 432 |
+~~~~ |
|
| 433 |
+pmd-cli usr useradd <username> |
|
| 434 |
+~~~~ |
|
| 435 |
+The system assigns a user ID, home directory, and default shell to the new user. The user group is unspecified. |
|
| 436 |
+ |
|
| 437 |
+## usr userdel |
|
| 438 |
+ |
|
| 439 |
+Delete the specified user. |
|
| 440 |
+~~~~ |
|
| 441 |
+pmd-cli usr userdel <username> |
|
| 442 |
+~~~~ |
|
| 443 |
+## usr userid |
|
| 444 |
+ |
|
| 445 |
+Get the user ID of the specified user (by name). Used to determine whether the specified user exists. |
|
| 446 |
+~~~~ |
|
| 447 |
+pmd-cli usr userid <username> |
|
| 448 |
+~~~~ |
|
| 449 |
+## usr groups |
|
| 450 |
+ |
|
| 451 |
+Get a list of user groups. This command returns the following information about each user group: user group name and user group ID. |
|
| 452 |
+~~~~ |
|
| 453 |
+pmd-cli usr groups |
|
| 454 |
+~~~~ |
|
| 455 |
+## usr groupadd |
|
| 456 |
+ |
|
| 457 |
+Add a new user group. |
|
| 458 |
+~~~~ |
|
| 459 |
+pmd-cli usr groupadd <user_group_name> |
|
| 460 |
+~~~~ |
|
| 461 |
+The system assigns a group ID to the new user group. |
|
| 462 |
+ |
|
| 463 |
+## usr groupdel |
|
| 464 |
+ |
|
| 465 |
+Delete the specified user group. |
|
| 466 |
+~~~~ |
|
| 467 |
+pmd-cli usr groupdel <user_group_name> |
|
| 468 |
+~~~~ |
|
| 469 |
+## usr groupid |
|
| 470 |
+ |
|
| 471 |
+Get the group ID for the specified user group (by name). Used to determine whether the specified user group exists. |
|
| 472 |
+~~~~ |
|
| 473 |
+pmd-cli usr groupid <user_group_name> |
|
| 474 |
+~~~~ |
|
| 475 |
+## usr version |
|
| 476 |
+ |
|
| 477 |
+Get the version of the usermgmt component at the server. |
|
| 478 |
+~~~~ |
|
| 479 |
+pmd-cli usr version |
|
| 480 |
+~~~~ |