Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to check if eth address is taken from DHCP or set manually (static) using Python?

share|improve this question
This similar question (near duplicate) may help:… – mwalsh Jan 17 '12 at 20:40

I think it's going to depend on how the network is configured. Network connections in Ubuntu are either configured for the computer, or by the individual user through Network Manager (that little network icon in your notification area). Servers are generally configured system-wide from /etc, while desktops are configured by Network Manager.

If it's a system-wide configuration, you can parse /etc/network/interfaces.

If the network was configured by Network Manager on the desktop, you can interface with it. You can find an example Python script that prints connections from the Network Manager examples.

There might be a lower-level way of finding out whether any particular interface is dhcp, but I don't know of it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.