Anda di halaman 1dari 6

Welcome to the Centos 7 Configuration Series.

In this first guideI am going to discuss how


to configure the network adapter.I am going to assume that you have a minimal
installation of Centos 7 already installed. If you require guidance on how to do this please
follow:
https://www.youtube.com/watch?v=_4T42JxWSyA
Ok moving on lets start the configuration process the first thing we need to do is to
configure the network:
Configure DHCP Network Adapter CentOS 7:
Firstly we need to identify our ethernet adapter this can be achieved with the following
command:
nmcli d

Looking at the ouput below we can see highlighted with the red underline that the name of
my ethernet adapter is
enp0s3

Network Manager Making Network Configuration Easy:


Fantastic we now have identified our ethernet adapterthe next stage is to run the Network
Manager configuration tool:
Type the following command:
nmtui

Next select your network adapter

To configure DHCP please select the following options:


IPV4 Configuration <Automatic> / Automatically connect

Now restart the network by issuing the following command:

We have now configured the ethernet adapter to obtain a I.P address via DHCP.

Resolving issues:
Install Network Manager:

Setting a Static I.P


I will now walk you through the process of setting a Static I.P address, I will show you two
methods to get the job done

So lets begin the first method I will call this way the manual approach as we will be
working directly with configuration files.
Method1: Configure a Static I.P without Network Manager

Verify the status of Network Manager:


Run the following command:
systemctl status NetworkManager.service

As you can see from the above example NetworkManager.service is active.


Check Which network card is being manager by Network Manager:
Run the following command:
nmcli dev status

As shown below the device enp0s3 is being managed by Network Manager.

Assign Static I.P Address:


First navigate to the following directory:
cd /etc/sysconfig/network-scripts/

Edit the file ifcfg-enp0s3:


vim ifcfg-enp0s3

If the file does no exist then create it:


touch ifcfg-enp0s3

Next we will add the I.P settings we wish to use:

Example ifcfg-enp0s file:

In the above, "NM_CONTROLLED=no" indicates that this interface will be set up using this
configuration file, instead of being managed by Network Manager service. "ONBOOT=yes"
tells the system to bring up the interface during boot.
Save the file and restart the network:
systemctl restart network.service

Show I.P Address Details:


ip add

Resolving Issues:
If you want to use your own DNS servers:
vim etc/resolv.conf
Add the following ( your DNS Server address):
nameserver 8.8.8.8

Restart the network:


systemctl restart network.service

Method2: Configure a Static I.P with Network Manager


I am now going to show you how to use the nmtui ( Network Manager Text User Interface)
to create a static I.P address for our ethernet adapter.
Install nmtui:
Yum install NetworkManager-tui
Check status and start NetworkManger:
systemctl status NetworkManager

Systemctl start NetworkManager


Enable at boot:

systemctl enable NetworkManager

Edit configuration for network adapter:


nmtui-edit enp0s3

This will launch nmtui and will allow us to edit the same information shown in the
/etc/sysconfig/network-scripts/ifcfg-enp0s3
file

Once you have made the required changes restart the network:
systemctl restart
network.service
Check your new ipdetails:
ip addr show

Anda mungkin juga menyukai