Category Archives: Network
How to restore MAC address in Linux with C.

In this example you can learn how to get default interface’s mac address even if it was changed in operating system. Example written in C 89.
Program uses ethtool’s kernel ioctl. “ethtool -P interface_name” does the same work.

Get CIDR subnet mask from IPv4 address range.

example: $ ./iprange2mask 10.10.0.1 10.10.0.127
25