linux网线连不上网络,【linux】台式机连接网线ubuntu1404无法上网解决方法
发布日期:2022-02-18 13:08:14 浏览次数:9 分类:技术文章

本文共 2446 字,大约阅读时间需要 8 分钟。

原创文章:https://mp.csdn.net/postedit?not_checkout=1

一、问题描述

一切从ubuntu中没有安装pthread相关的man手册说起,问题是这样的:

man 3 pthread_mutex_init时提示找不到函数,说明我没有安装pthread相关的man手册。

安装方法:1、虚拟机上网;2、sudo apt-get install manpages-posix-dev

二、解决虚拟机上网

一般情况下,经历下面两步骤就可以上网:

(1)选择虚拟网络类型,这里以桥接为例

0a6a2268b1e82fc13a824f287a5349a6.png

(2)在网络适配器中选择对应的选择桥接模式

0b3e98e14445a6f7de8b406a5db4b81a.png

然而,还是无法上网。说明:本人使用台式电脑连接网线上网。

网上找了很多文章,最后发现是因为自己以前的项目中手动设置了虚拟机的IP地址,造成dhcp协议自动分配的IP地址无法生效。

解决方法:

(1)先查看ubuntu的ip地址

# ifconfig

eth0 Link encap:Ethernet HWaddr 00:0c:29:69:92:51

inet addr:172.31.102.128 Bcast:172.31.102.255 Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:fe69:9251/64 Scope:Link

inet6 addr: 2001:250:3c00:2102:bd6e:c92:49cd:ddae/64 Scope:Global

inet6 addr: 2001:250:3c00:2102:20c:29ff:fe69:9251/64 Scope:Global

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

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

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

collisions:0 txqueuelen:1000

RX bytes:63941681 (63.9 MB) TX bytes:1209428 (1.2 MB)

Interrupt:19 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:65536 Metric:1

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

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

collisions:0 txqueuelen:0

RX bytes:335163 (335.1 KB) TX bytes:335163 (335.1 KB)

(2)第一个eth0就是我的以太网的名称。下面通过修改网络参数

# sudo vi /etc/network/interfaces1

(3)这里面的内容应该是这样的:

# interfaces(5) file used by ifup(8) and ifdown(8)

auto lo

iface lo inet loopback

auto eth0

iface eth0 inet dhcp

address 192.168.1.141

netmask 255.255.255.0

gateway 192.168.1.1

(4)将自己手动编写的ip地址,子网掩码,网关屏蔽(说明:屏蔽了这三行后dhcp就可以自己分配ip地址):

# interfaces(5) file used by ifup(8) and ifdown(8)

auto lo

iface lo inet loopback

auto eth0

iface eth0 inet dhcp

#address 192.168.1.141

#netmask 255.255.255.0

#gateway 192.168.1.1

(5)重启网络服务

sudo service network-manager restart1

大功告成。。。。。。。。。。。。。。。。。。。。

三、sudo apt-get install manpages-posix-dev安装pthread相关的man手册

尽管已经解决上网问题,但是sudo apt-get install manpages-posix-dev安装pthread相关的man手册时遇到如下问题

$ sudo apt-get install manpages-posix-dev

Reading package lists... Error!

E: Encountered a section with no Package: header

E: Problem with MergeList /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_trusty_multiverse_i18n_Translation-en

原因分析:apt-get需要更新了

解决方法:

(1)先删除ubuntu中原有的apt-get软件,使用下面命令

$ sudo rm /var/lib/apt/lists/* -vf

(2)在使用下面命令更新apt-get软件

$ sudo apt-get update

更新完毕后,再一次sudo apt-get install manpages-posix-dev就真正大功告成啦。。。。。

转载地址:https://blog.csdn.net/weixin_28871097/article/details/116788778 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Keil C语言数据类型,KeilC的指针类型
下一篇:登录linux后台工具,linux后台进程管理工具-supervisor

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年04月09日 09时46分37秒