Ifconfig is not included in the minimal install of the CentOS7, and needs to be installed manually. We need to add an IP address to our system via “ip” command, before we can install the net-tools or anything else from repos.
Find network cards attached and their associated names:
"ip addr show" -shows NIC card status and names. Here I found our NIC name as eno16777728
"nmcli dev status" - shows device, type, state, connection. Confirmed the NIC name, and that its not connected.
Lets add an IP address, network, and name servers:
"ip addr add 192.168.1.150/24 via eno16777728" -- add IP, /24 shows network mask we belong to
"ip route add default via 192.168.1.1" -- tell the system default gateway to use
Now lets add DNS name servers:
edit /etc/resolve.conf and add the DNS servers in the following format
Time to test if IP networking works or not. Lets go with Networking 101:
Lets test the name resolution:
Lets install the ifconfig tool using command “yum install net-tools” it will install couple of packages, and ifconfig works like a charm.
Change the following entry ONBOOT=no to ONBOOT=yes so your networking comes up after each server reboot under /etc/sysconfig/network-scripts/ifcfg-NICName in my case that is /etc/sysconfig/network-scripts/ifcfg-eno16777728
The file should look similar to the following:
Now that is up and running we can ssh into it, and make our life a bit easier with managing it remotely.
Great collection of Tips and Tricks for admins on CentoOS’s official website. http://wiki.centos.org/TipsAndTricks