Linux network configuration files

  • On Ubuntu/debian we have the network configuration in /etc/netowrk/interfaces
    Example of file content:

    
    bob@vmUbuntu:~$ cat /etc/network/interfaces
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    auto enp0s3
    iface enp0s3 inet dhcp
    
    
  • /etc/hostname on debian/ubuntu it contain the host name.
  • /etc/resolv.conf contain list of the dns servers we are using.
  • /etc/hosts contain list of domain names and their resolve ip, usually the OS first check in this file, and if not find only then check in the dns server.
  • /etc/nsswitch.conf this file define the order the name resolution, if it OS first check in the dns server first or in the host file first.
    For example:

    
    bob@vmUbuntu:~$ cat /etc/nsswitch.conf 
    # /etc/nsswitch.conf
    #
    # Example configuration of GNU Name Service Switch functionality.
    # If you have the `glibc-doc-reference' and `info' packages installed, try:
    # `info libc "Name Service Switch"' for information about this file.
    
    passwd:         compat
    group:          compat
    shadow:         compat
    gshadow:        files
    
    hosts:          files dns
    networks:       files
    
    protocols:      db files
    services:       db files
    ethers:         db files
    rpc:            db files
    
    netgroup:       nis
    
    

    In this case we see in the line of the hosts “hosts: files dns” and that we it will first check in the host file and only then in the dns.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s