I have a USB network interface which I want to set the IP address and netwmask on manually. If I do that this way:

$ sudo ip addr add dev eno1

I also run this:

$ nmcli dev set eno1 managed no  
$ nmcli dev
DEVICE           TYPE      STATE         CONNECTION             
eno1             ethernet  unmanaged     -- 

But then after a variable amount of time (usually less than a minute) the IP address will be lost. If I run nmcli dev again, I see that it has again become a managed interface:

$ nmcli dev
DEVICE           TYPE      STATE                                  CONNECTION         
eno1             ethernet  connecting (getting IP configuration)  Wired connection 2

I've read answers like Set static IP Ubuntu which require editing a file. I don't want to make this change permanent, so how can I set a static IP via command-line only, no file editing?

  • Is the behavior improved if you stop Network Manager? sudo service network-manager stop Welcome to Ask Ubuntu.
    – chili555
    Mar 16 '19 at 19:56
  • No, stopping network manager does not change the behavior.
    – fawefawef
    Mar 16 '19 at 22:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.