重装linux 连不上网,重装Vmware造成Ubuntu网络问题

本文分享了在VMware中重装Ubuntu后遇到的网络连接问题解决方案。通过更改网络接口名称并重新启动网络服务,成功恢复了网络连接。此外,还介绍了如何配置静态IP地址及DNS设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天重装了vmware后,再次使用原来的Ubuntu7.10文件,找不到网络连接。

web@Ubuntu8:~$ ifconfig

eth1 Link encap:Ethernet HWaddr 00:0C:29:ED:F3:C2

inet addr:0 Bcast:0 Mask:0

Interrupt:16 Base address:0x2000

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

sudo vim /etc/network/interfaces

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

auto eth0

iface eth0 inet dhcp

原来是新旧vmware的网卡不一样,将eth0改为eth1,重启网络

sudo /etc/init.d/networking restart

一切OK了

顺便讲一下/etc/network/interfaces

如果是配置eth为静态IP

(比如192.168.1.1)并且指定网关(如192.168.1.254),那么如此配置:

auth eth0

iface eth0 inet staticaddress 192.168.1.1

netmask 255.255.255.0

gateway 192.168.1.254

如果是手动指定IP并且还需要访问互联网,比如wget下载,那么还需要设置DNS:

$sudo pico /etc/resolv.conf向这里添加配置内容:nameserver xxx.xxx.xxx.xxx保存即可。0b1331709591d260c1c78e86d0c51c18.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值