NETWORKING - Portable way to get list of all active network interfaces

I would like to get the list of all active network interfaces (e.g. eth0, wlan0). I assume I'll have to parse the output of ifconfig, but the formatting is different across the various OS's. Does anybody have a portable way to get this information so it can be used on the majority of unices (linux, *bsd, mac).

This question and answers originated from www.serverfault.com
Question by (5/1/2011 9:53:42 PM)

Answer

Not sure about portabilty because a list of network interfaces may be related to the kernel implementation and linux is not related at all to *bsd/mac... however if ifconfig is not good for you you can try netstat -i

Answer by

Find More Answers
Related Topics  networking  ifconfig
Related Questions
  • How to define a secondary IP address that is down by default

    I can define a secondary IP address on the same network card by adding the lines auto eth0:1 iface eth0:1 inet static address 192.168.9.101 ... to /etc/network/interfaces . This gi…
  • Correct way of bringing network interface down in linux

    For example: $ ifconfig dummy0 up $ ifconfig dummy0 "192.168.1.190 netmask 255.255.255.0" Calling ifconfig with no parameters shows the interface dummy0 Link encap:Ethernet HWaddr b6:1f:f…
  • configuring two network interfaces in ubuntu 10.04.1

    I have got two NICs configured on a VM - each is tied to a specific network, one is a DMZ, the other is an internal network. I want MySQL to listen on the internal network only and Apache on the …
  • How to monitor Network tarffic with MySQL?

    ifconfig -output is somewhat messy thing to look at. When I saw the nice output below with the command (source) , the question emerged: Is there some more structured way, let say MySQL, to lo…
  • slackware cannot reconnect to local network

    Hi guys this problem is frustrating me. After trying a lot of things to setup my wireless card, I decide to test it by shutting down LAN ifconfig eth0 down . Then because the wireless does not work …
  • How to keep network interface up, during cable disconnects

    I have two ubuntu PCs whose network cards connected directly to each other with cross-over cable. I have assigned ip addresses manually to their interfaces using command similar to ifconfig eth0…
  • Network Configuration

    This is my situation: Router A: IP 192.168.1.1 Mask 192.168.1.0/24 - Connected to the internet. Server: - Interface eth0: inet addr:10.1.1.125 Mask:255.255.255.0 (connected to router B) - …
  • Problem configuring Network aliases

    Struggling a bit trying to work this out. I'm on a Centos 5.5 VPS with multiple IP addresses. I've setup the IP address alias for eth0 (eth0, eth0:1, eth0:2, eth0:3, eth0:4, eth0:5), each with a …
  • How do you find current internet network interface?

    How do I find the network interface that's connected to the Internet? This machine could typically be connected via {eth0,eth1,usb0,wlan0} . The best I could think of is: sudo route | grep def…
  • Add static ARP entries when network is brought up

    I have some pretty dumb IP devices on a subnet with my Ubuntu server, and the server receives streaming data from each device. I have run into a problem in that when an ARP request is issued to the …