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 networkNow 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

Have a nice day

最新文章

  1. 每天一个 Linux 命令(22):find 命令的参数详解
  2. 网络存储技术(3) based on zt
  3. IIS------Http错误:50019,由于权限不足无法读取配置文件
  4. IP地址子网掩码、主机数、子网掩码及主机段的算法
  5. linux定时运行命令脚本——crontab
  6. Java基础知识强化51:经典排序之桶排序(BucketSort)
  7. haproxy 超时机制
  8. flask蓝图的使用
  9. SublimeTest3设置【中文乱码】
  10. HCTF
  11. Yii的URL助手
  12. Linux 用户及权限详解
  13. C#开发——网站应用微信登录开发
  14. django xadmin 1不在可用的选项中
  15. 理解DP(持续更新)
  16. 2018.4.23 pip使用
  17. 用STL对一组数组进行排序和去重
  18. Python 数据类型:字典
  19. java二叉搜索树原理与实现
  20. BZOJ 1566 管道取珠(DP)

热门文章

  1. C. Coin Troubles 有依赖的背包 + 完全背包变形
  2. dubbo之服务容器
  3. HDU_1176_免费馅饼_16.4.23再做
  4. CAD设置背景图片
  5. oracle数据库子查询的结果需要使用多次解决办法
  6. libevent reference Mannual IV --Helper functions and types
  7. Luogu P1991 无线通讯网
  8. UVA - 1374 Power Calculus (dfs迭代加深搜索)
  9. MySQL5
  10. 访问请求参数request.getParameter()