Não é possível definir um ip estático para o sistema Xubuntu

0

Eu quero definir o IP estático na minha máquina. Isso é o que eu tenho agora:

root@jim-VirtualBox:~# ifconfig
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:81:10:5c  
          inet addr:192.168.1.6  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:783 errors:0 dropped:1 overruns:0 frame:0
          TX packets:168 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:71283 (71.2 KB)  TX bytes:19709 (19.7 KB)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:14:64:9d  
          inet addr:192.168.99.101  Bcast:192.168.99.255  Mask:255.255.255.0
          inet6 addr: fe80::3461:cced:7c8e:8911/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:136 errors:0 dropped:0 overruns:0 frame:0
          TX packets:74 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:24237 (24.2 KB)  TX bytes:10606 (10.6 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:129 errors:0 dropped:0 overruns:0 frame:0
          TX packets:129 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:10194 (10.1 KB)  TX bytes:10194 (10.1 KB)

root@jim-VirtualBox:~

Eu editei o meu arquivo de interfaces como abaixo:

root@jim-VirtualBox:~# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto enp0s3
iface enp0s3 inet static 
address 192.168.1.11
netmask 255.255.255.0 
gateway 192.168.1.1

root@jim-VirtualBox:~# 

Agora, se eu fizer o ifconfig, continuo recebendo 192.168.1.6 e não o .11 (último bit)

root@jim-VirtualBox:~# ifconfig
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:81:10:5c  
          inet addr:192.168.1.6  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:811 errors:0 dropped:1 overruns:0 frame:0
          TX packets:186 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:75130 (75.1 KB)  TX bytes:22702 (22.7 KB)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:14:64:9d  
          inet addr:192.168.99.101  Bcast:192.168.99.255  Mask:255.255.255.0
          inet6 addr: fe80::3461:cced:7c8e:8911/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:136 errors:0 dropped:0 overruns:0 frame:0
          TX packets:74 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:24237 (24.2 KB)  TX bytes:10606 (10.6 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:129 errors:0 dropped:0 overruns:0 frame:0
          TX packets:129 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:10194 (10.1 KB)  TX bytes:10194 (10.1 KB)

root@jim-VirtualBox:~# 

Alguma ideia do que está errado aqui?

Sim, eu fiz /etc/init.d/networking restart

    
por learner 16.06.2016 / 16:12

1 resposta

0

Eu prefiro vim em vez de gato. Veja como eu defino IPs estáticos no dia a dia:

Obtenha e instale o vim (se necessário):

sudo apt-get install vim

Abra para editar o arquivo de interfaces de rede:

vi /etc/network/interfaces

Faça alterações no arquivo de interfaces de rede para aparecer da seguinte forma: usei 192.168.10.10 como o IP estático no exemplo.

auto enp2s0
iface enp2s0 inet static
    address 192.168.10.10
    netmask 255.255.255.0
    network 192.168.10.0
    broadcast 192.168.10.255
    gateway 192.168.10.1
    dns-nameservers 192.168.10.111

Em seguida, reinicie o serviço como faria normalmente ou como faria:

sudo ifdown enp2s0

espere

sudo ifup enp2s0

Agora verifique seu ifconfig e você deverá ver o IP estático

ifconfig

Boa sorte e aproveite!

Se isso não funcionar, desligue e ligue novamente todas as interfaces de rede com sudo ifdown -a e sudo ifup -a

    
por Software_Programineer 16.06.2016 / 17:06