Linux getting all network interface names

You could check which entries from getifaddrs belong to the AF_PACKET family. On my system that seems to list all interfaces: struct ifaddrs *addrs,*tmp; getifaddrs(&addrs); tmp = addrs; while (tmp) { if (tmp->ifa_addr && tmp->ifa_addr->sa_family == AF_PACKET) printf(“%s\n”, tmp->ifa_name); tmp = tmp->ifa_next; } freeifaddrs(addrs);

How do I get the network interface and its right IPv4 address?

foreach(NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) { if(ni.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 || ni.NetworkInterfaceType == NetworkInterfaceType.Ethernet) { Console.WriteLine(ni.Name); foreach (UnicastIPAddressInformation ip in ni.GetIPProperties().UnicastAddresses) { if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) { Console.WriteLine(ip.Address.ToString()); } } } } This should get you what you want. ip.Address is an IPAddress, that you want.