Linux运维笔记-文档总结-管理网络

    xiaoxiao2021-04-05  46

    以下所有操作都是在Red-hat 7.0上运行。


    1.ip基础知识

    1.ipv4 ##互联网协议的第四版

    2进制32位—–10进制 172.25.0.10/255.255.255.0 172.25.0.10:ip地址 255.255.255.0:子网掩码 子网掩码255位对应的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 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

    3.gateway 网关

    1.路由器 主要功能是用来作nat的 dnat 目的地地址转换 snat 源地址转换

    2.网关 路由器上和自己处在同一个网段的那个ip

    3.设定网关 systemctl stop NetwrokManager ##如果不关闭这个,这会记录以前的信息,你改了信息相当于没改 vim /etc/sysconfig/network ##全局网关 GATEWAY=网关ip

    vim /etc/sysconfig/network-scripts/ifcfg-网卡配置文件 ##网卡接口网关 GATEWAY=网关ip systemctl restart netwrok

    route -n ##查询网关 Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 (网关)172.25.0.254 0.0.0.0 UG 0 0 0 eth0 172.25.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0

    5.dns

    1.dns dns是一台服务器 这太服务器提供了回答客户主机名和ip对应关系的功能

    2.设定dns vim /etc/resolv.conf nameserver dns服务器ip vim /etc/sysconfig/network-scripts/ifcfg-网卡配置文件 DNS1=dns服务器ip

    3.本地解析文件 vim /etc/hosts ip 主机名称 4.本地解析文件和dns读取的优先级调整 /etc/nsswitch.conf 38 #hosts: db files nisplus nis dns 39 hosts: files dns ##files代表本地解析文件,dns代表dns服务器,那个在前面那个优先


    The end

    转载请注明原文地址: https://ju.6miu.com/read-666350.html

    最新回复(0)