1

How would I assign an IP address usng ip (the Linux tool)? I've been doing it with ifconfig so far.

Czarn
  • 25
  • 3

3 Answers3

3

From the ip man page:

ip addr { add | del } IFADDR dev STRING

Therefore:

ip addr add 192.168.0.1 dev eth0
growse
  • 8,020
  • 13
  • 74
  • 115
3

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

IP man page

chuckx
  • 1,150
  • 6
  • 8
2
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
pepoluan
  • 5,038
  • 4
  • 47
  • 72