Server Fault is a question and answer site for system and network administrators. 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 would I assign an IP address usng ip (the Linux tool)? I've been doing it with ifconfig so far.

share|improve this question
up vote 3 down vote accepted

ip addr add <IP address> dev <device name>

IP man page

share|improve this answer

From the ip man page:

ip addr { add | del } IFADDR dev STRING

Therefore:

ip addr add 192.168.0.1 dev eth0
share|improve this answer
ip addr add a.b.c.d/mm brd + dev iface

brd + means asking iproute2 to automatically calculate the broadcast address based on the subnet information. E.g.:

ip addr add 192.168.4.55/24 brd + dev eth0
share|improve this answer

Your Answer

 
discard

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.