In the Core library there is the
ip addr show
The OCaml abstract machine doesn't include a notion of a network interface, so it is not possible to implement such behavior with the portable part of the OCaml standard library, without relying on OS-specific interfaces.
In fact, it is not even possible in C. As the interface is kernel specific, so in order to write such function, you will need to write a separate implementation for each Unix system, you're planning to target. For example, in C you will need to use
ioctl interface, and use Linux kernel specific operations.
Good news is that you can still do it using OCaml. Although OCaml doesn't provide
ioctl function, you can still call it via either C Types foreign function interface or, directly, by writing a stub function.