Tuesday, April 28, 2020

How to assign IP address on linux system(Centos, RHEL7)


Today we are going to learn static  & automatic IP assignment. In centos or RHEL7 hostname -I command is used to check ip address of a system. There are 2 different types of IP addresses,  IPV4 & IPV6. Let's learn how to set it on system.
We are considering you have already install virtual box or vmware on your windows operating system. Then, Install linux like centos7 which is freely available on internet.
nmtui command is used to assign ip address in a graphical way. In our practical we are going to learn command line interface to assign ip address.
nmcli connection show - This command shows adapter or network interface. 
You will get interface name by using ip addr command. here, interface name is enpos3

nmcli connection mod "enp0s3" ipv4.method manual ipv4.address 192.168.1.1/24

nmcli stands for network management command line interface, enp0s3 is the name of interface you will get the name of interface by using ifconfig or ip addr command. we want to assign ipv4 version for assigning the IP address so ipv4.method. We are assigning the ip manually that's why manual.Then assign ip address as 192.168.1.1 by following ipv4.address, /24 indicates class c. There are 5 types of IP classes available. Im which only 3 are useful for us.
Then use nmcli con down enp0s3 to down the ethernet interface. Next use nmcli conn up enp0s3 command to open up connection.


Now, check ip address of your system by using ip addr command.


Thanks for reading the above article. If you have any query , Please feel free to contact on email id zurangechaitali13@gmail.com

No comments:

Post a Comment

If you have any doubts. Please let me know.