Ferramentas de Utilizador

Ferramentas de Site

Barra Lateral

Traduções para esta página?:

Debian 8 'Jessie' Server

Debian 7.0 wheezy Server


2.1.2 Static IP Address


Debian Installer usually has configured the network interfaces to get its network settings from a DHCP server. However to configure our system as a network server it must have a static IP address.

Our objective is to configure the internet interface eth0 with a static IP address and also provide other information, like the gateway address.


Before change the configuration the interface must be stopped:

root@server:~# ifdown eth0

Network interface configuration is stored in the /etc/network/interfaces file:

# 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

DNS configuration also needs to be changed. For the moment, the DNS server for our network is the DSL or Cable router/modem, with the IP address of DNS related configuration is stored in the “/etc/resolv.conf” file:

domain localdomain
search localdomain

Now restart the network interface to get the new configuration:

root@server:~# ifup eth0


The ifconfig command allows the user to view information about the configured network interfaces. The eth0 network interface configuration should now have the new parameters:

root@server:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:84:4c:b2
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::a00:27ff:fe84:4cb2/64 Scope:Link
          RX packets:32 errors:0 dropped:0 overruns:0 frame:0
          TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5657 (5.5 KiB)  TX bytes:9091 (8.8 KiB)

lo        Link encap:Local Loopback
          inet addr:  Mask:
          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)

It should also be possible to contact Internet servers:

root@server:~# ping -c3 www.debian.org
PING www.debian.org ( 56(84) bytes of data.
64 bytes from bellini.debian.org ( icmp_seq=1 ttl=43 time=188 ms
64 bytes from bellini.debian.org ( icmp_seq=2 ttl=43 time=190 ms
64 bytes from bellini.debian.org ( icmp_seq=3 ttl=43 time=185 ms

--- www.debian.org ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 185.808/188.217/190.108/1.793 ms


en/wheezy/config/network/static_ip.txt · Esta página foi modificada pela última vez em: 2015-06-29 11:12 (Edição externa)