Posts

Showing posts from May, 2017

Linux kernel documentation for /sys/class/net

Recently I am working on a project to handle network interface failure which involves detecting the connected state of a network cable. After searching around the Internet I found the post from Stack Overflow mentioned a good way to solve the problem. As Kent Fredric said,we can use /sys/class/net/<iface>/carrier and  /sys/class/net/<iface>/operstate to identify the connected state of a network cable. What does /sys/class/net/<iface>/carrier and /sys/class/net/<iface>/operstate means? From the kernel documentation I found the description for them: What: /sys/class/net/<iface>/operstate Date: March 2006 KernelVersion: 2.6.17 Contact: netdev@vger.kernel.org Description: Indicates the interface RFC2863 operational state as a string. Possible values are: "unknown", "notpresent", "down", "lowerlayerdown", "testing", "dormant", "up". What: /sys/class/net/<iface>/carr