0% found this document useful (0 votes)
38 views

How To Configure Static Ip Address On Centos 7: 9 Radenko Bogdanovic

This document provides instructions for configuring a static IP address on CentOS 7. It describes editing the /etc/sysconfig/network-scripts/ifcfg-enp0s3 file to set the IP address, restarting the network, and checking the IP configuration. Key steps include setting the IP address, gateway, and DNS servers to configure the network interface and enable static IP addressing on CentOS 7.

Uploaded by

diegoes
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

How To Configure Static Ip Address On Centos 7: 9 Radenko Bogdanovic

This document provides instructions for configuring a static IP address on CentOS 7. It describes editing the /etc/sysconfig/network-scripts/ifcfg-enp0s3 file to set the IP address, restarting the network, and checking the IP configuration. Key steps include setting the IP address, gateway, and DNS servers to configure the network interface and enable static IP addressing on CentOS 7.

Uploaded by

diegoes
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Centos

How to configure static ip


address on CentOS 7
Radenko Bogdanovic 9

In this small tutorial i will explain how to configure static ip address on


CentOS 7 minimal.
First, need to edit the set up for the ethernet. Let’s start with editing
“/etc/sysconfig/network-scripts/ifcfg-enp0s3″ file:

vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

HWADDR=08:00:27:6C:FF:91
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPADDR=192.168.0.88
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s3
UUID=ea68db6e-461e-427d-b9a8-bfcf6e1a4fc6
ONBOOT=yes

Save and exit.

Now, configure default getaway:

vi /etc/sysconfig/network
And add following line:

NETWORKING=yes
HOSTNAME=centos7
GATEWAY=10.1.1.253

Configure DNS Server

vi /etc/resolv.conf

add following line:

nameserver 8.8.8.8
nameserver 8.8.4.4

Now restart your network or rebooting system

/etc/init.d/network restart

Check your network:

ip addr

1: lo: mtu 65536 qdisc noqueue state UNKNOWN


link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:6c:ff:91 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.88/24 brd 192.168.0.255 scope global enp0s3
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe6c:ff91/64 scope link
valid_lft forever preferred_lft forever
That is all.

9 Comments
Saji
27/01/2016 at 18:52

I think you did not mention the subnet mask in the ifcfg file.

Reply

Ali
07/05/2016 at 22:57

Yes, where can I configure the netmask?

Reply

Bilcic
22/12/2016 at 09:16

PREFIX=24

Reply

Steve
06/04/2017 at 03:38

Thank you so much! I was going through so many articles on how to do


this and your did the trick. Excellent!!

Reply
Z. Rather
19/07/2017 at 14:51

Hi,
I have set the network configuration , All correct , But when i run ifconfig
-a i get wrong Gateway IP address. How can i fix or where can i chagne or
correct these settings. From the interface and /etc/sysconfig/network-
scripts/ifcfg-em1 all seesm to br correctly set.

Reply

Rasho
19/07/2017 at 22:34

Try this
$ nmtui edit your_interface

Reply

Z. Rather
20/07/2017 at 08:16

Thanks nmtui helped me to change the hostname, But i still face issue
with Default Gateway. i cannot ping to ouside network.

Reply

yoyo
07/10/2017 at 23:46

yes great job !! now tell me how to revert it.

Reply
Fahad
14/05/2018 at 14:11

facing issues though followed the step accordingly,


unable to ping my gateway even.
does the order of the sequence is to be followed strictly as mentioned ??

Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

You might also like