How to Setup network on centos 7

 

After installing Centos 7, You may not able to connect network in that machine. This will happen because Ethernet interfaces are not enabled by default.This guide will help you to setup network on centos 7 .
This guide contains network configuration steps both in GUI and command mode.

Setup network on centos 7

let’s start, Type “nmcli d” command in your terminal for quick identification of Ethernet cards installed in your machine.

Here we have 2 interfaces named “enp0s17” and “enp0s18” . it might be different in your case ( Eg: em1 or p4p1 ).

GUI Mode

Recommended for beginners
Step 1 » Type this command “nmtui” to open Network manager and press enter after choosing ” Edit a connection” ( Use TAB for choosing options ) .

Step 2 » Now you can see all network interfaces, choose one and click “Edit“.

» DHCP configuration

Step 3 » For DHCP,
1. Choose “Automatic” in IPv4 CONFIGURATION.
2. Choose Automatic Connect check box.
3. Press OK and quit Network manager.

Now Restart network service by typing below command.
systemctl restart network Now your server will get IP Address from DHCP .

» Static configuration

Step 4 » For manual IP address,
1. Choose “Manual” in IPv4 CONFIGURATION.
2. Add IP Address with Subnet , Gateway and DNS server ( Refer below image ).
3. Choose Automatic Connect check box.
4. Press OK and quit Network manager.

Now Restart network service by typing below command.
systemctl restart network That’s it, Interface will have static IP.

Command Mode

Step 1 » Network interface config files are located in /etc/sysconfig/network-scripts/ directory. Open ifcfg-enp0s17 file ( For interface enp0s17 ) and you can see the content like below.
[root@krizna ~]# vi /etc/sysconfig/network-scripts/ifcfg-enp0s17
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s17
UUID=7f1aff2d-b154-4436-9497-e3a4dedddcef
ONBOOT=no
HWADDR=00:0C:29:A1:B5:D6
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

» DHCP configuration

Step 2 » For DHCP
Find the below lines in config File.
BOOTPROTO=none
ONBOOT=no
and replace with
BOOTPROTO=dhcp
ONBOOT=yes
Now Restart network service by typing below command.
systemctl restart network Now your server will get IP Address from DHCP

» Static configuration

Step 3 » For Static IP.
Find the below lines in config File.
BOOTPROTO=none
ONBOOT=no
and replace with
BOOTPROTO=static
ONBOOT=yes
And add the below lines at the end of the file.
IPADDR=172.27.0.32
NETMASK=255.255.255.0
GATEWAY=172.27.0.1
DNS1=172.27.0.5
File will look like below after changes.
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s17
UUID=f0c5b37d-299a-43cb-b74b-618bb252d129
ONBOOT=yes
HWADDR=00:0C:29:A1:B5:CC
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPADDR=192.168.1.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.5

Now Restart network service by typing below command.
systemctl restart networkNow Interface will have static IP.
Additionally you can use /etc/sysconfig/network file for hostname and DNS .
HOSTNAME=server.krizna.com
DNS1=192.168.1.5
DNS2=8.8.8.8
SEARCH=krizna.com

centos7的网络管理(参考使用)的更多相关文章

  1. CENTOS7 使用网络管理器配置静态IP地址

    CENTOS7 的网络配置和CENTOS6有些不同. 如果你想要使用网络管理器来管理该接口,你可以使用nmtui(网络管理器文本用户界面),它提供了在终端环境中配置配置网络管理器的方式. 在使用nmt ...

  2. linux的服务管理(centos6和Centos7)和网络管理(网卡配置),计划服务cron

    服务和网络 管理 init  ifcfg ens33 1.服务: Linux系统中提供的功能,统称为服务,如:at服务.cron服务.web服务.FTP服务.sshd服务等. 服务是由已经在运行的进程 ...

  3. 使用cobbler批量安装操作系统(基于Centos7.x )

    1.1 cobbler简介 Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装.重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等. Cobbler可以使 ...

  4. Django Linux环境下部署CentOS7+Python3+Django+uWSGI+Nginx(含Nginx返回400问题处理、防火墙管理)

    本文将介绍如何在Linux系统上部署Django web项目,本次部署基于下面的架构: CentOS7+ Python3.5 + Django1.11 + uWSGI + Nginx 亲测可行!!按照 ...

  5. vmware centos7 minimal 配置共享文件夹

    使用的是VMware安装CentOS7 minimal版,系统镜像是CentOS-7-x86_64-DVD-1708.iso. 宿主机系统为win10,CentOS7 minimal过程省略,可参考h ...

  6. 嵌入式开发 centos7 交叉编译环境准备

    1. 安装centos7,启动图像化界面. 参考:https://blog.csdn.net/qq_23014435/article/details/74347925 # systemctl get- ...

  7. vmware安装centos7.5、配置网卡、环境配置

    1.vmware安装centos7.5虚拟机    参考连接: https://blog.csdn.net/guo_ridgepole/article/details/78973763 可能遇到的问题 ...

  8. 006-(成功环境记录)基于Centos7系统部署cobbler批量安装系统

    1.1 cobbler简介 Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装.重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等. Cobbler可以使 ...

  9. Rancher安装 - CentOS7(Docker)环境

    Rancher安装 - CentOS7(Docker)环境 对于开发和测试环境,我们建议通过运行单个Docker容器来安装Rancher.在此安装场景中,您将在单个Linux主机上安装Docker,然 ...

随机推荐

  1. CSS学习(1)简介

    什么是 CSS? CSS 指层叠样式表 (Cascading Style Sheets) 样式定义如何显示 HTML 元素 样式通常存储在样式表中 把样式添加到 HTML 4.0 中,是为了解决内容与 ...

  2. pwnable.kr-cmd1-Writeup

    MarkdownPad Document *:first-child { margin-top: 0 !important; } body>*:last-child { margin-botto ...

  3. 神经网络之反向传播算法(BP)公式推导(超详细)

    反向传播算法详细推导 反向传播(英语:Backpropagation,缩写为BP)是"误差反向传播"的简称,是一种与最优化方法(如梯度下降法)结合使用的,用来训练人工神经网络的常见 ...

  4. 源头质量 PageHelper(分页),导出功能

    今天星期五,本来想直接关电脑走人的,但想想自己弄出来的,写写留个记忆吧.两个功能 导出 和 Mybatis的插件 PageHelper 分页 一,导出功能代码实现:这里是需要jar包的啊 <!- ...

  5. 【C语言】赋值运算中的类型转换

    #include<stdio.h> int main() { int a, b; double x = 1.54; char ch; a = x; x = ; b = 'a'; ch = ...

  6. java 如何快速的获取浏览量

    最近公司做了一个类似 于发帖,交友圈一个这样的功能 在如何精确快速的获取用户的浏览量,且及时的更新显示,最初我是这样想,把每条帖子内容浏览量放到reids 里面,但是redis只是用来存零时数据,想想 ...

  7. windows jdk8

    C:\Program Files (x86)\Java\jdk1.8.0_65 //JAVA_HOME .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.j ...

  8. DELPHI开发和使用REDIS

    DELPHI开发和使用REDIS REDIS SERVER是独立的存在,支持WINDOWS,LINUXREDIS PUB/SUB  用于聊天 只是其中的一种用法任何消息或其他类型数据 都可以必须安装 ...

  9. Pychram 运行程序在 run 窗口和 python console 窗口之间切换

    有图有真相 第一步: 第二步:

  10. Vue——前端生成二维码

    与后端生成二维码相比,前端生成二维码更具有灵活性,下面就介绍两种前端生成二维码的方式,两种方式相比之下,vue-qr比qrcode多了一个再中间添加logo的功能. 方式一:qrcode npm np ...