• 重新点亮linux 命令树————网络管理和网络配置文件[十一六]


    前言

    简单整理一下网络管理和网络配置文件。

    正文

    网络服务程序分为两种:分别是SysV和systemd

    1. service network start|stop|restart

    2. chkconfig --list network

    chkconfig --level 2345 network off 关闭network 2345的功能

    systemctl disable NetworkManager 禁用NetworkManager

    1. systemctl list-unit-files NetworkManager.service 查看NetworkManager服务

    2. systemctl start|stop|restart networkManager 停止和使用networkManager 服务

    3. systemctl enable|disable networkManager 是否禁用networkManager服务

    网络配置文件是:

    1. ifcfg-eth0

    2. /etc/hosts

    查看一下网络状态:service network status

    chkconfig --list network

    systemctl list-unit-files NetworkManager.service

    一般来说network和NetworkManager 是配置冲突的,那么一般不用NetworkManager,因为里面水深。

    后面几个命令可以自己试一下。

    那么就来看下配置文件吧。

    这里ifcfg-eth0 在centos 是在/etc/sysconfig/network-scripts/下。

    而在ubuntu系列是在/etc/systemd/resolved.conf

    那么现在就来看一下吧。

    BOOTPROTO=dhcp 表示dhcp 分配方式。

    ONBOOT=yes 开机网卡是否被使用

    下面介绍一下静态配置:

    然后怎么让其马上生效呢?service network restart.或者systemctl restart NetworkManager.service

    那么如何修改hostname呢?

    这样是查看。

    如果是临时生效,可以使用hostname c7.testxxx这样就是临时生效。

    永久生效可以使用 hostnamectl sethostname c7.testxxx.

    也需要在/etc/hosts添加:

    127.0.0.1 c7.testxxx 
    

    因为很多服务依赖主机名,如果主机名修改可能会导致一些服务不可用。

    linux 命令树

    下一节 软件管理包。

  • 相关阅读:
    常见时间复杂度及对应关系
    【转载】Locust实现集合点
    curl 查看接口的网络分段响应时间
    python-字符串操作分类小结
    Jquery--1--选择器分类
    【转】linux shell编程实例总结
    随笔分类整理
    linux备忘录-日志档案
    linux备忘录-系统服务daemon
    linux备忘录-程序管理与SELinux
  • 原文地址:https://www.cnblogs.com/aoximin/p/15025897.html
Copyright © 2020-2023  润新知