欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

桥接模式下没有IP不能联网的问题

程序员文章站 2022-05-01 15:55:38
...

桥接模式下没有ip,不能联网

ifconfig 命令

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::371b:3139:1d2b:d5cf  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:fa:d0:6a  txqueuelen 1000  (Ethernet)
        RX packets 17  bytes 1740 (1.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 54  bytes 9569 (9.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:c0:c6:75  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

可以先关闭防火墙

systemctl status firewalld 查看防火墙状态

systemctl stop firewalld 关闭防火墙

systemctl start firewalld 开启防火墙

检查Linux的配置文件

命令

vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
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="ens33"
UUID="da32cd0f-3c80-44bb-9840-74a28efd2940"
DEVICE="ens33"
ONBOOT="yes"

确认是否是dhcp模式,BOOTPROTO="dhcp",以及系统启动时是否执行dhcp模式,ONBOOT="yes"

然后检查VMware的网络配置

桥接模式下没有IP不能联网的问题

最后重新启动网卡

Centos 8 中
nmcli connection reload 网卡名 [我是用的这个]

nmcli connection up 网卡名

nmcli device reapply 网卡名

nmcli device connect 网卡名

方法二:
ifconfig 网卡名 down 关闭网卡

ifconfig 网卡名 up 启动网卡

桥接模式下没有IP不能联网的问题

相关标签: 网络连接 linux