Thursday, November 25, 2010

How to setup static IP address on Debian

Let check few pre-requirements we need to obtain from the network admin:
  1. Host name: deby01.dev.local
  2. Ip address: 192.168.10.21
  3. Network: 192.168.10/24
  4. Gateway: 192.168.10.1
  5. DNS Servers: 192.168.10.2 and 192.168.10.3
  6. Local Domains: dev.local, corp.local
Here are few simple steps to give your Debian box static IP address:
  1. Configure hostname:
    echo "deby01" > /etc/hostname
    
  2. Ensure /etc/hosts file properly resolves localhost:
    127.0.0.1       localhost
    # In some circumstance it is not recommended to
    # resolve machine name to local ip address
    #127.0.1.1      deby01.dev.local  deby01
    
  3. Here is content of /etc/network/interfaces
    # The primary network interface
    auto eth0
    iface eth0 inet static
         address 192.168.10.21
         netmask 255.255.255.0
         network 192.168.10.0
         broadcast 192.168.10.255
         gateway 192.168.10.1
    
  4. Resolver configuration file /etc/resolv.conf:
    domain dev.local
    search dev.local dev.local. corp.local.
    nameserver 192.168.10.2
    nameserver 192.168.10.3
    
If you need setup a dynamic ip address with DHCP, take a look here.

No comments :

Post a Comment