Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

3 Answers 3

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.