1. BMC Network Management Introduction
The main responsibility of bmc_network is IPv4/IPv6 configuration, ensuring normal BMC network communication from two perspectives:
- Configuring external IP addresses: Users can connect to the BMC via the management IP address configured on the BMC.
- Configuring internal IP addresses: These are primarily used for network communication between the management board and the BMC, or between multiple BMCs within the same chassis.
Networking example
The eth0.702 (702 is the VLAN ID) network port device belongs to the internal network port group on the 171.31.1.x subnet.
eth0.701, eth2, and eth3 belong to the external network port group on the xx.xx.16.x subnet. External IP addresses switch among these three network port devices.
2. BMC Network Management Basics
2.1 Common Terms
Dedicated Network Port
Network device of the BMC, which usually corresponds to eth2 in the environment.
NC-SI Network Port
A Network Controller Sideband Interface (NC-SI) network port refers to a network device connected directly to the BMC through an NC-SI cable. All network ports except the dedicated port can be considered as NC-SI network ports. NC-SI network ports include PCIe, LOM, and OCP types. For example, eth0 in the DA123C environment is a PCIe network port.
VLAN
Virtual Local Area Networks (VLANs) are created by logically separating one physical LAN into multiple broadcast domains. Each VLAN functions as a separate broadcast domain, with devices in the same VLAN able to directly communicate with one another, while those in different VLANs cannot. As a result, broadcast packets are confined within a single VLAN.
2.2 Common Protocols
IPv4 and IPv6
ARP
LLDP
ICMP
DHCP
3. BMC Network Management Design
3.1 Common Classes
IPv4
This class primarily carries IPv4 information for external network ports, including the IP address, subnet mask, default gateway, address acquisition mode (DHCP or Static), backup IP address (activated in DHCP mode), and backup subnet mask. It also provides modification interfaces for these properties. (See 4. Common BMC Network Interfaces for details.)
| Property | Description |
|---|---|
| IpMode | IPv4 network mode, which can be DHCP or Static |
| IpAddr | IP address |
| BackupIpAddr | Backup IPv4 Address |
| SubnetMask | IPv4 subnet mask |
| BackupSubnetMask | Backup IPv4 subnet mask |
| DefaultGateway | Default IPv4 gateway |
| EthName | Name of the external network port device, such as eth0.701 (701 indicates a VLAN) |
IPv6
This class primarily carries IPv6 information for external network ports, including the IP address, prefix length, default gateway, and address acquisition mode (DHCPv6 or Static). It also provides modification interfaces for these properties (see 4. Common BMC Network Interfaces for interface usage).
| Property | Description |
|---|---|
| IpMode | IPv6 network mode, which can be DHCPv6 or Static |
| IpAddr | IP address |
| PrefixLength | Length of the IPv6 prefix |
| Scope | Link,Global |
| DefaultGateway | Default IPv6 gateway |
EthernetInterfaces
This class primarily carries most of the information for external network ports.
| Property | Description |
|---|---|
| EthName | Name of the external network port device, such as eth0.701 (701 indicates a VLAN) |
| NetMode | Fixed network port mode/adaptive mode (selecting the external network port based on the NIC priority) |
| Mac | External MAC address of the BMC |
| IpVersion | IPv4/IPv6 enabling status |
| PortId | ID of the currently activated network port, corresponding to Id of MgmtPort |
| NcsiEnable | NC-SI enabling status |
| VLANEnable | NC-SI VLAN enabling status |
| VLANId | NC-SI VLAN ID |
| LinkLocalAddress | IPv6 link-local address |
MgmtPort
This class primarily carries physical NIC information.
| Property | Description |
|---|---|
| Id | Unique identifier (PortId in EthernetInterfaces refers to this). Currently, the dedicated port is fixed at 1, and others start from 2 and are returned to the network adapter. |
| EthId | Associated eth device ID. The value 2 indicates eth2. |
| DeviceId | NIC device information. Currently, the value is 1, which is not critical. |
| DevicePortId | Port number on the NIC (one NIC has multiple ports), such as port1 or port2. |
| Silkscreen | NIC silkscreen, such as Mgmt or Port1. |
| AdaptiveFlag | Whether the port participates in adaptive mode. |
| LinkStatus | Link status: Disconnected, Connected (updated by bmc_network for dedicated ports and by the network adapter for NC-SI ports). |
| Type | NIC type (PCIe, Dedicated, OCP, LOM, and more). |
| VLANEnabled | When Id is 1, this represents the VLAN information for the dedicated port. When Id is not 1, this indicates the VLAN information for the NC-SI port. |
| VLANId | VLAN ID |
| Priority | Priority for adaptive mode. |
LldpConfig
This class primarily carries LLDP-related configurations.
| Property | Description |
|---|---|
| Enabled | Whether to enable the LLDP service, which is disabled by default. Set true to enable. |
| WorkMode | LLDP working mode. Currently, only the Tx mode is supported. |
| TxDelaySeconds | LLDP Tx delay. |
| TxIntervalSeconds | LLDP Tx interval. |
| TxHold | LLDP Tx hold time. |
| LLDPSupport | Whether to support the LLDP function. LLDP is not supported by default, preventing its service and routine test from starting. |
| LLDPParseEnabled | Whether to support the LLDP parsing function. LLDP parsing is not supported by default. |
| LLDPOverNCSIEnabled | Whether to support LLDP over NC-SI. LLDP Over NC-SI is not supported by default, preventing LLDP from parsing packets sent by NC-SI. |
| LLDPGetPortDescEnabled | Whether to support LLDP port description acquisition. This function is not supported by default, preventing the Port Desc field from being parsed. |
LLDPInfo
This class primarily carries information related to LLDP packet parsing.
| Property | Description |
|---|---|
| PortName | Port number parsed from the packet |
| PortDesc | Port description parsed from the packet |
| SystemDesc | Switch model parsed from the packet |
| OrgSpec | Organization model parsed from the packet |
| ManagementIP | Management address parsed from the packet |
| SlotId | U position number corresponding to the cabinet port, defaulting to 0 |
Assembly
This class primarily carries information related to LLDP packet parsing.
| Property | Description |
|---|---|
| HostName | Host name |
| SystemGUID | System-wide unique identifier, which can be modified by users |
| DomainName | Domain Name |
| UUID | Device-wide unique identifier, which can only be generated by the IPMI and cannot be modified |
| ManagementIP | Management address parsed from the packet |
| FQDN | Fully qualified domain name (FQDN) in format of host_name.domain_name |
Group
This class currently primarily persists the MAC address of external network ports.
| Property | Description |
|---|---|
| GroupId | Fixed as EthGroup0 |
| EthName | External network port name, such as eth2 and eth0 |
| EthId | External network port ID, such as 2 and 0 |
| Mac | External network port MAC address, defaulting to 20:22:01:75:BC:60 |
EthMac
This class primarily carries network port hardware-related configurations.
| Property | Description |
|---|---|
| GroupId | Network port group ID, such as EthGroup0 and MaintEthGroup |
| EthName | Network port name, such as eth2 and eth0 |
| EthId | External network port ID, such as 2 and 0 |
| Mac | Network port MAC address |
| MacUseEnabled | Whether to enable the MAC address, with only one enabled for a network port group |
| SpeedDuplexEnable | Whether to enable the auto-negotiation mode of the network port |
| SpeedSetting | Network port speed: 0 for N/A, 1 for 10 Mbit/s, 2 for 100 Mbit/s, and 3 for 1,000 Mbit/s |
| DuplexSetting | Network port working mode: 0 for N/A, 1 for half-duplex, and 2 for full-duplex |
HeartBeat
This class primarily carries internal network heartbeat configuration.
| Property | Description |
|---|---|
| Name | Name of the entity monitoring the heartbeat, such as IRMHeartBeat |
| Status | Current heartbeat status, such as Lost |
EthGroup
This class primarily carries configurations for internal networks, multiple external network ports, and maintenance network ports.
| Property | Description |
|---|---|
| GroupId | Network port group ID, which is unique |
| Name | Network port group name, such as InnerEthGroup, MaintEthGroup, or VethGroup |
| OutType | Type of network port group, including 1 (internal), 2 (external), 3 (veth), 4 (internal network for local maintenance of the Atlas compute node), 5 (external network for local maintenance of the Atlas compute node), 6 (floating IP network of the SMM), 7 (internal network for the peer SMM), 8 (dedicated network port for local O&M), 9 (internal network for cabinet management), and 10 (internal network of the cabinet node) |
| ActiveEthId | Index of the currently activated network port, such as 2 for eth2 |
| InnerNetWork | Internal subnet, which is not used |
| VLANId | VLAN ID corresponding to the activated network port in this group |
| VLANEnabled | Whether to enable the VLAN corresponding to the activated network port in this group |
| EthAlias | Alias of the activated network port. If there is an alias, the maximum value is 254 (255 indicates that there is no alias), for example, eth2:0. |
| InnerNetWork | Internal subnet, such as 172.31.1.0 |
| IpAddr | IPv4 address |
| BaseIpAddr | Base IPv4 address, compared with IpAddr, which is used to determine if the internal IP address is generated based on the slot number |
| SubnetMask | IPv4 subnet mask |
| DefaultGateway | IPv4 gateway |
| Ipv6Addr | IPv6 address |
| PrefixLength | IPv6 prefix length |
| Ipv6DefaultGateway | IPv6 gateway |
| IpPolicy | IP address generation policy: 0 for default IP address basis and 1 for slot and base IP address basis |
| Status | Whether the IP address is in the working state |
| IpMode | IPv4 mode, which can be Static or DHCP |
| Ipv6Mode | IPv6 mode, which can be Static or DHCPv6 |
| IpVersion | IP protocol type, including IPv4, IPv6, and IPv4AndIPv6 |
| AssociatedPortType | Network port type associated with the group |
| Channel | LAN channel number corresponding to the network port |
Relationships Between Classes
3.2 bmc_network External Network Initialization Process
3.3 bmc_network Internal Network Initialization Process
3.4 DHCP Task Process
4. Common BMC Network Interfaces
4.1 IPMI Interfaces
The following lists raw IPMI commands for IPv4 with simple descriptions.
Setting the External IPv4 Address
Request:
ipmitool -H xx.xx.16.97 -I lanplus -p 623 -U <username> -P <password> -C 17 raw 0x0c 0x01 0x01 0x03 0x4c 0x4c 0x10 0x61The last four bytes represent the hexadecimal IP address. For example, the command above sets the IP address to xx.xx.16.97.
Response:
If no error is reported, the operation is successful.
Note:
- If only IPv6 is enabled, the IPv4 address cannot be set.
- If the current mode is DHCP, it will change to Static mode after configuration.
- Passing all zeros for the IP address clears the IPv4 address (the subnet mask and gateway are also cleared).
Querying the External IPv4 Address
Request:
ipmitool -H xx.xx.16.203 -I lanplus -p 623 -U <username> -P <password> -C 17 raw 0x0c 0x02 0x01 0x03 0x00 0x00Response:
11 4c 4c 10 cbThe first byte returned is always 11, followed by 4 bytes representing the hexadecimal IP address.
Setting the External IPv4 Subnet Mask
Request:
ipmitool -H xx.xx.19.54 -I lanplus -p 623 -U <username> -P <password> -C 17 raw 0x0c 0x01 0x01 0x06 0xff 0xff 0xff 0x00The last four bytes represent the hexadecimal subnet mask. For example, the command above sets the subnet mask to 255.255.255.0.
Response:
If no error is reported, the operation is successful.
Note:
- If only IPv6 is enabled, the IPv4 subnet mask cannot be set.
- Passing all zeros for the subnet mask clears the IPv4 subnet mask (the gateway is also cleared).
Querying the External IPv4 Subnet Mask
Request:
ipmitool -H xx.xx.16.203 -I lanplus -p 623 -U <username> -P <password> -C 17 raw 0x0c 0x02 0x01 0x06 0x00 0x00Response:
11 ff ff ff 00The first byte returned is always 11, followed by 4 bytes representing the hexadecimal subnet mask.
Setting the External IPv4 Gateway
Request:
ipmitool -H xx.xx.19.54 -I lanplus -p 623 -U <username> -P <password> -C 17 raw 0x0c 0x01 0x01 0x0c 0x4c 0x4c 0x10 0x01Response:
If no error is reported, the operation is successful.
Note:
- If only IPv6 is enabled, the IPv4 gateway cannot be set.
- If the configured gateway is not in the same subnet as the current IP address, the operation fails.
- Passing all zeros for the gateway clears the IPv4 gateway.
Querying the External IPv4 Gateway
Request:
ipmitool -H xx.xx.16.203 -I lanplus -p 623 -U <username> -P <password> -C 17 raw 0x0c 0x02 0x01 0x0c 0x00 0x00Response:
11 4c 4c 10 01The first byte returned is always 11, followed by 4 bytes representing the hexadecimal gateway.
Setting the External IPv4 Mode
Request:
ipmitool -H xx.xx.16.203 -I lanplus -p 623 -U <username> -P <password> -C 17 raw 0x0c 0x01 0x01 0x04 0x02The last byte represents the mode: 0x01 (Static) or 0x02 (DHCP).
Response:
If no error is reported, the operation is successful.
Note:
- If only IPv6 is enabled, the IPv4 mode cannot be set.
Querying the External IPv4 Mode
Request:
ipmitool -H xx.xx.16.203 -I lanplus -p 623 -U <username> -P <password> -C 17 raw 0x0c 0x02 0x01 0x04 0x00 0x00Response:
11 01The first byte returned is always 11. The second byte indicates the mode: 0x01 (Static) or 0x02 (DHCP).
4.2 RPC Interfaces
IPv4
Ipv4SetIpAddr
Callback function: set_ipv4_addr
Function: Sets the IPv4 address, passing only the IP address and subnet mask.
Prerequisites:
- The input IPv4 address is valid.
- The input subnet mask is valid.
ip_versionsupports IPv4.- No subnet conflicts exist with the internal network or maintenance IP addresses.
Note: The DHCP client will be stopped if this interface is used in DHCP mode, and the static address mode will be used.
Function implementation:
- Modify resource tree and database information.
- Record operation logs.
- Set the IPv4 address and subnet mask through a socket (core implementation).
- Update iptables rules in the network address translation (NAT) table for the external network.
- Emit signals for IPv4 address and subnet mask changes.
- Clear alias network ports.
- Modify iptables rules when the IP address changes.
- Broadcast ARP packets.
Ipv4SetDefaultGateway
Callback function: set_ipv4_gateway
Function: Sets the IPv4 gateway independently.
Prerequisites:
- The input gateway address is valid.
ip_versionsupports IPv4.- The current gateway and the IP address to be set are in the same subnet.
Function implementation:
- Modify resource tree and database information (
DefaultGateway). - Record operation logs.
- Set the IPv4 address through a socket (core implementation).
- Emit signals for IPv4 gateway changes.
- Broadcast ARP packets.
Ipv4SetIpMaskGateway
Callback function: set_ipv4_mask_gateway
Function: Sets the IPv4 address, passing the IP address, subnet mask, and gateway.
Prerequisites:
- The input parameters are valid.
- The subnets are the same.
- The IP address does not conflict with other IP addresses.
Note: The DHCP client will be stopped if this interface is used in DHCP mode, and the static address mode will be used.
Function implementation:
- Modify the database and resource tree.
- Record operation logs.
- Set the IPv4 address, subnet mask, and default gateway through a socket (core implementation).
- Update
iptablesrules in the NAT table for the external network. - Modify iptables rules when the IP address changes.
- Emit signals for IPv4 information changes.
- Clear alias network ports.
- Broadcast ARP packets.
Ipv4SetDedicatedMaintIpMask
Callback function: set_dedicated_maint_ipv4_mask
Function: Sets the IPv4 address and subnet mask for dedicated port O&M.
Prerequisites:
- The input parameters are valid.
- The subnets are the same.
- The IP address does not conflict with other IP addresses.
Function implementation:
- Update the dedicated O&M network:
- Set the IPv4 address and subnet mask of the O&M network port through a socket (core implementation).
- Set
route_localnetto 1 to ensure services like Web and SSH function normally. - Update
iptablesrules in the NAT table for the O&M network. - After the O&M network port is configured, ARP address resolution points to the maintenance IP address. Therefore, the external network port needs to actively send ARP packets to trigger address learning for the external IP address.
- Record operation logs.
IPv6
Ipv6SetIpAddr
Callback function: set_ipv6_addr
Function: Sets the IPv6 address, passing only the IP address and prefix length. ipv6_addr must be in the shortest string format, such as fe80::.
Prerequisites:
- The IPv6 address is valid.
- The prefix length is valid (the maximum prefix length is 128 bits).
ip_versionsupports IPv6.
Note:
- If the passed prefix length is 0, the default value of 64 is used.
- Disable the DHCPv6 service first if the DHCP mode is used.
Function implementation:
- Record operation logs.
- Modify the database and resource tree.
- Delete the previous IPv6 information through a socket.
- Set new IPv6 information through a socket (core implementation).
- Emit signals for IPv6 address and prefix length changes.
- Send NA packets.
- Modify ip6tables rules when the IPv6 address changes.
Ipv6SetDefaultGateway
Callback function: set_ipv6_gateway
Function: Sets the IPv6 gateway independently.
Prerequisites:
- The gateway is valid.
- The gateway to be set is in the same subnet as the current IP address.
ip_versionsupports IPv6.
Function implementation:
- Record operation logs.
- Modify resource tree and database information (
DefaultGateway). - Delete the previous IPv6 gateway through a socket.
- Set a new IPv6 gateway through a socket (core implementation).
- Emit signals for IPv6 gateway changes.
Ipv6SetIpv6PrefixGateway
Callback function: set_ipv6_prefix_gateway
Function: Sets the IPv6 address, passing the IP address, prefix length, and gateway.
Prerequisites:
- In Redfish scenarios, configuration is required if either
IpAddrorPrefixLengthis valid. - The IP address, prefix length, and gateway are valid.
- The gateway to be set is in the same subnet as the current IP address.
ip_versionsupports IPv6.
Note:
- In Redfish scenarios, an error will be reported if the IPv6 address is invalid.
- Disable the DHCPv6 service first if the DHCP mode is used.
- If the passed prefix length is 0, the default value of 64 is used.
Function implementation:
- Record operation logs.
- Modify resource tree and database information.
- Delete the previous IPv6 gateway through a socket.
- Set a new IPv6 gateway through a socket (core implementation).
- Delete the previous IPv6 information through a socket.
- Set new IPv6 information through a socket (core implementation).
- Emit signals for IPv6 address, prefix length, and gateway changes.
- Send NA packets.
- Modify ip6tables rules when the IPv6 address changes.
Ethernet
EthernetInterfacesGetAllPort
Callback function: get_all_port
Function implementation:
Traverse slot.Port and return all port information:
IdEthIdDeviceIdDevicePortIdSilkscreenTypeAdaptiveFlagLinkStatusMac
EthernetInterfacesSetNetworkConfig
Callback function: set_network_config
Function: Sets network configuration.
Input parameters: NetMode, PortId, VLANEnable, and VLANId
Prerequisites:
- The network configuration does not conflict with the internal VLAN.
- The port ID is valid.
- In adaptive mode, the port remains unchanged from the previous one, and interface parameters are not accepted.
- If only
vlan_idis modified whileVLANEnableisfalse, the network is not restarted.
Function implementation:
NetModeincludes the adaptive mode and fixed network port mode.- Update database and resource tree information.
- Switch the network port and restart the network, updating multi-IP address configurations for the external network port.
- Restart the network if the VLAN information of the NC-SI network port changes.
EthernetInterfacesAddMgmtPort
Callback function: add_mgmt_port
Function: Adds a management port.
Note:
- If
portIdis not 0, the existing port is updated. Otherwise, a port with the specifiedportIdis registered.- A value of 0 indicates a new registration, and a
portIdmust be automatically generated.- Modification of the dedicated network port is not supported.
Function implementation:
- Add a resource tree object.
EthernetInterfacesDeleteMgmtPort
Callback function: delete_mgmt_port
Function: Deletes a management port.
Note:
- When
portIdis 255, all NC-SI network ports are deleted.- Dedicated network ports cannot be deleted.
Function implementation:
- Delete the resource tree object.
EthernetInterfacesSetVLANConfig
Callback function: rpc_set_vlan
Function: Sets the VLAN.
Prerequisites:
- The network configuration does not conflict with the internal VLAN.
- The
vlan_idis within the range of 1 to 4094.
Function implementation:
- Set
vlan_idbased onportType. Currently, only two types are supported: 0 forNCSIand 1 forDedicated. - Determine whether the current model supports VLAN configuration for the dedicated network port. If not, return a failure message directly.
HeartBeatBeat
Callback function: heart_beat:beat
Function: Provides heartbeats.
EthernetInterfacesNetworkFailover
Callback function: network_failover
Function: Updates the network failover status.
Note: When the LAN switch (LSW) switches ports, ARP packets and NA packets are actively sent.
iptables
EthernetInterfacesAddIptablesRule
Callback function: add_iptables_rule
Input parameters: interface_name and ip_addr
Note:
- Operation logs are not recorded when this RPC method is called internally between SSDP components.
- The input parameter validation includes checks for special characters.
Function implementation:
- Implement the function using
iptablescommands of the OS.
EthernetInterfacesAddIp6tablesRule
Callback function: add_ip6tables_rule
Input parameters: interface_name and ipv6_addr
Note:
- Operation logs are not recorded when this RPC method is called internally between SSDP components.
- The input parameter validation includes checks for special characters.
Function implementation:
- Implement the function using
ip6tablescommands of the OS.
NatConfigAddNatRule
Callback function: add_nat_rule
Function: Adds an address mapping rule.
Input parameters: service_name and reg_params
Note:
- Currently, only one forwarding rule with a specified IP address can be added for a network port type.
- Based on the forwarding rules of all running services, a rule for forwarding from
ps.Addressto an internal address is added. Currently, only IPv4 addresses are supported.
Function implementation:
- add_multi_nat_rules or add_single_nat_rule
- Implement the function using
iptablescommands of the OS.
NatConfigUpdateNatRule
Callback function: update_nat_rule
Function: Updates an address mapping rule.
Input parameters: service_name and reg_params
Function implementation:
- update_multi_nat_rules or update_single_nat_rule
- Implement the function using
iptablescommands of the OS. - If the network port is unavailable, set
route_localnetto 0.