Linux Administrator can directly static IP set via command line. majorly Linux system OS boot time by default dynamic address set.
Today, we have configured static IP in Ubuntu and Cent OS systems.
This tutorial in our static IP below shows some examples.
IP address: 192.168.1.100
Netmask: 255.255.255.0
Hostname: networkinglearning.com
Domain name: networkinglearning.com
Gateway: 192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
How to Configure Static IP Address in CentOS/RHEL/Fedora:
In command line we have changed this two directory path :
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
Firstly edit this
nano /etc/sysconfig/network
Add this line and set
NETWORKING=yes
HOSTNAME=networkinglearning.com
GATEWAY=192.168.1.1
NETWORKING_IPV6=no
IPV6INIT=no
Secondly, edit this
nano /etc/sysconfig/network-scripts/ifcfg-eth0
Add and replace other lines
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
IP address: 192.168.1.100
Netmask: 255.255.255.0
Hostname: networkinglearning.com
Domain name: networkinglearning.com
Gateway: 192.168.1.1
DNS1=8.8.8.8
DNS2=8.8.4.4
MTU=1360
Next edit in resolve.conf
nano resolve.conf
Edit and set these lines
nameserver 8.8.8.8
nameserver 8.8.4.4
After the command line restarts the network
systemctl restart network
How to Configure Static IP Address in Ubuntu/Debian :
To setup static IP address in Ubuntu/Debian, open the following file:
nano /etc/network/interfaces
You may see a lool like this lines
auto eth0
iface eth0 inet dhcp
Change like this
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.4.4
dns-nameservers 8.8.8.8
Next edit in resolve.conf
nano resolve.conf
Edit and set these lines
nameserver 8.8.8.8
nameserver 8.8.4.4
After the command line restarts the network
systemctl restart network
Also, Ubuntu GUI base in directly set Static IP via network settings :
Your Static IP has been configured.
Conclusion:
We have configured static IP in all Linux-supported OS. If you have any questions? submit them in the comment section below.
0 Comments