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

More accurately, how do I tell Ubuntu to obtain an address using DHCP for all the network interfaces it finds (which do not require a password)?

share|improve this question
This may interest you. (Perhaps someone can write an answer with more detail about that, or add it to an existing answer.) – Eliah Kagan May 26 '12 at 5:18
@EliahKagan: Thanks, that's a useful link. :) – Mehrdad May 26 '12 at 5:24
ifconfig -a

lists all the network interfaces, so you can run

ifconfig -a | grep --only-matching -i "^\w\+" | xargs -l1 sudo dhclient

whenever you want to connect to a network.

If you would like it to happen when you log in, simply append it to the file ~/.bashrc (for you only) or /etc/bash.bashrc (globally).

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.