Setup network on centos 7
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
and replace with
ONBOOT=noBOOTPROTO=dhcp
Now Restart network service by typing below command.
ONBOOT=yessystemctl 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
and replace with
ONBOOT=noBOOTPROTO=static
And add the below lines at the end of the file.
ONBOOT=yesIPADDR=172.27.0.32
File will look like below after changes.
NETMASK=255.255.255.0
GATEWAY=172.27.0.1
DNS1=172.27.0.5TYPE=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 network
Now 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
Have a nice day
Setup network on centos 7的更多相关文章
- Configuring Network in CentOS 6.3 Virtual Box + Screenshots
Configuring Network in CentOS 6.3 Virtual Box + Screenshots Posted: May 23, 2013 in Uncategorized Ta ...
- How to setup multimedia on CentOS 7
You will need to also install the EPEL repository as nux-dextop depends on this for some of its pack ...
- qemu vm setup network(ssh) with buildroot
1, build buildroot with buildroot.config, that is 'make qemu_x86_64_defconfig' + some packages, sshd ...
- CentOS报错:Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock32 error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
今天安装完带图形界面的CentOS 7后,在Terminal中运行yum安装命令时报了以下错误: Could not retrieve mirrorlist http://mirrorlist.cen ...
- Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock32 error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
今天安装完带图形界面的CentOS 7后,在Terminal中运行yum安装命令时报了以下错误: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...
- centos7的网络管理(参考使用)
How to Setup network on centos 7 Posted krizna Centos, Centos 7 After installing Centos 7, You may ...
- procedure of intall and setup centos 6.5
select webserver install option,and select ,uncheck the postgresql option selected some “… platform” ...
- Centos7 编译安装 Nginx Mariadb Asp.net Core2 (实测 笔记 Centos 7.3 + Openssl 1.1.0h + Mariadb 10.3.7 + Nginx 1.14.0 + Asp.net. Core 2 )
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...
- Centos 02 操作系统 & Linux安装
操作系统的概念 操作系统是沟通使用者和硬件之间传递信息的工具或程序,是电子计算机系统负责支撑应用程序运行环境以及用户操作环境的基础系统软件 硬件 ==> 系统核心 ==> 命令解释器she ...
随机推荐
- tomacat启动慢
tomcat目录下有多个工程,tomcat每次启动的时候都会去加载,删除不需要的工程,
- 利用spring、cxf编写并发布webservice
配置文件spring-wsServer.xml <?xml version="1.0" encoding="UTF-8"?> <beans x ...
- MySQL把多个字段合并成一条记录的方法
转:http://www.111cn.net/database/mysql/71591.htm MySQL把多个字段合并成一条记录的方法 在mysql中字段合并可以使用很多函数来实现,如可以利用 GR ...
- 问题Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not found解决方法
问题Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not fo ...
- 如何做一个avalon组件
在avalon1.5中改用更直观的自定义标签来声明组件,废掉ms-widget,引入更强大的生命周期管理,可以让组件任意套嵌. 组件是由JS,HTML,CSS构成 JS 以AMD形式组织,引入HTML ...
- .NET高级工程师面试题之SQL篇
1 题目 这确实是一个真实的面试题,琢磨一下吧!知识不用,就会丢掉,我太依赖各种框架和dll了,已经忘记了最基本的东西.有多久没有写过SQL了,我已经不记得了. 已知表信息如下: Department ...
- 利用js对象的特性,去掉数组中的重复项
- POJ 3352-Road Construction (图论-双边联通分支算法)
题目大意:一个图,要求你加入最少的边,使得最后得到的图为一个边双连通分支.所谓的边双连通分支,即不存在桥的连通分支(题目保证数据中任意两点都联通). 解题思路:先用tarjan算法进行缩点建立DAG图 ...
- javascript 的事件--阻止冒泡
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8&qu ...
- JQuery Checkbox的change事件
JQuery Checkbox的change事件 参考 http://blog.csdn.net/hbhgjiangkun/article/details/8126981 $(functio ...