January 4, 2021
Estimated Post Reading Time ~

Centos Static IP Configuration



Note: Assuming that there are two Nic cards
Step-1: Disable iptables
systemctl stop iptables
systemctl disable iptables

Step-2: Disable the NetworkManager
systemctl stop NetworkManager
systemctl disable NetworkManager

Step-3: Edit the Grub to change NIC card names
nano /etc/default/grub # Append net.ifnames=0 biodevname=0 at the end of GRUB_CMDLINE_LINUX
GRUB_CMDLINE_LINUX="rd.lvm.lv=server/swap crashkernel=auto vconsole.font=latarcyrheb-sun16 rd.lvm.lv=server/root vconsole.keymap=de quiet net.ifnames=0 biodevname=0"
#Compile the grub config
grub2-mkconfig -o /boot/grub2/grub.cfg

Step-4: Restart the system
reboot

Step-5: Edit the NIC cards
cd /etc/sysconfig/network-scripts
# change the name of default NIC card

mv ifcfg-eno16777736 ifcfg-eth0

nano ifcfg-eth1
HWADDR="08:00:27:a9:7a:e1" #get from the VMWare settings
TYPE="ETHERNET"
DEVICE="eth1"
BOOTPROTO="static"
IPADDR="192.168.10.1"
NETMASK="255.255.255.0"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="eth1"
ONBOOT="yes"

# Now edit ifcfg-eth0
nano ifcfg-eth0
HWADDR="08:00:27:r6:7a:ff" # get from the VMWare settings
TYPE="ETHERNET"
DEVICE="eth0"
BOOTPROTO="dhcp"
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="eth0"
ONBOOT="yes"

Step-6: Now bring the eth cards down and back up
ifconfig eth0 down
ifconfig eth1 down
ifconfig eth0 up
ifconfig eth1 up

Step-7: Restart the Network
service network restart


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.