美文网首页
Centos7固定IP

Centos7固定IP

作者: liurongming | 来源:发表于2017-04-04 10:14 被阅读0次

查看当前网络

# 查看网络状态
# service network status
# 查看用法
# service network 
用法:/etc/init.d/network {start|stop|status|restart|reload|force-reload}

或者使用`systemctl`
# 查看网络状态
# systemctl status network.service
# 重启网卡
# systemctl restart network.service
# 刷新网络配置
# systemctl reload  network.service
# 启动网卡
# systemctl start  network.service

选择网卡

# cd /etc/sysconfig/network-scripts/
[root@centos7 network-scripts]# ls
ifcfg-eth0  ifdown-bnep  ifdown-ipv6  ifdown-ppp     ifdown-tunnel  ifup-bnep  ifup-ipv6  ifup-plusb  ifup-routes  ifup-wireless     network-functions
ifcfg-lo    ifdown-eth   ifdown-isdn  ifdown-routes  ifup           ifup-eth   ifup-isdn  ifup-post   ifup-sit     init.ipv6-global  network-functions-ipv6
ifdown      ifdown-ippp  ifdown-post  ifdown-sit     ifup-aliases   ifup-ippp  ifup-plip  ifup-ppp    ifup-tunnel  net.hotplug

打开网卡

# vim ifcfg-eth0 
DEVICE=eth0
TYPE=Ethernet
UUID=43526aeb-1c5e-4bfc-8382-3ac1313db9c4
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.0.18
PREFIX=24
GATEWAY=192.168.0.1
DNS1=8.8.8.8
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=00:E0:4C:05:98:91
LAST_CONNECT=1488087337

相关文章

网友评论

      本文标题:Centos7固定IP

      本文链接:https://www.haomeiwen.com/subject/lkyaottx.html