Jul 08

How to Configure Network Settings in CentOS 7

1 – FIND YOUR NETWORK ADAPTER

Once logged in, you’ll want to enable and configure your network adapter.  First, you’ll need to get the name of your network adapter(s) by running the following command:

Below you’ll see my results of running this command.  My results show I have an Ethernet adaptor called ens160 and it’s currently disabled.  Please take note of the name of your network adapter, which may be different.

"nmcli d" Results

2 – CONFIGURE NETWORK ADAPTOR

Once you have the name of your network adapter, you’ll want to enable it and configure it.  We will configure it using the vi text editor.  If you’re not familiar with vi, take a look at:

vi cheat sheet

Use the following command to use vi to configure your network settings.  Note: replace ens160 with the name of your network adapter you noted above)

The content will look something like this:

To Configure a DHCP IP

Modify the following lines:

To Configure a Static IP

Modify the following line:

Add the following lines and replace them with the static IP settings you need.  Note: DOMAIN is the default DNS Search domain and it’s optional to add that line.

3 – CONFIGURE HOST NAME (Optional)

Optionally, you can use vi to configure the host name and default search domain by running:

Modify the following line:

4 – RESTART NETWORK SERVICE

To apply your new network settings run the following command to restart the network service

 

Jan 01

GenerateIPv4Addresses.vbs