1. 程式人生 > 其它 >liunx網路管理四(網路管理和配置檔案)

liunx網路管理四(網路管理和配置檔案)

技術標籤:linux

文章目錄

前言

鬧裡有錢,靜處安身。


目標

內化基礎命令

1 網路管理

一  操作網路狀態
  1.1 service network   start|stop|restart  啟動 停止 重啟  網路狀態
  	例項:service network   start  啟動
	例項:service network   stop 停止
	例項:service network   restart 重啟 

二 檢查網路
  1.1 chkconfig --list   network  啟動 停止 重啟  網路狀態
    例項: chkconfig
--list 查詢所有開啟自啟動項,不管是開始還是關閉 1.2 chkconfig <網路服務> off 自啟動項的開啟和關閉 例項:chkconfig saslauthd off 三 systemctl 方式 systemctl list -unit -files NetworkManager.service systemctl start|stop|restart NetworkManger systemctl enable|disable NetworkManger

2 配置檔案

ifcfg-eth0
/etc/hosts

一 修改靜態ip

新增:
       IPADDR=
192.168.88.123 NETMASK=255.255.255.0 GATEWAY=192.168.96.1 修改: 修改前:BOOTTPROTO=DHCP ----dhcp協議 修改後:BOOTPROTO=static ----static協議

3 修改主機名

hostname
• hostnamectl
• hostnamectl set-hostname centos7.test
• 注意修改/etc/hosts⽂件