Estou com dificuldade em atribuir um endereço IP estático e permanente à interface eth0
padrão em um sistema que executa o Ubuntu 14.04.5, com o sistema, em última análise, não utilizando nenhum endereço IP.
Como precursor do seguinte, o sistema de destino é um sistema embarcado e não podemos permitir nenhuma alteração na interface de rede durante a operação do sistema.
Minha configuração é a seguinte:
network-manager
foi desativado.
/etc/network/interfaces
foi configurado da seguinte forma:
auto eth0
iface eth0 inet static
address 192.168.200.1
netmask 255.255.255.0
Ocorreu um problema durante a inicialização, pelo qual o daemon do servidor NTP pode fazer com que o sistema fique travado por uns bons 5 minutos. Fazendo alguns Googling indicou que um pacote chamado ntpdate
é um pouco desonesto - então isso foi removido (nós temos nosso próprio método para definir a data / hora do sistema).
O serviço avahi-autoip
foi desativado para impedir que um IP privado automático seja atribuído.
Fundamentalmente, porém, algo está acontecendo em algum momento que está removendo o endereço IP estático vinculado a eth0
- se é um serviço DHCP persistente (com certeza o iface eth0 inet static
deve evitar isso) ou algo mais que eu não tenho conhecimento.
Uma coisa que eu notei é que em algum momento, um PING
é feito para o servidor DNS na rede interna (IP 192.168.0.5, este servidor DNS não está acessível devido a uma sub-rede diferente) que instiga algum tipo de verificação de atualização de pacotes que falha - após a falha, um fluxo constante de RTNETLINK answers: Network is unavailable
mensagens aparece sem nenhuma maneira viável de se livrar delas.
Para referência, aqui estão algumas saídas:
ifconfig
eth0 Link encap:Ethernet HWaddr 00:14:2d:2c:6f:5b
inet addr:192.168.200.1 Bcast:192.168.200.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:92 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13544 (13.5 KB) TX bytes:7311 (7.3 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:112131 errors:0 dropped:0 overruns:0 frame:0
TX packets:112131 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11558635 (11.5 MB) TX bytes:11558635 (11.5 MB)
ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default
link/ether 92:23:f9:47:e0:5a brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:14:2d:2c:6f:5b brd ff:ff:ff:ff:ff:ff
inet 192.168.200.1/24 brd 192.168.200.255 scope global eth0
valid_lft forever preferred_lft forever
4: ip6tnl0: <NOARP> mtu 1452 qdisc noop state DOWN group default
link/tunnel6 :: brd ::
5: rmnetctl: <NOARP> mtu 1500 qdisc noop state DOWN group default
link/ipip 0.0.0.0 brd 0.0.0.0
6: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 00:16:6f:db:90:a2 brd ff:ff:ff:ff:ff:ff
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
192.168.200.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
dhclient
root 1301 0.0 0.1 3980 2728 ? S 00:00 0:00 dhclient eth0
root 3198 0.0 0.1 3980 2728 ? S 00:02 0:00 dhclient eth0
Erro PING
PING 192.168.0.5 (192.168.0.5) 56(84) bytes of data.
--- 192.168.0.5 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
ii librsync1:armhf 0.9.7-10 armhf rsync remote-delta algorithm library
ii rsync 3.1.0-2ubuntu0.2 armhf fast, versatile, remote (and local) file-copying tool
Reading package lists... Done
Building dependency tree
Reading state information... Done
rsync is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
netcat-openbsd is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
RTNETLINK answers: Network is unreachable
ifconfig após o PING
(note que nenhum endereço IP)
RTNETLINK answers: Network is unreachable
g
eth0 Link encap:Ethernet HWaddr 00:14:2d:2c:6f:5b
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:113 errors:0 dropped:0 overruns:0 frame:0
TX packets:86 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16588 (16.5 KB) TX bytes:23129 (23.1 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:1425523 errors:0 dropped:0 overruns:0 frame:0
TX packets:1425523 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:214682465 (214.6 MB) TX bytes:214682465 (214.6 MB)