IPv6 addresses : this section might not appear in your network adapter configuration as not all interfaces are running IPv6 addresses.Layer 3 information : what you are probably interested in which is your IPv4 address in CIDR notation, the subnet broadcast address as well as the address lifetime (valid_lft and preferred_lft).Layer 2 information : in this case, you are running on the Ethernet protocol with a given MAC address and a broadcast address.Network adapter general information : its state (up or down), its MTU as well as the qlen for the Etherner buffer queue.In this case, the server has two network interfaces : the loopback address (or localhost) and the “enp0s3” interface.įor this network interface, you are presented with multiple information : When running the “ip” command, you will be presented with all the network interfaces available on your host. If you have any questions or comments, please do not hesitate to submit them in the comment section below.The easiest way to get your private IP address on Linux is to use the “ip” command with the “a” option for “address”.
You now know how to configure a static IP address on a Linux distro. Your static IP address has been configured. Restart the networking on your system with: # /etc/init.d/network restart Save the file and then edit /etc/nf like this: # nano /etc/nf You may see a line looking like this: auto eth0Ĭhange it so it looks like this: auto eth0 To setup static IP address in Debian/ Ubuntu, open the following file: # nano /etc/network/interfaces Once you have made your changes restart the networking with: # /etc/init.d/network restart Nameserver 4.4.4.4 # Replace with your nameserver ip Nameserver 8.8.8.8 # Replace with your nameserver ip Next edit nf file by opening it with a text editor such as nano or vi: # vi /etc/nf Other settings should have already been predefined. You will only need to edit the settings for: In that file make the following changes: DEVICE="eth0" You can find your network interface name with ifconfig -a command. Note: Make sure to open the file corresponding to your network interface. Next open: # vi /etc/sysconfig/network-scripts/ifcfg-eth0 Let’s start with the first file: # vi /etc/sysconfig/network
If your interface is named “ eth1" then the file that you will need to edit is "ifcfg-eth1". Where in the above "ifcfg-eth0" answers to your network interface eth0. etc/sysconfig/network-scripts/ifcfg-eth0 To configure static IP address in RHEL / CentOS / Fedora, you will need to edit: /etc/sysconfig/network This article is meant to show you how to configure static IP address on most frequently used Linux distributions.įor the purpose of this tutorial, we will use the following Internet Protocol version 4 (IPv4) details: IP address: 192.168.0.100Ĭonfigure Static IP Address in RHEL/CentOS/Fedora: Read Also: How to Set or Change System Hostname in Linux