CentOS 7: 配置Network
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
最新文章
- 每天一个 Linux 命令(22):find 命令的参数详解
- 网络存储技术(3) based on zt
- IIS------Http错误:50019,由于权限不足无法读取配置文件
- IP地址子网掩码、主机数、子网掩码及主机段的算法
- linux定时运行命令脚本——crontab
- Java基础知识强化51:经典排序之桶排序(BucketSort)
- haproxy 超时机制
- flask蓝图的使用
- SublimeTest3设置【中文乱码】
- HCTF
- Yii的URL助手
- Linux 用户及权限详解
- C#开发——网站应用微信登录开发
- django xadmin 1不在可用的选项中
- 理解DP(持续更新)
- 2018.4.23 pip使用
- 用STL对一组数组进行排序和去重
- Python 数据类型:字典
- java二叉搜索树原理与实现
- BZOJ 1566 管道取珠(DP)
热门文章
- C. Coin Troubles 有依赖的背包 + 完全背包变形
- dubbo之服务容器
- HDU_1176_免费馅饼_16.4.23再做
- CAD设置背景图片
- oracle数据库子查询的结果需要使用多次解决办法
- libevent reference Mannual IV --Helper functions and types
- Luogu P1991 无线通讯网
- UVA - 1374 Power Calculus (dfs迭代加深搜索)
- MySQL5
- 访问请求参数request.getParameter()