IP addresses are the core mechanism of the Computer networks. The IP address is used to specify the host to communicate and transmit data. There is two type of IP address configuration mechanism. Dynamic and Static. In this tutorial, we will examine the static IP address configuration.
Static IP Address
Static means stable or not changeable, fixed etc. Static IP addresses set to the host or interface and do not change during time. An IP address generally set manually. Every IP address can be used as static or dynamic there is no restriction. The setting or configuration type makes it static or dynamic.
Dynamic IP Address
The dynamic IP address is set with the DHCP protocol. DHCP means Dynamic Host Control Protocol and as its name suggest it is used to set network related configuration dynamically.
Static IP Address Use Cases
We can use static IP addresses for different cases.
- Web Server’s must use static IP address because
- Mail Server
- Web Services
- Network Devices
- Security Devices
Private Static IP Address (Home or Intranet)
As IP addresses categorized as Private IP Address or Public IP Address. Private IP addresses only used in internal networks like intranet, home network, ISP network etc. Private IP addresses can not be used on the internet. We can use all private IP addressed as static. Home routers generally use
192.168.1.1 as the static IP address for the home network. Example Private Static IP Addresses:
Public Static IP Address (Internet)
Public IP addresses can be used as static too. As stated previously these IP addresses can be routed over the internet. We can setPublic IP Addresses as static like Private IP addresses. Especially web servers, DNS servers, applications servers will have the static IP address. Here are some of the well know Public Static IP Addresses:
Set Static IP Address For Linux
We can set a static IP address for Linux in different ways. In this part, we will set a static IP address for Linux from the command line.
Ubuntu, Debian, Mint, Kali
First, we will open the
interfaces configuration file which holds the network interface configuration.
$ sudo nano /etc/network/interfaces
Then we will set
iface ens33 as static and provide information likemIP address, netmask, network, gateway etc.
auto ens33 iface ens33 inet static address 192.168.1.10 netmask 255.255.255.0 network 192.168.1.0 broadcst 192.168.0.255 gateway 192.168.1.1 dns-nameservers 220.127.116.11
Fedora, CentOS, RedHat
rpm based distributions like Fedora, CentOS, RedHat network configuration is stored in
network-scripts directory with the name of the network interface. In this example, we will set a static IP address for
$ nano /etc/sysconfig/network-scripts/ifcfg-em1
We will set information like IPADDR, NETMASK, BROADCAST, GATEWAY etc.
UUID="e88f1292-1f87-4576-97aa-bb8b2be34bd3" NM_CONTROLLED="yes" HWADDR="D8:D3:85:AE:DD:4C" BOOTPROTO="static" DEVICE="em1" ONBOOT="yes" IPADDR=192.168.1.2 NETMASK=255.255.255.0 BROADCAST=192.168.1.255 NETWORK=192.168.1.0 GATEWAY=192.168.1.1
Set Static IP Address For Windows
In Windows operating systems we will use standard network configuration to set the static IP address. Open following screens.
Network Connections -> Double click
LAN or Internet Connection-> Click
Use the following IP address