“Centos7.x配置网络”的版本间的差异
跳到导航
跳到搜索
小 (导入1个版本) |
|||
(未显示同一用户的6个中间版本) | |||
第51行: | 第51行: | ||
IPV6_ADDR_GEN_MODE="stable-privacy" | IPV6_ADDR_GEN_MODE="stable-privacy" | ||
NAME="eth0" | NAME="eth0" | ||
− | UUID="ff71d3b7-aa7d-4ac5-a3ca-87e867fe2a64" | + | #UUID="ff71d3b7-aa7d-4ac5-a3ca-87e867fe2a64" |
DEVICE="eth0" | DEVICE="eth0" | ||
ONBOOT="yes" | ONBOOT="yes" | ||
第67行: | 第67行: | ||
</pre> | </pre> | ||
+ | == 启用/禁用网卡== | ||
+ | <pre> | ||
+ | 方式一:ifconfig命令 | ||
+ | |||
+ | // 禁用 | ||
+ | ifconfig eno16780032 dowm | ||
+ | // 启动 | ||
+ | ifconfig eno16780032 up | ||
+ | |||
+ | 方式一等同于如下: | ||
+ | |||
+ | // 禁用 | ||
+ | ifdowm eno16780032 | ||
+ | // 启动 | ||
+ | ifup eno16780032 | ||
+ | </pre> | ||
=dns client= | =dns client= | ||
<pre> | <pre> | ||
第75行: | 第91行: | ||
2./etc/resolv.conf | 2./etc/resolv.conf | ||
</pre> | </pre> | ||
+ | |||
=troubleshooting= | =troubleshooting= | ||
PREFIXO0=24 #设置子网掩码 会导致连上不外网 | PREFIXO0=24 #设置子网掩码 会导致连上不外网 | ||
=参考= | =参考= | ||
+ | |||
+ | [https://www.cnblogs.com/panblack/p/Centos7_Static_Routes.html Centos7添加静态路由] | ||
+ | |||
+ | [https://www.cnblogs.com/panblack/p/Centos7-WhatsNew-02-networking.html Centos7系统配置上的变化(二)网络管理基础] | ||
+ | |||
+ | [https://man.linuxde.net/route route命令] | ||
+ | |||
+ | [https://www.cnblogs.com/snake-hand/p/3143041.html linux route命令的使用详解 ] | ||
+ | |||
+ | |||
+ | [https://blog.csdn.net/God_luck/article/details/83548090 路由跟踪(tracert、traceroute)简析] | ||
+ | |||
[https://blog.csdn.net/MichealwlfBBLF/article/details/71330194 centos 7配置静态IP,并配置DNS] | [https://blog.csdn.net/MichealwlfBBLF/article/details/71330194 centos 7配置静态IP,并配置DNS] | ||
第85行: | 第114行: | ||
[https://blog.csdn.net/xmroom/article/details/69055193 Centos7 网络配置 设置静态Ip] | [https://blog.csdn.net/xmroom/article/details/69055193 Centos7 网络配置 设置静态Ip] | ||
+ | [[category:devops]] |
2022年8月16日 (二) 09:15的最新版本
解说
cat /etc/sysconfig/network-scripts/ifcfg-enp6s0 #添加如下内容 BOOTPROTO=static #启用静态IP地址 IPADDR0=192.168.88.10 #设置IP地址 NETMASK=255.255.255.0 #设置子网掩码 GATEWAY0=192.168.88.1 #设置网关 DNS1=8.8.8.8 #设置主DNS DNS2=114.114.114.114 #设置备DNS DEVICE=enp0s3 ONBOOT=yes cat /etc/resolv.conf # Generated by NetworkManager nameserver 192.168.88.1 nameserver 192.168.53.1 #重启网络 service network restart #othre TYPE="Ethernet" BOOTPROTO=static IPADDR0=192.168.0.9 NETMASK=255.255.255.0 GATEWAY0=192.168.0.1 DNS1=8.8.4.4 DNS2=114.114.114.114 DEVICE="eth0" ONBOOT="yes"
eg
cat /etc/sysconfig/network-scripts/ifcfg-eth0 TYPE="Ethernet" BOOTPROTO="none" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME="eth0" #UUID="ff71d3b7-aa7d-4ac5-a3ca-87e867fe2a64" DEVICE="eth0" ONBOOT="yes" DNS1="223.5.5.5" DOMAIN="223.5.5.5" IPADDR="192.168.88.50" PREFIX="24" GATEWAY="192.168.88.1" IPV6_PEERDNS="yes" IPV6_PEERROUTES="yes" IPV6_PRIVACY="no"
启用/禁用网卡
方式一:ifconfig命令 // 禁用 ifconfig eno16780032 dowm // 启动 ifconfig eno16780032 up 方式一等同于如下: // 禁用 ifdowm eno16780032 // 启动 ifup eno16780032
dns client
1. /etc/sysconfig/network-scripts/ifcfg-eth0 DNS1="223.6.6.6" #前面这个优先级比较高 其实上面不要写上dns更加清爽 2./etc/resolv.conf
troubleshooting
PREFIXO0=24 #设置子网掩码 会导致连上不外网