Как правильно установить имя хоста и имя домена?

Вам нужно рабочее подключение к Интернету, а затем скомпилировать правильный драйвер r8168

Включите репозиторий Universe , добавив следующую строку в свой sources.list :

deb http://de.archive.ubuntu.com/ubuntu/ xenial main restricted universe

Обновите и установите r8168-dkms пакет:

sudo apt-get update 
sudo apt-get install r8168-dkms

Перезагрузите систему

34
13.11.2016, 01:56
3 ответа

sudo nano /etc/имя хоста

hostname.domain.com

sudo nano /etc/hosts

127.0.0.1   hostname.domain.com hostname localhost

ПЕРЕЗАГРУЗКА!

ДОЛЖНО ИМЕТЬ ОДИН ИМЯ ХОСТА после FQDN в файле /etc/hosts. Отлично работает на Ubuntu 18.04.1 и всех других версиях. На EC2 и в других местах.

Не заморачивался ни с файлом разрешения, ни с чем-то еще.

Это показывает имя хоста в оболочке, а затем полное доменное имя, когда вам это нужно.

12
27.01.2020, 19:37

Я попытался изменить запись своего домена с myhome.localна myhome.lan. Мне пришлось редактировать файл /etc/hostsи файл /etc/network/interfaces. Мой файл /etc/hostsтеперь выглядит как:

127.0.0.1   localhost
192.168.3.2 server.myhome.lan   server

и мой файл /etc/network/interfacesтеперь выглядит как:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp2s0
iface enp2s0 inet static
    address 192.168.3.2
    netmask 255.255.255.0
    network 192.168.3.0
    broadcast 192.168.3.255
    gateway 192.168.3.1
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 192.168.3.1
    dns-search myhome.lan

У меня работает нормально.

0
27.01.2020, 19:37

~$ man имя хоста

[…]
       You cannot change the FQDN with hostname or dnsdomainname.

       The  recommended  method  of  setting the FQDN is to make the hostname be an alias for the fully qualified name using /etc/hosts,
       DNS, or NIS. For example, if the hostname was "ursula", one might have a line in /etc/hosts which reads

              127.0.1.1    ursula.example.com ursula

       Technically: The FQDN is the name getaddrinfo(3) returns for the host name returned by gethostname(2).  The DNS  domain  name  is
       the part after the first dot.

       Therefore  it  depends  on the configuration of the resolver (usually in /etc/host.conf) how you can change it. Usually the hosts
       file is parsed before DNS or NIS, so it is most common to change the FQDN in /etc/hosts.

       If a machine has multiple network interfaces/addresses or is used in a mobile environment,  then  it  may  either  have  multiple
       FQDNs/domain  names  or  none at all. Therefore avoid using hostname --fqdn, hostname --domain and dnsdomainname.  hostname --ip-
       address is subject to the same limitations so it should be avoided as well.

[…]

На это любезно указал poige в другой ветке , и это именно то, что Лутц предложил здесь.

Вы не должны вводить свое полное доменное имя в /etc/hostname.

5
27.01.2020, 19:37

Теги

Похожие вопросы