How to find out if the eth0 mode is static or dhcp?

后端 未结 3 997
梦毁少年i
梦毁少年i 2020-12-20 19:51

I want to use a C program to get if the ip of the network interface is set manually or via dhcp.

I\'ve tried to use the following code and it has worked in Debian, b

3条回答
  •  抹茶落季
    2020-12-20 20:11

    There's no required way for an OS to decide how an interface should be configured. The kernel (the Linux part of e.g. GNU/Linux) doesn't decide, it doesn't (and shouldn't) care, it just gets told which network addresses go with which interfaces by whatever configuration system the OS is using. OpenWRT's not GNU, it operates differently.

提交回复
热议问题