But note that changes made with these commands are not persistent against reboots: sudo ifconfig ethX 192.168.1.100 netmask 255.255.255.0 Static IP setting can be done using ip or ifconfig. Sudo ip link set dev ethX down Setting a static IP To show all ip address related infoprmation is ip/config these commands are used: sudo ifconfig ethX down To show all ip address related infoprmation is ip/config these commands are used: ifconfig
#Centos 7 static ip address configuration install#
The ifconfig command is now depreciated in favour of ip tool however is still part of net-tools package and can be installded with: yum -y install iprouteįor clarity in the steps below both iptool and ifconfig commands are shown: Show Adapters Method 2 – Using ip and ifconfig commands For CentOS 7/8, this can be done using: sudo systemctl stop NetworkManagerĨ) Check the current adapter settings: ip addr show For CentOS 7/8, this can be done using: sudo systemctl stop NetworkManagerĦ) After saving the changes, the shut down the interface and bring it back: sudo ifdown eth0 & sudo ifup ethXħ) Then you can stop NetworkManager service. This is done by adding the line: NM_CONTROLLED=noĥ) Then you can stop NetworkManager service. No – Non-root users are not allowed to control this device.Ĥ) If you have NetworkManager service running, you’ll need to instruct the network service that network manager doesn’t manage this interface (eth0). Yes – Non-root users are allowed to control this device. Yes – Modify /etc/nf if the DNS directive is set. No - This device should not be activated at boot-time. Yes - This device should be activated at boot-time. ONBOOT= –> Where is one of the following: MACADDR= –> Where is the hardware address of the Ethernet device in the form AA:BB:CC:DD:EE:F nano /etc/sysconfig/network-scripts/ifcfg-ethXģ) Configure the variables in the file for your conneciton: DEVICE=eth0Ĥ) The most common configuration parameters with explanations are:ĭEVICE= –> where is the name of the physical device.ĭNS= –> where is a name server address to be placed in /etc/nf Method 1 – Using Network Configuration Fileġ) First determinte the name of your network adapter by running the following: sudo lshw -class network -shortĢ) Using your favourite text editor open the configuration file for your network adapter, replacing X with the name of your network adapter determined in the previous step. There are a number of options/methods available to do this outlined below. Inet 192.168.1.30/24 brd 192.168.1.This guide details howto configure a static IP on CentOS 7 or 8 on an operating system installed without a GUI.
Verify the status of the interface using “if addr” command (the ip address should have disappeared):
Use the ifdown command to stop the interface and eno16777736. The network interface control scripts i.e. Valid_lft forever preferred_lft forever Using network interface control scripts to stop/start a specific network interface If you interface names are somthing like eno16777736, refere this post to change the interface naming to eth0 and eth1. Note that you have 3 Ethernet interfaces (eth0, eth1) and the loopback interface (lo). 1: lo: mtu 65536 qdisc noqueue state UNKNOWN