1# Network Management 2 3## Overview 4 5A Network Manager is a daemon which handles network management operations. It 6must implement the `xyz.openbmc_project.Network.SystemConfiguration.interface` 7and `org.freedesktop.DBus.ObjectManager`. 8 9When the network manager daemon comes up, it should create objects implementing 10physical link/virtual interfaces such as 11`xyz.openbmc_project.Network.EthernetInterface` or 12`xyz.openbmc_project.Network.VLANInterface` on the system. 13 14IP address(v4 and v6) objects must be children objects of the physical/virtual 15interface object. 16 17## Interfaces 18 191. SystemConfiguration: This describes the system-specific parameters. 202. EthernetInterface: This describes the interface specific parameters. 213. IP: This describes the IP address specific parameters. 224. IPProtocol: This describes the IP protocol type(IPv4/IPv6). 235. VLANInterface: This describes the VLAN specific properties. 246. Bond: This describes the interface bonding parameters. 25 26## D-Bus Objects 27 28### Interface Objects 29 30Interface objects can be physical as well as virtual. 31 32If the object is a physical interface, it can't be deleted, but if it is a 33virtual interface object it can be deleted. 34 35E.g. `/xyz/openbmc_project/network/<interfacename>` 36 37### IP Address Objects 38 39There can be multiple IP address objects under an interface object. These 40objects can be deleted by the delete function. 41 42IPv4 objects will have the following D-Bus object path: 43 44`/xyz/openbmc_project/network/<interface>/ipv4/<id>` 45 46IPv6 objects will have the following D-Bus object path: 47 48`/xyz/openbmc_project/network/<interface>/ipv6/<id>` 49 50### Network Configuration Object 51 52The network configuration object will have system configuration parameters: 53 54`/xyz/openbmc_project/network/conf` 55 56## Commands 57 58### Create Static IPv4 Address 59 60```sh 61busctl call xyz.openbmc_project.Network \ 62 /xyz/openbmc_project/network/<interface> \ 63 xyz.openbmc_project.Network.IP.Create \ 64 IP ssys "xyz.openbmc_project.Network.IP.Protocol.IPv4" \ 65 "<IP Address>" <Netmask Prefix> "<Network Gateway>" 66``` 67 68```sh 69curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST \ 70 -d '{ 71 "data": [ 72 "xyz.openbmc_project.Network.IP.Protocol.IPv4", 73 "<IP Address", 74 <Netmask Prefix>, 75 "<Network Gateway>" 76 ] 77 }' \ 78 https://${bmc}/xyz/openbmc_project/network/<interface>/action/IP 79``` 80 81E.g. 82 83```sh 84curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST \ 85 -d '{ 86 "data": [ 87 "xyz.openbmc_project.Network.IP.Protocol.IPv4", 88 "8.8.8.8", 89 24, 90 "8.8.8.0" 91 ] 92 }' \ 93 https://${bmc}/xyz/openbmc_project/network/eth0/action/IP 94``` 95 96Note: After creating the IP address object enumerate the network interface 97object to get the IPv4 id. 98 99### Delete IPv4 Address 100 101```sh 102busctl call xyz.openbmc_project.Network \ 103 /xyz/openbmc_project/network/<interface>/ipv4/<id> \ 104 xyz.openbmc_project.Object.Delete Delete 105``` 106 107```sh 108curl -c cjar -b cjar -k -H "Content-Type: application/json" -X DELETE \ 109 https://${bmc}/xyz/openbmc_project/network/<interface>/ipv4/<id> 110``` 111 112### Default Gateway 113 114#### Get 115 116```sh 117busctl get-property xyz.openbmc_project.Network \ 118 /xyz/openbmc_project/network/config \ 119 xyz.openbmc_project.Network.SystemConfiguration DefaultGateway 120``` 121 122```sh 123curl -c cjar -b cjar -k -H "Content-Type: application/json" \ 124 https://${bmc}/xyz/openbmc_project/network/config/attr/DefaultGateway 125``` 126 127#### Set 128 129```sh 130busctl set-property xyz.openbmc_project.Network \ 131 /xyz/openbmc_project/network/config \ 132 xyz.openbmc_project.Network.SystemConfiguration \ 133 DefaultGateway s "<DefaultGateway>" 134``` 135 136```sh 137curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \ 138 -d '{"data": "<DefaultGateway>"}' \ 139 https://${bmc}/xyz/openbmc_project/network/config/attr/DefaultGateway 140``` 141 142NOTE: The default gateway must be pingable, if not 0.0.0.0 will be used. 143 144### HostName 145 146#### Get 147 148```sh 149busctl get-property xyz.openbmc_project.Network \ 150 /xyz/openbmc_project/network/config \ 151 xyz.openbmc_project.Network.SystemConfiguration HostName 152``` 153 154```sh 155curl -c cjar -b cjar -k -H "Content-Type: application/json" \ 156 https://${bmc}/xyz/openbmc_project/network/config/attr/HostName 157``` 158 159#### Set 160 161```sh 162busctl set-property xyz.openbmc_project.Network \ 163 /xyz/openbmc_project/network/config \ 164 xyz.openbmc_project.Network.SystemConfiguration HostName s "<HostName>" 165``` 166 167```sh 168curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \ 169 -d '{"data": "<HostName>"}' \ 170 https://${bmc}/xyz/openbmc_project/network/config/attr/HostName 171``` 172 173### DHCP 174 175#### Get 176 177```sh 178busctl get-property xyz.openbmc_project.Network \ 179 /xyz/openbmc_project/network/eth0 \ 180 xyz.openbmc_project.Network.EthernetInterface DHCPEnabled 181``` 182 183```sh 184curl -c cjar -b cjar -k -H "Content-Type: application/json" \ 185 https://${bmc}/xyz/openbmc_project/network/eth0/attr/DHCPEnabled 186``` 187 188#### Enable 189 190```sh 191busctl set-property xyz.openbmc_project.Network \ 192 /xyz/openbmc_project/network/eth0 \ 193 xyz.openbmc_project.Network.EthernetInterface DHCPEnabled b 1 194``` 195 196```sh 197curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \ 198 -d '{"data": 1}' \ 199 https://${bmc}/xyz/openbmc_project/network/eth0/attr/DHCPEnabled 200``` 201 202### MAC Address 203 204#### Get 205 206```sh 207busctl get-property xyz.openbmc_project.Network \ 208 /xyz/openbmc_project/network/eth0 \ 209 xyz.openbmc_project.Network.MACAddress MACAddress 210``` 211 212```sh 213curl -c cjar -b cjar -k -H "Content-Type: application/json" \ 214 https://${bmc}/xyz/openbmc_project/network/<interface>/attr/MACAddress 215``` 216 217#### Set 218 219```sh 220busctl set-property xyz.openbmc_project.Network \ 221 /xyz/openbmc_project/network/<interface> \ 222 xyz.openbmc_project.Network.MACAddress MACAddress s "<MAC Address>" 223``` 224 225```sh 226curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT \ 227 -d '{"data": "<MAC Address>" }' \ 228 https://${bmc}/xyz/openbmc_project/network/<interface>/attr/MACAddress 229``` 230 231NOTE: MAC address should be a local admin MAC (2nd bit of first byte should be 232on). 233 234### Network Factory Reset 235 236```sh 237busctl call xyz.openbmc_project.Network /xyz/openbmc_project/network \ 238 xyz.openbmc_project.Common.FactoryReset Reset 239``` 240 241```sh 242curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST \ 243 -d '{"data":[] }' https://${bmc}/xyz/openbmc_project/network/action/Reset 244``` 245 246### VLAN 247 248#### Create 249 250```sh 251busctl call xyz.openbmc_project.Network /xyz/openbmc_project/network \ 252 xyz.openbmc_project.Network.VLAN.Create VLAN su "<interface>" <VLAN id> 253``` 254 255```sh 256curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST \ 257 -d '{"data":["<interface>", <VLAN id>] }' \ 258 https://${bmc}/xyz/openbmc_project/network/action/VLAN 259``` 260 261E.g. 262 263```sh 264curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST \ 265 -d '{"data":["eth0",50] }' \ 266 https://${bmc}/xyz/openbmc_project/network/action/VLAN 267``` 268 269#### Delete 270 271```sh 272busctl call xyz.openbmc_project.Network \ 273 /xyz/openbmc_project/network/<VLAN interface> \ 274 xyz.openbmc_project.Object.Delete Delete 275``` 276 277```sh 278curl -c cjar -b cjar -k -H "Content-Type: application/json" -X DELETE \ 279 https://${bmc}/xyz/openbmc_project/network/<VLAN interface> 280``` 281 282E.g. 283 284```sh 285curl -c cjar -b cjar -k -H "Content-Type: application/json" -X DELETE \ 286 https://${bmc}/xyz/openbmc_project/network/eth0_50 287``` 288 289#### Enumerate 290 291```sh 292curl -c cjar -b cjar -k -H "Content-Type: application/json" \ 293 https://${bmc}/xyz/openbmc_project/network/<VLAN interface>/enumerate 294``` 295 296### IPMI VLAN and IP 297 298#### Create 299 300```sh 301ipmitool -I dbus lan set 1 ipsrc static 302 303ipmitool -I dbus lan set 1 ipaddr <IP address> 304 305ipmitool -I dbus lan set 1 netmask <mask> 306 307ipmitool -I dbus lan set 1 defgw ipaddr <IP address> 308 309ipmitool -I dbus lan set 1 vlan id <id> 310 311ipmitool -I dbus raw 0x06 0x40 // To the save settings 312``` 313 314NOTE: It takes 4-5 seconds to create the VLAN and configure the IP. If a VLAN 315interface is not desired don't set the VLAN id above. 316 317#### Delete 318 319```sh 320ipmitool -I dbus lan set 1 vlan id off 321 322ipmitool -I dbus raw 0x06 0x40 // To the save settings 323``` 324