网络管理

    xiaoxiao2021-03-30  29

    1.ip基础知识    现在电脑一般使用ipv4地址,它由32位二进制数组成,但显示给人们看到的一般是转化后的10进制数    例如:172.25.0.10/255.255.255.0    *172.25.0.10:ip地址——>二进制表示为:        10110000.00011001.00000000.00001001    *255.255.255.0:子网掩码——>二进制表示为:11111111.11111111.11111111.00000000    **子网掩码255位(即二进制1)对应的ip位为网络位,子网掩码0对应的ip位为主机位 2.配置ip    <<配置界面>>    1.图形界面:执行命令:nm-connection-editor    2.文本化图形:nmtui    <<命令>>    ifconfig 网卡 ip地址 netmask  子网掩码         ##临时设定    相关命令:    nmcli connection add type ethernet con-name westos ifname eth0 autoconnect yes   ##设置网络环境,大多数参数都可用tab键补出    nmcli connection add type ethernet con-name westos ifname eth0 ip4 ip/24    nmcli connection delete westos    nmcli connection show    nmcli connection down westos    nmcli connection up westos    nmcli connection modify "westos" ipv4.addresses newip/24    nmcli connection modify "westos" ipv4.method <auto|manual>    nmcli device connect eth0    nmcli device disconnect eth0    nmcli device show    nmcli device status

       **autoconnnect  自动更新;

       ifconfig 端口 down/up                          ##开启/关闭端口

       设置后需要重启网络服务:

          systemctl stop  NetworkManager.server       systemctl restart network       systemctl start NetmorkManager

       <<文件>>    dhcp             ##动态获取

       编辑配置文件:vim /etc/sysconfig/network-scripts/ifcfg-eth0

       编辑内容:

       DEVICE=eth0                  ##接口使用设备    BOOTPROTO=dhcp        ##网卡工作模式    ONBOOT=yes                 ##网络服务开启时自动激活    NAME=eth0                     ##网络接口名称    重启网络服务:systemctl restart network    static|none    ##静态网络    vim /etc/sysconfig/network-scripts/ifcfg-eth0    DEVICE=eth0                                             BOOTPROTO=static|none                          ONBOOT=yes                                             NAME=eth0                                                 IPADDR=172.25.0.100                               NETMASK=255.255.255.0 | PREFIX=24
    转载请注明原文地址: https://ju.6miu.com/read-665152.html

    最新回复(0)