Open chnguyen-ampere opened 2 months ago
Do you have the networkctl status
output at step 8? How about the dbus tree from phosphor-networkd?
Do you have the
networkctl status
output at step 8? How about the dbus tree from phosphor-networkd?
Hi @williamspatrick , I updated the log for step#8, you can review that. I saw the netwrorkctl
and dbus object
report correct value 10.38.153.72
=> DHCP
; 10.38.153.70
=> Static
It looks like both IP addresses are enabled and it seems like the IPMI code is just picking one of them?
It looks like both IP addresses are enabled and it seems like the IPMI code is just picking one of them?
If the IPMI code is just picking one them then it should be 10.38.153.72 DHCP
or 10.38.153.70 Static
.
Actually, the IPMI reports wrong values 10.38.153.70 DHCP
(step#8 shows that)
Phosphor networkd is checking if the interface is DHCP or static and assigning address found on the interface accordingly https://github.com/openbmc/phosphor-networkd/blob/5a45606103157291747f95efc77ba989fa43c97f/src/ethernet_interface.cpp#L161
Ipmi host is not considering more than one address could exist.
Not sure how long systemd networkd has offered the dynamic source or if the address is tagged to netlink.
Why wasn't the static address removed when DHCP was enabled? Is this related to the recent "issue"
that when DHCP was enabled without a reachable DHCP server it became unreachable?
By design systemd networkd won't remove an address assigned when it started
Look like IPMI always gets the first IP address from ip a
, without checking the IP Address Source and the IP Address corresponding to the mode.
With below output from ip a
,
# ip a show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 9c:c2:c4:53:7c:90 brd ff:ff:ff:ff:ff:ff
inet 10.77.108.196/24 brd 10.77.108.255 scope global eth0
valid_lft forever preferred_lft forever
inet 10.77.108.96/24 brd 10.77.108.255 scope global secondary dynamic eth0
valid_lft 604770sec preferred_lft 604770sec
inet6 fe80::9ec2:c4ff:fe53:7c90/64 scope link
valid_lft forever preferred_lft forever
IPMI will return IP Addresss 10.77.108.196.
As I said it's looking at the address independently of the DHCP status.
The real question is why does the static address still exist after step 7 changing back to DHCP
As I know, per https://github.com/openbmc/phosphor-networkd/blob/master/docs/Network-Configuration.md#ipaddress-objects, phosphor-networkd supports multiple IP addresses for an Ethernet interface. And it supports at least a static IP and a dynamic IP at the same time, reporting to Redfish EthernetInterface schema. The issue just comes when working with IPMI that just supports 1 IP per an interface. As the phosphor-networkd has information, IPMI should check from dbus to report correct information
I don't see anything in your reference about DHCP vs static address.
I haven't checked redfish but the reference I made above shows getting the DHCP vs static assignment from the interface object independent of the addresses. (I'm replying from my phone but traced the path last week). I didn't think both kinds simultaneously in one interface was supported but could be remembered during transition to ease transition during PATCH
The link I posted indicates that multiple IP addresses is accepted. And I believe that phosphor-networkd is the background application for Ethernet feature. Let me show my test on IPMI commands:
# ip a show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 9c:c2:c4:53:7c:90 brd ff:ff:ff:ff:ff:ff
inet 10.77.108.96/24 brd 10.77.108.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::9ec2:c4ff:fe53:7c90/64 scope link
valid_lft forever preferred_lft forever
# ipmitool lan set 1 ipsrc static
# ipmitool lan set 1 ipaddr 10.77.108.196
Setting LAN IP Address to 10.77.108.196
# ipmitool lan set 1 netmask 255.255.255.0
Setting LAN Subnet Mask to 255.255.255.0
# ipmitool lan set 1 defgw ipaddr 10.38.153.1
Setting LAN Default Gateway IP to 10.38.153.1
# ip a show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 9c:c2:c4:53:7c:90 brd ff:ff:ff:ff:ff:ff
inet 169.254.133.251/16 brd 169.254.255.255 scope link eth0
valid_lft forever preferred_lft forever
inet 10.77.108.196/24 brd 10.77.108.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::9ec2:c4ff:fe53:7c90/64 scope link
valid_lft forever preferred_lft forever
# ipmitool lan print 1
Set in Progress : Set Complete
Auth Type Support :
Auth Type Enable : Callback :
: User :
: Operator :
: Admin :
: OEM :
IP Address Source : Static Address
IP Address : 10.77.108.196
Subnet Mask : 255.255.255.0
MAC Address : 9c:c2:c4:53:7c:90
# ipmitool lan set 1 ipsrc dhcp
# ip a show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 9c:c2:c4:53:7c:90 brd ff:ff:ff:ff:ff:ff
inet 10.77.108.196/24 brd 10.77.108.255 scope global eth0
valid_lft forever preferred_lft forever
inet 10.77.108.96/24 brd 10.77.108.255 scope global secondary dynamic eth0
valid_lft 604770sec preferred_lft 604770sec
inet6 fe80::9ec2:c4ff:fe53:7c90/64 scope link
valid_lft forever preferred_lft forever
ipmitool lan print
displays incorrect IP address
root@mtmitchell-dcscm:~# ipmitool lan print 1
Set in Progress : Set Complete
Auth Type Support :
Auth Type Enable : Callback :
: User :
: Operator :
: Admin :
: OEM :
IP Address Source : DHCP Address
IP Address : 10.77.108.196 <-- should be 10.77.108.96
Subnet Mask : 255.255.255.0
MAC Address : 9c:c2:c4:53:7c:90
$ curl --user root:0penBmc --insecure -H "Content-Type: application/json" -H "If-Match: *" \
-X GET https://10.77.108.96/redfish/v1/Managers/bmc/EthernetInterfaces/eth0
{
....
"DHCPv4": {
"DHCPEnabled": true,
....
}
"IPv4Addresses": [
{
"Address": "10.77.108.96",
"AddressOrigin": "DHCP",
"Gateway": "10.77.108.1",
"SubnetMask": "255.255.255.0"
},
{
"Address": "10.77.108.196",
"AddressOrigin": "Static",
"Gateway": "10.77.108.1",
"SubnetMask": "255.255.255.0"
}
],
"IPv4StaticAddresses": [
{
"Address": "10.77.108.196",
"AddressOrigin": "Static",
"Gateway": "10.77.108.1",
"SubnetMask": "255.255.255.0"
}
],
# ipmitool lan set 1 ipaddr 0.0.0.0
Setting LAN IP Address to 0.0.0.0
# ip a show eth0 <-- the static IP is removed
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 9c:c2:c4:53:7c:90 brd ff:ff:ff:ff:ff:ff
inet 10.77.108.96/24 brd 10.77.108.255 scope global dynamic eth0
valid_lft 604676sec preferred_lft 604676sec
inet6 fe80::9ec2:c4ff:fe53:7c90/64 scope link
valid_lft forever preferred_lft forever
# ipmitool lan set 1 ipsrc dhcp
# ipmitool lan print
Set in Progress : Set Complete
Auth Type Support :
Auth Type Enable : Callback :
: User :
: Operator :
: Admin :
: OEM :
IP Address Source : DHCP Address
IP Address : 10.77.108.96
Subnet Mask : 255.255.255.0
MAC Address : 9c:c2:c4:53:7c:90
It looks like both IP addresses are enabled and it seems like the IPMI code is just picking one of them?
Yes @williamspatrick , In case both IP address assigned the IPMI code just return one of them. More detail, the IPMI code just return the first object dbus in the eth0
interface. The phosphor-host-ipmid fixed the index that always is 0 https://github.com/openbmc/phosphor-host-ipmid/blob/master/transporthandler.cpp#L280
As I said it's looking at the address independently of the DHCP status.
The real question is why does the static address still exist after step 7 changing back to DHCP
Yes @mdmillerii, Sorry for late reply! I spend more time to debug on the phosphor-host-ipmid and phosphor-networkd.
Agree @mdmillerii , it's looking at the IP address and DHCP status independently.
DHCP4
property of /xyz/openbmc_project/network/ethX
object path (https://github.com/openbmc/phosphor-host-ipmid/blob/master/transporthandler.cpp#L1166) . If the DHCP4
property is true
, the ethx
interface will be DHCP
enable mode.Address
property of the /xyz/openbmc_project/network/ethX/xxxxxxxxxxxx
object path.As I said it's looking at the address independently of the DHCP status.
The real question is why does the static address still exist after step 7 changing back to DHCP
After changing to DHCP mode, then the static address still exists. Because actually the DHCP switching command (as step 7 mentioned ipmitool lan set 1 ipsrc dhcp
), that is a DHCP enable dbus command; it calls to phosphor-networkd only for enable DHCP mode (refer this dbus command here https://github.com/openbmc/phosphor-networkd/blob/master/docs/Network-Configuration.md#configure-dhcp). It doesn't delete any other IP address.
In order to delete the static address, we need to use a other command (https://github.com/openbmc/phosphor-networkd/blob/master/docs/Network-Configuration.md#delete-ip-address)
Hi @williamspatrick and @mdmillerii , I think we should implement a simultaneous between IP Address
and IP Address source
instead of the hard code for index object lookup always being 0
(as mentioned at https://github.com/openbmc/phosphor-host-ipmid/blob/master/transporthandler.cpp#L280)
implement a simultaneous between
IP Address
andIP Address source
I don't know what that means.
It seems fine to me if you want to propose a change to the ipmi code to handle this better. The intuitive thing to me would be to prioritize the addresses (and types) so that DHCP is prioritized over static, if it is available. There is probably nothing that is 100% right in all scenarios from all people's perspectives, but that is a limitation of IPMI.
It seems fine to me if you want to propose a change to the ipmi code to handle this better. The intuitive thing to me would be to prioritize the addresses (and types) so that DHCP is prioritized over static, if it is available. There is probably nothing that is 100% right in all scenarios from all people's perspectives, but that is a limitation of IPMI.
Thank @williamspatrick , I'm preparing the patch. I'll push to gerrit soon and add you as a reviewer.
Hi all, I'm testing on
master
branch and ate7ef94d350cd156c54a5789ce7d53eb1a55f7da9
(Commits on Aug 30, 2024 ).Issue: The
ipmitool lan print
command returns wrongIP Address
after I switchIP Address Source
fromStatic
toDHCP
Step to reproduce:
IP Address Source
andIP Address
byipmitool lan print
commandStatic
source by commandIP Address Source
andIP Address
byipmitool lan print
commandDHCP
source by commandIP Address Source
andIP Address
byipmitool lan print
commandnetworkctl status
on theeth0
Dbus object on the
10.38.153.70
Dbus object on the
10.38.153.72
Expectation: The step#8 returns correct the
IP Address Source
(DHCP Address
) andIP Address
(10.38.153.72
) (as mentioned at step#2) Actual: The step#8 returns wrongIP Address
(10.38.153.70
) forDHCP
source. The10.38.153.70
isStatic
source (as mentioned at step#6)