Solution to Linux unable to access external network

王林
Release: 2019-12-27 13:14:57
Original
5487 people have browsed it

Solution to Linux unable to access external network

1. First configure the static IP. You need to remove the dynamic IP allocation.

2. The third network segment of the subnet must be different from the host network segment. The third network segment of the host IP in this article is: 1, and the third network segment of the virtual machine is set to: 239

Solution to Linux unable to access external network

Solution to Linux unable to access external network

Related learning Video tutorial sharing: linux video tutorial

3, NET settings

Solution to Linux unable to access external network

##4, ifcfg-ens33 file configuration.

cd /etc/sysconfig/network-scripts
vim ifcfg-ens33
Copy after login
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
DEVICE=ens33
PREFIX=16
 
### UUID默认
UUID=4d1c2382-814d-45e1-a5b9-252086ceff86
 
### 此部分设置最重要 需要根据实际情况进行设置。
 
# BOOTPROTO IP的配置方法[none|static|bootp|dhcp](引导时不使用协议|静态分配IP|BOOTP协议|DHCP协议)
BOOTPROTO=static
# ONBOOT 系统启动的时候网络接口是否有效(yes/no)
ONBOOT=yes
IPADDR=192.168.239.128 # 前边三个网段根据虚拟机设置进行配置 192.168.239.xxx 最后的xxx在0-255之间即可
GATEWAY=192.168.239.2  # 网关很重要,根据虚拟机设置的网关进行配置
DNS1=8.8.8.8   # DNS必填,否则可能无法上网
DNS2=114.114.114.114
Copy after login

5. Restart the network service

service network restart
Copy after login

Recommended related articles and tutorials:

linux tutorial

The above is the detailed content of Solution to Linux unable to access external network. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template