Add Eth0 but there is LO and ENS160

5,050

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 10.10.10.2 with netmask 255.255.255.0 (i.e. prefix /24), default gateway 10.10.10.1, DNS server 10.10.10.1 and 1.1.1.1 with default DNS search domains mydomain.example and otherdomain.example, you would write this into e.g. /etc/netplan/99_config.yaml:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens160:
      addresses:
        - 10.10.10.2/24
      gateway4: 10.10.10.1
      nameservers:
          search: [mydomain.example, otherdomain.example]
          addresses: [10.10.10.1, 1.1.1.1]

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

Share:
5,050

Related videos on Youtube

Jeff Schaller
Author by

Jeff Schaller

Unix Systems administrator http://www.catb.org/esr/faqs/smart-questions.html http://unix.stackexchange.com/help/how-to-ask http://sscce.org/ http://stackoverflow.com/help/mcve

Updated on September 18, 2022

Comments

  • Jeff Schaller
    Jeff Schaller almost 2 years

    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