Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Networking»Network Configuration in CentOS & Red Hat

    Network Configuration in CentOS & Red Hat

    RahulBy RahulMarch 2, 20132 Mins Read

    Linux provides a number of tools for network configuration. Most important network settings for you Linux machine to access over network are

    • IP configuration
    • Device activation
    • DNS configuration
    • Default gateway

    1. Default Network Configuration Files:

    • Default linux interfaces configuration file exists in /etc/sysconfig/network-scripts/ named ifcfg-ethX ( ‘X’ is replace with number 0,1 or 2 etc ).
    • /etc/sysconfig/network : is global configuration file
       NETWORKING = yes
       HOSTNAME = server1.tecadmin.net
       GATEWAY = 192.168.10.1
      
    • /etc/sysconfig/network-script/ifcfg-ethX : is Ethernet configuration file so assign ip address, netmask on interface.
    • /etc/resolv.conf : DNS servers ip addresses are specified in this file.
    • /etc/hosts : Is used for locally resolve a hostname with ip.

    2. Device Configuration:

    There are two ways to configure network device to get ip address. 1- In dynamic configuration system gets ip address and other network details from dhcp server where in static configuration we set the fixed ip address and network details in interfaces configuration files. Below is the example file of network interfaces.

    Dynamic Configuration:

    DEVICE = ethX
    HWADDR = 00:33:5A:9B:74:99
    BOOTPROTO = dhcp
    ONBOOT = yes
    TYPE = Ethernet
    

    Static Configuration:

    DEVICE = ethX
    HWADDR = 00:33:5A:9B:74:99
    BOOTPROTO = static
    IPADDR = 192.168.10.100
    NETMASK = 255.255.255.0
    GATEWAY = 192.168.10.1
    ONBOOT = yes
    TYPE = Ethernet
    USRCTL = no
    

    Details of configuration parameters:

    • DEVICE: Ethernet device name
    • HWADDR: Hardware address or MAC address
    • BOOTPROTO: dhcp or static
    • ONBOOT: yes/no , it tells that interface will automatically up or not on boot.
    • Type: Type of interface.
    • USRCTL: yes/no , it tells that a non root user can bring this device up or down.

    If you do not want to edit files directly, you can use `setup` command to configure network interfaces

    eth eth0 ethernet network interface
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Create RPM for Your Own Script in CentOS/RedHat
    Next Article How to Shrink SQL Server Transaction Log Files using DBCC SHRINKFILE

    Related Posts

    How to Setup Network Interface on Ubuntu, Debian & LinuxMint

    Updated:July 3, 20183 Mins Read

    IP FailOver Setup Using KeepAlived on CentOS & Red Hat

    Updated:November 7, 20174 Mins Read

    1 Comment

    1. umer on October 28, 2017 4:58 am

      i use these settings to set static ip but it change to that ip when i turn on my VM. my network on bridge adopter . my network is 196.156.22.1 and ip i get when machine is boot is 196.156.22.29 and i set my ip to 196.156.22.50 but when i restart my network the ip is change into again 196.156.22.29. and also BOOTPROTO is turn into static to none.
      I have already disable the DHCP of virtualbox.
      please help ASAP.

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install Sublime Text 4 on Ubuntu 22.04
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.