I want to add static Ip to ubunto server , but I can not . when I use " ip addr" : enter image description here

and there is no "network" service . how can I setup static IP ? I am beginner at linux, please guide me A-Z thanks in advance

1 Answer 1


You're probably trying to follow obsolete instructions.

ens160 is a new-style network device name, while eth0is old-style.

Also, modern Ubuntu uses netplan to configure network settings: you should create (or edit, if one already exists) a simple *.yaml file describing your desired network configuration in /etc/netplan/ directory, and then run sudo netplan apply to make it take effect.

For example, to set IP address with netmask (i.e. prefix /24), default gateway, DNS server and with default DNS search domains mydomain.example and otherdomain.example, you would write this into e.g. /etc/netplan/99_config.yaml:

  version: 2
  renderer: networkd
          search: [mydomain.example, otherdomain.example]
          addresses: [,]

Note that in YAML, correct indentation is an important part of the syntax.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .