-
Notifications
You must be signed in to change notification settings - Fork 0
Neo Server IP Estático
Antes de alterar a configuração, a interface de rede deve ser parada:
root@rapsberrypi:~# ifdown eth0
A configuração das interfaces de rede é guardada no ficheiro /etc/network/interfaces:
root@rapsberrypi:~# cp /etc/network/interfaces /etc/network/interfaces.original
root@rapsberrypi:~# nano /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
# allow-hotplug eth0
# iface eth0 inet dhcp
# Static IP address
auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-search rthomaz.local
dns-nameservers 192.168.0.101
É necessário também indicar qual o endereço do servidor DNS. Nesta configuração, o servidor DNS funciona no modem/router ADSL ou cabo, pelo que o parâmetro nameserver deve ter o valor 192.168.0.1, no ficheiro /etc/resolv.conf:
root@rapsberrypi:~# cp /etc/resolv.conf /etc/resolv.conf.original
root@rapsberrypi:~# nano /etc/resolv.conf
domain rthomaz.local
search rthomaz.local
nameserver 192.168.0.100
Reiniciar a interface de rede para ativar a nova configuração:
root@server:~# ifup eth0
O comando ifconfig fornece informação detalhada sobre a configuração das interfaces de rede. A configuração da interface eth0 deve exibir agora os parâmetros previamente definidos:
root@server:~# ifconfig
eth0 Link encap:Ethernet HWaddr d4:5a:ff:c6:4c:01
inet addr:192.168.0.100 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::d6ae:52ff:fec5:4e01/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6137 errors:0 dropped:0 overruns:0 frame:0
TX packets:2402 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6711753 (6.4 MiB) TX bytes:207609 (202.7 KiB)
Interrupt:16
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:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Deverá ser também possível contactar servidores Internet:
root@server:~# ping -c3 www.debian.org
PING www.debian.org (5.153.231.4) 56(84) bytes of data.
64 bytes from senfter.debian.org (5.153.231.4): icmp_seq=1 ttl=48 time=59.1 ms
64 bytes from senfter.debian.org (5.153.231.4): icmp_seq=2 ttl=48 time=57.8 ms
64 bytes from senfter.debian.org (5.153.231.4): icmp_seq=3 ttl=48 time=58.1 ms
--- www.debian.org ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 57.893/58.408/59.195/0.598 ms