|
|
第1行: |
第1行: |
| =解说=
| |
| <pre>
| |
| 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
| | [http://www.178linux.com/15245 Centos 7 DNS配置及理论详解] |
| ONBOOT=yes
| |
|
| |
|
| | | [[category:ops]] |
| 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"
| |
| | |
| </pre>
| |
| =eg=
| |
| <pre>
| |
| 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"
| |
| | |
| | |
| | |
| </pre>
| |
| | |
| == 启用/禁用网卡==
| |
| <pre>
| |
| 方式一:ifconfig命令
| |
| | |
| // 禁用
| |
| ifconfig eno16780032 dowm
| |
| // 启动
| |
| ifconfig eno16780032 up
| |
| | |
| 方式一等同于如下:
| |
| | |
| // 禁用
| |
| ifdowm eno16780032
| |
| // 启动
| |
| ifup eno16780032
| |
| </pre>
| |
| =dns client=
| |
| <pre>
| |
| 1. /etc/sysconfig/network-scripts/ifcfg-eth0
| |
| DNS1="223.6.6.6"
| |
| | |
| #前面这个优先级比较高 其实上面不要写上dns更加清爽
| |
| 2./etc/resolv.conf
| |
| </pre>
| |
| | |
| =troubleshooting=
| |
| 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/jcxch/article/details/48632761 centos 7 网络配置( 网关、dns、ip地址配置)]
| |
| | |
| [https://blog.csdn.net/xmroom/article/details/69055193 Centos7 网络配置 设置静态Ip]
| |
| [[category:devops]] | |