Configure network in CentOS 6
After the installation of the CentOS 6 settings Internet connection is established automatically, so you can immediately go to work in the browser or downloading the packages from the”Terminal”. However, sometimes it appears before the user task is to change the values of the current connection, create a new or switch to another existing network. In this case, you will need to manually set the appropriate parameters in one of the available methods. Just about them and will be discussed further.
Configured network in CentOS 6
All network parameters, like most of the other settings stored in specific configuration files and are read by the standard services and applications. Just from the content of such files and depends on the work Internet connection. To adjust the necessary values in two different methods — by using additional utilities or independent of content changes in the configuration documents. Below we analyze in detail these two methods and you will only choose the best.
Quick network connection
Before the full analysis methods I would like to mention built-in the ability to quickly connect to a network using the standard utilities ifconfig. This option is useful for those users who want to specify the IP address and subnet mask. All actions are performed literally in a few steps:





Of course, this option allows just a couple of minutes to establish a new connection, but it is not always possible for such settings to satisfy the needs of users, therefore we suggest to familiarize with the two methods.
Method 1: NetworkManager TUI
Application TUI NetworkManager has the likeness of the graphical interface implemented via the”Terminal”. This tool allows you to quickly manage existing networks and create new ones. However, to start this utility must be installed in the system, and then you can proceed to edit the settings.











The method is more suitable for novice users who have not experienced job in the configuration files. But it has its drawbacks, such as limited functionality. No tool will give a complete list of settings that you can change in the config.
Method 2: Edit the configuration file
All the configuration files on operating systems based on Linux kernel are modified using various text editors. Such decisions a lot, so normally the user will choose the best variant itself. However, the choice of software to open config is not as important as the process of settings.





Now let’s deal with the present parameters and consider two types of configuration — static connection and receive dynamic settings using DHCP. In the file for the first type of centres should have the following values:
DEVICE=eth0 #the interface Number assigned by the system
HWADDR=08:00:27:6c:e1:fc #the MAC address of the network device. Does not change unnecessarily
TYPE=Ethernet #connection Type
UUID=e2f7b74a-ec49-4672-81cf-ff9c30d8ebdd #connection ID
ONBOOT=yes #Automatically start the network after loading the operating system
NM_CONTROLLED=no #Enable or disable control NetworkManager
BOOTPROTO=none #do Not use DHCP
IPADDR=111.111.111.111 #IP address
NETMASK=255.255.255.255 #subnet Mask
GATEWAY=192.168.1.1 #Gateway
DNS1=192.168.1.1 #DNS server
IPV6INIT=no #Disable IPv6
USERCTL=no #prevent the user without privileges to manage network interface
Describe each line we put behind the sign #to the config file means a comment. So you can feel free to copy this material, by changing the desired values and review of the description strings, in the future, not to forget, responsible for each. This content is a standard static connection, and as the dynamic through DHCP, the view is slightly different:
DEVICE=eth0 #the interface Number assigned by the system
HWADDR=08:00:27:6c:e1:fc #MAC-address
TYPE=Ethernet #interface Type
UUID=e2f7b74a-ec49-4672-81cf-ff9c30d8ebdd #ID interface
ONBOOT=yes #Enable the interface at boot
NM_CONTROLLED=no #whether the interface is Controlled by NetworkManager daemon
BOOTPROTO=dhcp #Use DHCP
IPV6INIT=no #Disable IPv6
USERCTL=no #Ban users to control the interface
As you can see, in the second case, the IP address and subnet mask are obtained automatically, since it involves technology DHCP, the main thing to specify in a configuration file so that all actions were performed successfully. After all the changes in the document don’t forget to save and restart the service network, so all the updates went into effect.
The Firewall in CentOS
Another important component of any network connection is the firewall it is the firewall. Thanks to him, there is a filtration of the traffic and ensures security of data transmission. The effect of this firewall depend on the established rules, which are activated by default or configured by each user individually. By default, CentOS Firewall involved is a standard tool for managing the firewall, with a detailed setup guide which you can read in our other article on the following link.
Read more: the Firewall in CentOS
Sometimes, users prefer another tool, iptables. In fact, this utility is almost analogous to the Daemon, but with some peculiarities. Therefore, the user has to choose which solution for management of firewall to choose. We recommend you to explore the theme of editing iptables, and then choose the tool that is most appropriate.
Read more: setting up iptables in CentOS
Now you are familiar with all phases of network settings in CentOS 6. It remains only to choose one of the two methods, and follow the instructions. It should be noted that the edit of the configuration file should always be done very carefully to prevent mistakes when typing the parameters and values. Even one mistake can lead to refusal of the Internet.