[Tutor] python and interface duplex checks

Michael Langford michael.langford at gmail.com
Thu Dec 13 05:05:56 CET 2007

Most easily: If your card supports ethtool, you can just open the
ethtool startup config file to check there whether or not you set it
to duplex in the configuration (see if you have an ETHTOOL_OPTS env

If you're not sure if your card can handle duplex (or you're not sure
the config file accurately shows what your card is set to), then you
can (more complicatedly) run ethtool with
popen(http://docs.python.org/lib/os-newstreams.html#os-newstreams) and
look for the status by parsing the duplex line.

If you're not yet using ethtool, you should if you can. If you can't
reply back to the list and I'll delve into the older mii-tools to tell
you which one to hack on.


On Dec 12, 2007 9:48 PM, Robert Recchia <robrecc at gmail.com> wrote:
> I was wondering can python can be used to check the duplex settings of a
> network card on a Linux os.
> --
> Robert Recchia
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

Michael Langford
Phone: 404-386-0495
Consulting: http://www.RowdyLabs.com

More information about the Tutor mailing list