1# Network Management
2
3## Overview
4
5A Network Manager is a daemon which handles network management operations.
6It must 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
10implementing physical 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
15physical/virtual interface 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,
33but if it is a virtual 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.
40These objects 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```
61busctl call  xyz.openbmc_project.Network /xyz/openbmc_project/network/<interface> xyz.openbmc_project.Network.IP.Create IP ssys "xyz.openbmc_project.Network.IP.Protocol.IPv4" "<IP Address>" <Netmask Prefix> "<Network Gateway>"
62```
63```
64curl -c cjar -b cjar -k -H "Content-Type: application/json" -X  POST -d '{"data":["xyz.openbmc_project.Network.IP.Protocol.IPv4","<IP Address>", <Netmask Prefix>, "<Network Gateway>"]
65}' https://${bmc}/xyz/openbmc_project/network/<interface>/action/IP
66```
67
68E.g.
69```
70curl -c cjar -b cjar -k -H "Content-Type: application/json" -X  POST -d '{"data":["xyz.openbmc_project.Network.IP.Protocol.IPv4","8.8.8.8", 24, "8.8.8.0"]}' https://${bmc}/xyz/openbmc_project/network/eth0/action/IP
71```
72
73Note: After creating the IP address object enumerate the network interface object to get the IPv4 id.
74
75#### Delete IPv4 Address
76
77```
78busctl call xyz.openbmc_project.Network /xyz/openbmc_project/network/<interface>/ipv4/<id> xyz.openbmc_project.Object.Delete Delete
79```
80```
81curl -c cjar -b cjar -k -H "Content-Type: application/json" -X DELETE https://${bmc}/xyz/openbmc_project/network/<interface>/ipv4/<id>
82```
83
84#### Default Gateway
85
86##### Get
87
88```
89busctl get-property xyz.openbmc_project.Network /xyz/openbmc_project/network/config xyz.openbmc_project.Network.SystemConfiguration DefaultGateway
90```
91```
92curl -c cjar -b cjar -k -H "Content-Type: application/json" https://${bmc}/xyz/openbmc_project/network/config/attr/DefaultGateway
93```
94
95##### Set
96
97```
98busctl set-property xyz.openbmc_project.Network /xyz/openbmc_project/network/config xyz.openbmc_project.Network.SystemConfiguration DefaultGateway s "<DefaultGateway>"
99```
100```
101curl -c cjar -b cjar -k -H "Content-Type: application/json" -X  PUT  -d '{"data": "<DefaultGateway>"}' https://${bmc}/xyz/openbmc_project/network/config/attr/DefaultGateway
102```
103
104NOTE: The default gateway must be pingable, if not 0.0.0.0 will be used.
105
106#### HostName
107
108##### Get
109
110```
111busctl get-property xyz.openbmc_project.Network /xyz/openbmc_project/network/config xyz.openbmc_project.Network.SystemConfiguration HostName
112```
113```
114curl -c cjar -b cjar -k -H "Content-Type: application/json" https://${bmc}/xyz/openbmc_project/network/config/attr/HostName
115```
116
117##### Set
118
119```
120busctl set-property xyz.openbmc_project.Network /xyz/openbmc_project/network/config xyz.openbmc_project.Network.SystemConfiguration HostName s "<HostName>"
121```
122```
123curl -c cjar -b cjar -k -H "Content-Type: application/json" -X  PUT  -d '{"data": "<HostName>"}' https://${bmc}/xyz/openbmc_project/network/config/attr/HostName
124```
125
126#### DHCP
127
128##### Get
129
130```
131busctl get-property xyz.openbmc_project.Network /xyz/openbmc_project/network/eth0 xyz.openbmc_project.Network.EthernetInterface DHCPEnabled
132```
133```
134curl -c cjar -b cjar -k -H "Content-Type: application/json" https://${bmc}/xyz/openbmc_project/network/eth0/attr/DHCPEnabled
135```
136
137##### Enable
138
139```
140busctl set-property xyz.openbmc_project.Network /xyz/openbmc_project/network/eth0 xyz.openbmc_project.Network.EthernetInterface DHCPEnabled b 1
141```
142```
143curl -c cjar -b cjar -k -H "Content-Type: application/json" -X  PUT  -d '{"data": 1}' https://${bmc}/xyz/openbmc_project/network/eth0/attr/DHCPEnabled
144```
145
146#### MAC Address
147
148##### Get
149
150```
151busctl get-property xyz.openbmc_project.Network /xyz/openbmc_project/network/eth0 xyz.openbmc_project.Network.MACAddress MACAddress
152```
153```
154curl -c cjar -b cjar -k -H "Content-Type: application/json" https://${bmc}/xyz/openbmc_project/network/<interface>/attr/MACAddress
155```
156
157##### Set
158
159```
160busctl set-property xyz.openbmc_project.Network /xyz/openbmc_project/network/<interface> xyz.openbmc_project.Network.MACAddress MACAddress s "<MAC Address>"
161```
162```
163curl -c cjar -b cjar -k -H "Content-Type: application/jon" -X  PUT  -d '{"data": "<MAC Address>" }' https://${bmc}/xyz/openbmc_project/network/<interface>/attr/MACAddress
164```
165
166NOTE: MAC address should be a local admin MAC (2nd bit of first byte should be on).
167
168#### Network Factory Reset
169
170```
171busctl call xyz.openbmc_project.Network /xyz/openbmc_project/network xyz.openbmc_project.Common.FactoryReset Reset
172```
173```
174curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d '{"data":[] }' https://${bmc}/xyz/openbmc_project/network/action/Reset
175```
176
177#### VLAN
178
179##### Create
180
181```
182busctl call xyz.openbmc_project.Network /xyz/openbmc_project/network xyz.openbmc_project.Network.VLAN.Create VLAN su "<interface>" <VLAN id>
183```
184```
185curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d '{"data":["<interface>", <VLAN id>] }' https://${bmc}/xyz/openbmc_project/network/action/VLAN
186```
187
188E.g.
189```
190curl -c cjar -b cjar -k -H "Content-Type: application/json" -X POST -d '{"data":["eth0",50] }' https://${bmc}/xyz/openbmc_project/network/action/VLAN
191```
192
193##### Delete
194
195```
196busctl call xyz.openbmc_project.Network /xyz/openbmc_project/network/<VLAN interface> xyz.openbmc_project.Object.Delete Delete
197```
198```
199curl -c cjar -b cjar -k -H "Content-Type: application/json" -X DELETE https://${bmc}/xyz/openbmc_project/network/<VLAN interface>
200```
201
202E.g.
203```
204curl -c cjar -b cjar -k -H "Content-Type: application/json" -X DELETE https://${bmc}/xyz/openbmc_project/network/eth0_50
205```
206
207##### Enumerate
208
209```
210curl -c cjar -b cjar -k -H "Content-Type: application/json" https://${bmc}/xyz/openbmc_project/network/<VLAN interface>/enumerate
211```
212
213#### IPMI VLAN and IP
214
215#####  Create
216
217```
218ipmitool -I dbus lan set 1 ipsrc static
219
220ipmitool -I dbus lan set 1 ipaddr <IP address>
221
222ipmitool -I dbus lan set 1 netmask <mask>
223
224ipmitool -I dbus lan set 1 defgw ipaddr <IP address>
225
226ipmitool -I dbus lan set 1 vlan id <id>
227
228ipmitool -I dbus raw 0x06 0x40 // To the save settings
229```
230
231NOTE: It takes 4-5 seconds to create the VLAN and configure the IP.
232If a VLAN interface is not desired don't set the VLAN id above.
233
234##### Delete
235
236```
237ipmitool -I dbus lan set 1 vlan id off
238
239ipmitool -I dbus raw 0x06 0x40 // To the save settings
240```
241