Network Configuration on Linux




  • The key Linux network configuration command is ifconfig, With ifconfig, you can configure IP address, hardware ports, network masks, disable or enable a network interface.
  • Loopback device (lo) Ip helps you to make sure that Linux is properly connected to TCP/IP .
  • Easy way to assign a new IP address to your network card
    • ifconfig eth0
    • ifconfig eth0 netmask
  • Also you can disable or enable a network interface
    • ifconfig eth0 down
    • ifconfig eth0 up
  • Network configuration file
    • Network setting in the /etc/sysconfig directory.
    • /etc/hosts, /etc/resolv.conf, /etc/host.conf also we need look at for network configuration.
      • /etc/hosts: static database of computer names and IP address.
[root@localhost ~]# cat /etc/hosts smtp.ithelpblog.local localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@localhost ~]#
      • /etc/resolv.conf : DNS Server configuration to resolve hostname and IP Address by DNS Server.
[root@localhost ~]# cat /etc/resolv.conf
# Generated by NetworkManager
[root@localhost ~]#
      • /etc/host.conf : we have 2 databases for hostnames and IP address: /etc/hosts and DNS Servers. /etc/hosts will define the order to resolve hostname to IP address.
[root@localhost ~]# cat /etc/host.conf
order hosts,bind
[root@localhost ~]#
    • Basic network settings : /etc/sysconfig/network-scripts/ – configuration files for network interface in/etc/sysconfig/network-scripts/ifcfg-ethx . Example for eth0 , configuration file for eth0 –> /etc/sysconfig/network-scripts/ifcfg-eth0
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
[root@localhost ~]#


1. Configure Linux System to use DHCP Client (receive IP Address from DHCP Server) on CentOS Redhat RHEL Fedora

1a. CentOS 6.4/6.3/5.9 – Redhat RHEL – Fedora 18


2. Configure Linux System to use DHCP Client (receive IP Address from DHCP Server) on Ubuntu Debian

2a. Ubuntu 13.04/12.10/12.04 – Debian


3. Configure Linux System with static IP Address

3a. Centos 6.3 – Redhat RHEL 6.3

3b. Ubuntu 13.04/12.10/12.04


4. Configure DNS Server on Linux System (DNS client)

4a. Centos – Redhat RHEL – Ubuntu


5. Configure static routes on Linux System

5a. Add static route in CentOS – Redhat – Ubuntu – Debian [not permanent]

5b.  Configure permanent static routes on CentOS – Redhat RHEL

5c.  Configure permanent static routes on Ubuntu – Debian


6.  Create sub-interface or Secondary IP Address on ethernet interface

6a. Create sub interface or Secondary IP Address on Redhat – CentOS

6b. Create sub interface or Secondary IP Address  on Ubuntu – Debian


7. Disable IPv6 on Linux box

7a. Disable IPv6 on CentOS 6.4 – Redhat RHEL

7b. Disable IPv6 on CentOS 6.3

7c. Disable IPv6 on Ubuntu 13.04/12.10/12.04/11.10/11.04


8. Change MTU parameter on ethernet interface

Maximum Transmission Unit (MTU), the largest physical packet size (bytes) which network can transmit. We can change that for some reason to increase network performance.

8a. Change MTU interface on CentOS 6.3 – Redhat RHEL – Fedora

8b. Change MTU interface on Ubuntu – Debian


Thanks for using

Leave a Reply

Your email address will not be published. Required fields are marked *

Go to top