Posted On April 1, 2019

Linux: How to set a static IP address

kimconnect 0 comments
blog.KimConnect.com >> Linux >> Linux: How to set a static IP address
Set Static IP Address
—-
vim /etc/sysconfig/networking/profiles/default/ifcfg-eth0
vim /etc/sysconfig/network-scripts/ifcfg-eth0
—-
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0C:29:d7:5b:d3
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
NETMASK=255.255.255.0
IPADDR=192.168.1.150
GATEWAY=192.168.1.1
 
Change Nameserver (DNS)
—-
vim /etc/resolv.conf
—-
The file format should be like this:
    search your-dns-search-path
    nameserver dns1-ip-address
    nameserver dns2-ip-address
    nameserver dns3-ip-address
 
Sample:
 
# Generated by NetworkManager
nameserver 127.0.0.53
10.10.10.100
8.8.8.8
1.1.1.1

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Linux: Create a Shell Script to Watch Services

# create a script to watch services (notice the regex escape for special chars) sudo…

How to Upgrade Linux Mint from 20.03 to 21 via Command Line

Step 1: sudo apt updatesudo apt install mintupgrade Step 2: sudo mintupgrade Troubleshooting: Error message:…

Linux: How to Change IP Address of CentOS 8 Machine

# Check the network interface config files ls /etc/sysconfig/network-scripts [cuilo@web02 ~]$ ls /etc/sysconfig/network-scripts ifcfg-ens192 #…