Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Endereo IP esttico
Servidor Debian Lenny 2. Configurao de base 2.1. Rede local 2.1.1. Endereo IP esttico fold Table of Contents Objectivo Configurao Verificao Referncias Comentrios
Objectivo
A instalao por omisso do Debian configura a rede para obter um endereo dinmico via DHCP. No entanto, para que o sistema seja configurado como um servidor, deve ter um endereo IP esttico. O objectivo configurar a interface de rede eth0 com o endereo IP esttico 192.168.1.100. Ao mesmo tempo ser indicado o endereo do dispositivo acesso Internet, ou "gateway" (192.168.1.1). Numa configurao caseira, este ser o endereo esttico do router ADSL ou Cabo.
Configurao
A configurao das interfaces de rede guardada no ficheiro /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.1.100 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 necessrio tambm indicar qual o endereo do servidor DNS. Nesta configurao, o servidor DNS funciona no router ADSL, pelo que o parmetronameserver deve ter o valor 192.168.1.1, no ficheiro /etc/resolv.conf:
domain localdomain search localdomain nameserver 192.168.1.1 Reiniciar os servios de rede: server:~# /etc/init.d/networking restart Reconfiguring network interfaces...done.
Verificao
O comando ifconfig fornece informao detalhada sobre a configurao das interfaces de rede. A configurao da interface eth0 deve exibir agora os parmetros previamente definidos: server:~# ifconfig eth0 Link encap:Ethernet HWaddr 00:0c:29:3c:96:f8 inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe3c:96f8/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:6677 errors:0 dropped:0 overruns:0 frame:0 TX packets:3394 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:7775032 (7.4 MiB) TX bytes:247832 (242.0 KiB) Interrupt:19 Base address:0x2000 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:16436 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 tambm possvel contactar servidores Internet: server:~# ping -c3 www.debian.org PING www.debian.org (194.109.137.218) 56(84) bytes of data. 64 bytes from klecker.debian.org (194.109.137.218): icmp_seq=1 ttl=128 time=67.7 ms 64 bytes from klecker.debian.org (194.109.137.218): icmp_seq=2 ttl=128 time=107 ms 64 bytes from klecker.debian.org (194.109.137.218): icmp_seq=3 ttl=128 time=93.6 ms --- www.debian.org ping statistics --3 packets transmitted, 3 received, 0% packet loss, time 2005ms rtt min/avg/max/mdev = 67.780/89.547/107.240/16.365 ms