Becoming a Pro: Linux Software Installation Guide Part 000000004 – Configuring Network and Hostname on CentOS

Becoming a Pro: Linux Software Installation Guide Part 000000004 - Configuring Network and Hostname on CentOS

Introduction

CentOS (Community Enterprise Operating System) is one of the Linux distributions, which is free, open-source, and redistributable open-source operating system [1].

The CentOS Linux distribution is a stable, predictable, manageable, and reproducible platform, derived from Red Hat Enterprise Linux (RHEL) and compiled from source code released under the open-source (mostly GPL open-source license) [2].

1. Configuring the Network

vi /etc/sysconfig/network-scripts/ifcfg-ens33

Add the following content

BOOTPROTO="static"
ONBOOT="yes"
IPADDR=192.168.168.114
GATEWAY=192.168.168.2
NETMASK=255.255.255.0
DNS1=223.5.5.5

Configuration Explanation

BOOTPROTO: Static IP, needs to correspond with the gateway

ONBOOT: Effective at boot

IPADDR: IP address

GATEWAY: Gateway address

NETMASK: Subnet mask

DNS1: DNS configuration, used for domain name resolution

2. Configuring the Hostname

vi /etc/hostname

The content is as follows (you can name it as you like)

mini114

3. Configuring Domain Name Resolution

vi /etc/hosts

Add the following content

192.168.168.114 www.hello.com

Then accessing the domain www.hello.com will request 192.168.168.114

Feel free to add anything else you think of later

Leave a Comment