Using ip addr instead of ifconfig reports "RTNETLINK answers: File exists" on Debian

I got it that I had to flush the device before bringing it up:

# ip addr flush dev eth1

Clearing manually set interface configuration information like this is mentioned in the Ubuntu Server Guide.


Using ip addr flush will work, but it will also clear any and all addresses set on that interface - possibly including the one that you are using, if you're logged in to a remote machine. This may lock you out of your device.

RNETLINK answers: File exists happens when you're trying to add a rule that conflicts with an existing rule. I would guess that OP was encountering this because they had already set the address with ifconfig. This error can usually be resolved by converting the add command to a similarly structured change or replace command.

It's much safer to use ip addr change or ip addr replace instead.