Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux网络配置 #23

Open
fengzhao opened this issue Oct 14, 2021 · 0 comments
Open

Linux网络配置 #23

fengzhao opened this issue Oct 14, 2021 · 0 comments
Assignees
Labels
help wanted Extra attention is needed
Milestone

Comments

@fengzhao
Copy link
Owner

fengzhao commented Oct 14, 2021

第一步

通过 ip addr 命令查看当前网卡的配置信息。查看网卡名称。

第二步,找到网卡配置文件,修改它

# vim /etc/sysconfig/network-scripts/ifcfg-ens333

TYPE=Ethernet                                # 网卡类型:以太网
ONBOOT=yes                                   # 网卡开机自启: 是
PROXY_METHOD=none                 	     # 代理方式:关闭状态
BROWSER_ONLY=no                              # 是否仅代理浏览器:否
BOOTPROTO=dhcp                         	     # 网卡的引导协议:dhcp或static,dhcp自动获取,static配置静态IP
DEFROUTE=yes                                 # 默认路由:是, 不明白的可以百度关键词 `默认路由` 
IPV4_FAILURE_FATAL=no                        # 是否开启IPV4致命错误检测:否
IPV6INIT=yes                                 # IPV6是否自动初始化: 是[不会有任何影响, 现在还没用到IPV6]
IPV6_AUTOCONF=yes                            # IPV6是否自动配置:是[不会有任何影响, 现在还没用到IPV6]
IPV6_DEFROUTE=yes                            # IPV6是否可以为默认路由:是[不会有任何影响, 现在还没用到IPV6]
IPV6_FAILURE_FATAL=no                        # 是否开启IPV6致命错误检测:否
IPV6_ADDR_GEN_MODE=stable-privacy            # IPV6地址生成模型:stable-privacy [这只一种生成IPV6的策略]
NAME=ens33                                   # 网卡物理设备名称,一般就是 ip addr 中看到的网卡名称
UUID=f47bde51-fa78-4f79-b68f-d5dd90cfc698    # 网卡UUID:通用唯一识别码, 每一个网卡都会有, 不能重复, 否两台linux只有一台网卡可用
DEVICE=ens33                    	     # 网卡设备名称, 必须和 `NAME` 值一样

# IP配置,网关,子网掩码,DNS
IPADDR="10.10.20.27"                         # IP地址
PREFIX="24"                                  #  
GATEWAY="10.10.20.254"                       # 网关    
DNS1=114.114.114.114                         # 主DNS
DNS2=223.5.5.5                               # 备DNS
ZONE=public




# 重启网卡
systemctl restart network


# ping外网,ping网关,如果通了就可以了

ping www.baidu.com

ping 10.10.20.254

@fengzhao fengzhao self-assigned this Oct 14, 2021
@fengzhao fengzhao added bug Something isn't working help wanted Extra attention is needed and removed bug Something isn't working labels Oct 14, 2021
@fengzhao fengzhao added this to the 里程碑 milestone Oct 14, 2021
@fengzhao fengzhao changed the title CentOS7配置静态IP和网络地址 Linux网络配置 Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
Archived in project
Development

No branches or pull requests

1 participant