To Know about network interface installed in your computer with command
ip a or # nmcli –p dev
Step 1: Create/edit the file
Create or edit this file /etc/sysconfig/network-scripts/ifcfg-eth0.
Check if the file exist to edit or create a file in the path with file name “ifcfg-eth0” or as per network interface.
DEVICE="eth0"
ONBOOT=yes
NETBOOT=yes
UUID="45682a6f-brt1-43te-8v7e-cf4t692f8bd6"
IPV6INIT=yes
BOOTPROTO=dhcp
HWADDR="10:02:c2:0n:qw:y8"
TYPE=Ethernet
NAME="eth0"
Step 2: Configuring an eth0 interface
There are 2 ways to configure static IP
First method:
Edit or create a new file by the name of ifcfg-eth0 in /etc/sysconfig/network-scripts/ directory with command
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Update IPADDR with preferred IP address.
Save and close file.
Restart the network service using command
# systemctl network restart
Check and verify the whether the IP has been assigned to the network interface using command
# ip a or # ip a s eth0
Check the internet connectivity using ping command
# ping –c 3 google.com
Second Method:
Using network manager interface command
# nmtui edit eth0.
Manually input the IP in the eth0 interface save and restart.