How to configure static ip address and Host name on CentOS/RHEL 7

In this tutorial i will explain how to configure static ip address  and Hostname  in CentOS/RHEL- 7 .

run ip addr command to show ip status and interface name .
command output:
Note: ens33 is interface is as above marked.

Configure static/manual ip address in centos 7
Edit file /etc/sysconfig/network-scripts/ifcfg-ens33 and set the below parameter .
#vim /etc/sysconfig/network-scripts/ifcfg-ens33
DEVICE=ens33
NAME=ens33
TYPE=Ethernet
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.0.65
NETMASK=255.255.255.0

Now congiure Hostname and gateway ip address, edit file /etc/sysconfig/network and add below paramenter .

#vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=server.example.com
GATEWAY=192.168.0.1

Configure DNS ip address
Edit file /etc/resolv.conf  and add below parameter .
#vim /etc/resolv.conf
nameserver 8.8.8.8

Now start or restart network service

# systemctl start network
or,
# systemctl restart network

check ip/network address

# ip addr
Command output:

Run command to update system hostname
[root@localhost ]# hostname server.example.com
[root@localhost ]# bash

Hostname status
[root@server ~]# hostname
server.example.com

Command to show gateway ip address
#route -n
command output:

Test configured network, by using ping command
You can ping your gateway ip address, if ping  status is ok that means you have configured your network card properly.
#ping 192.168.0.1
command output:

Share on Google Plus

About Penguin Technology

I am a passionate cloud and DevOps professional specializing in Linux and open-source solutions. Through this blog, I share my knowledge and experience with the community, offering tips and insights on cloud technologies and DevOps practices.
    Blogger Comment

1 comments:

  1. I gathered as much knowledge regarding to the Linux, web sever and database server from your site.Keep on updating with more interesting topic.
    Moreover to recover the lost file from Linux Click on:
    android data recovery review
    launch android data recovery
    backup and restore android apps and data
    android backup app data
    recover lost files
    diskdigger pro file recovery


    ReplyDelete