Loading...
Basic Linux

Assinging IP Address

To Assinging IP Address In CentOS

Open below config file and make changes as needed

vi /etc/sysconfig//network-scripts/ifcfg-eno16780032
TYPE=Ethernet
DEVICE=enoxxxx
ONBOOT=yes
BOOTPROTO=static/dhcp/none 
IPADDR=10.10.10.189
DNS1=8.8.8.8
GATEWAY=10.10.10.1
PREFIX=24
NAME=eno1xxxx
UUID=xxxxxxxxxxxxxxxxxxxxxx
DEFROUTE=yes

Restart the network

service network restart

Configure the dns resolution as below

vi /etc/resolv.conf 

configures the nameserver credentials

nameserver 10.10.10.1
nameserver 8.8.8.8

Check with command ip addr or ip r

In ubuntu To Assing IP Address make changes as below
sudo vi /etc/network/interfaces

while opening a file these below lines will there

# The loopback network interface
auto lo
iface lo inet loopback

After above lines add below code in the file

The primary network interface auto eth0
#DHCP not needed
# iface eth0 inet dhcp

iface eth0 inet static
address 10.10.10.45
netmask 255.255.255.0
network 10.10.10.0
broadcast 10.10.10.255
gateway 10.10.10.1
dns-nameservers 8.8.8.8

Save and exit.

sudo vi /etc/resolv.conf
Add below code:
nameserver 10.10.10.1
nameserver 8.8.8.8
search mynetwork.local

Save and exit. Edit

sudo ifdown eth0 && sudo ifup eth0

sudo service networking restart

ifconfig -a

Leave a Reply

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