Como eu uso um IP estático no Ubuntu 17.10 e mais recente?

4

Eu mudei a configuração de dhcp para estática (192.168.0.17), mas ainda recebendo um dhcp atribuído (192.168.0.141) IP. Eu não sei mais onde checar ... alguma idéia?

ifconfig

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.141  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::20c:29ff:fe87:6981  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:87:69:81  txqueuelen 1000  (Ethernet)
        RX packets 43080139  bytes 55213169928 (55.2 GB)
        RX errors 0  dropped 1  overruns 0  frame 0
        TX packets 17923871  bytes 1406116280 (1.4 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 56350  bytes 6166732 (6.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 56350  bytes 6166732 (6.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

nmcli d

DEVICE  TYPE      STATE      CONNECTION
ens33   ethernet  unmanaged  --
lo      loopback  unmanaged  --

/ etc / network / interfaces

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# Generated by debian-installer.

# The loopback interface
auto lo
iface lo inet loopback

#The primary network interface
auto ens33
iface ens33 inet static
address 192.168.0.17
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 192.168.0.1

/etc/NetworkManager/NetworkManager.conf

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=false

[device]
wifi.scan-rand-mac-address=no

uname -a

Linux server 4.13.0-16-generic #19-Ubuntu SMP Wed Oct 11 18:35:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
    
por igtoth 18.11.2017 / 20:36

1 resposta

6

A rede é gerenciada pelo netplan por padrão no Ubuntu Server 17.10. Sugiro que você edite o arquivo /etc/netplan/01-netcfg.yaml para ler:

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    ens33:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.0.17/24]
      gateway4: 192.168.0.1
      nameservers:
        addresses: [8.8.8.8,192.168.0.1]

Saia e salve suas alterações executando o comando:

sudo netplan apply

Por favor, note e siga o espaçamento e recuo.

Comente todas as sub-insas ens33 em /etc/network/interfaces . Reinicie.

Alguma melhoria?

    
por chili555 18.11.2017 / 20:50