每次必须sudo dhclient -v 才能上网......

包含网卡/无线网的网络问题和ADSL/校园网/宽带拨号支持及代理/共享等网络使用问题
回复
chuangsheng
帖子: 28
注册时间: 2006-02-06 10:32

每次必须sudo dhclient -v 才能上网......

#1

帖子 chuangsheng » 2017-04-16 1:30

环境:
win10的笔记本主机,安装的vbox虚拟机,链接方式为默认的网络地址转换(NAT)

原版本为16.04没任何问题,手贱一口气先升级到了16.10 ,紧接着升级到了17.04

系统本身使用无问题,但是无法连接网络,只能每次开机后输入sudo dhclient -v 才能上网。

以下为基础信息:


sudo lshw -C network
*-network DISABLED
description: Ethernet interface
product: 82540EM Gigabit Ethernet Controller
vendor: Intel Corporation
physical id: 3
bus info: pci@0000:00:03.0
logical name: enp0s3
version: 02
serial: 08:00:27:f7:a1:4b
size: 1Gbit/s
capacity: 1Gbit/s
width: 32 bits
clock: 66MHz
capabilities: pm pcix bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000 driverversion=7.3.21-k8-NAPI duplex=full latency=64 link=no mingnt=255 multicast=yes port=twisted pair speed=1Gbit/s
resources: irq:19 memory:f0000000-f001ffff ioport:d010(size=8)


lspci -knn
00:00.0 Host bridge [0600]: Intel Corporation 440FX - 82441FX PMC [Natoma] [8086:1237] (rev 02)
00:01.0 ISA bridge [0601]: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] [8086:7000]
00:01.1 IDE interface [0101]: Intel Corporation 82371AB/EB/MB PIIX4 IDE [8086:7111] (rev 01)
Kernel driver in use: ata_piix
Kernel modules: pata_acpi
00:02.0 VGA compatible controller [0300]: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter [80ee:beef]
Kernel driver in use: vboxvideo
Kernel modules: vboxvideo
00:03.0 Ethernet controller [0200]: Intel Corporation 82540EM Gigabit Ethernet Controller [8086:100e] (rev 02)
Subsystem: Intel Corporation PRO/1000 MT Desktop Adapter [8086:001e]
Kernel driver in use: e1000
Kernel modules: e1000
00:04.0 System peripheral [0880]: InnoTek Systemberatung GmbH VirtualBox Guest Service [80ee:cafe]
Kernel driver in use: vboxguest
Kernel modules: vboxguest
00:05.0 Multimedia audio controller [0401]: Intel Corporation 82801AA AC'97 Audio Controller [8086:2415] (rev 01)
Subsystem: Dell 82801AA AC'97 Audio Controller [1028:0177]
Kernel driver in use: snd_intel8x0
Kernel modules: snd_intel8x0
00:06.0 USB controller [0c03]: Apple Inc. KeyLargo/Intrepid USB [106b:003f]
Kernel driver in use: ohci-pci
00:07.0 Bridge [0680]: Intel Corporation 82371AB/EB/MB PIIX4 ACPI [8086:7113] (rev 08)
Kernel driver in use: piix4_smbus
Kernel modules: i2c_piix4
00:0d.0 SATA controller [0106]: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] [8086:2829] (rev 02)
Kernel driver in use: ahci
Kernel modules: ahci


sudo ifconfig -a
enp0s3: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 08:00:27:f7:a1:4b txqueuelen 1000 (以太网)
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

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 (本地环回)
RX packets 68 bytes 5296 (5.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 68 bytes 5296 (5.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

sudo route -nv
内核 IP 路由表
目标 网关 子网掩码 标志 跃点 引用 使用 接口

sudo cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 127.0.0.53

sudo dhclient -v
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/enp0s3/08:00:27:f7:a1:4b
Sending on LPF/enp0s3/08:00:27:f7:a1:4b
Sending on Socket/fallback
DHCPREQUEST of 10.0.2.15 on enp0s3 to 255.255.255.255 port 67 (xid=0x7c309f1a)
DHCPACK of 10.0.2.15 from 10.0.2.2
bound to 10.0.2.15 -- renewal in 33610 seconds.
taohunter
帖子: 1555
注册时间: 2012-03-31 3:29

Re: 每次必须sudo dhclient -v 才能上网......

#2

帖子 taohunter » 2017-04-17 21:24

请先尝试在虚拟机设置里将网卡的模式由NAT修改为桥接模式。如还不行,请提供一下vbox以及其上extension pack的版本。
三年后终于回到16.04--稳定了!
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 每次必须sudo dhclient -v 才能上网......

#3

帖子 poloshiao » 2017-04-18 7:10

sudo cat /etc/resolv.conf
nameserver 127.0.0.53
1. 第一次 看到 127.0.0.53
1-1. sudo ifconfig lo | grep inet
看看 是什麼 local interface address
例如 nameserver 127.0.0.nn
通常是 127.0.0.1 或 127.0.1.1

2. 另外 找出 任何有效使用中的 dns 兩個
xxx.xxx.xxx.xxx
yyy.yyy.yyy.yyy
2-1. 參考
http://public-dns.info/nameserver/cn.html
DNS servers in China

3. /etc/resolv.conf
改為
nameserver 127.0.0.nn
xxx.xxx.xxx.xxx
yyy.yyy.yyy.yyy
3-1. 然後 連網試試 (不要重新開機 !)
3-2. 這是 一次性 重開機 必須重新設定
3-3. 如果 需要 重開機 設定還有效 請再貼文
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 每次必须sudo dhclient -v 才能上网......

#4

帖子 poloshiao » 2017-04-23 17:42

viewtopic.php?p=3189117#p3189117
1. 第一次 看到 127.0.0.53
1. 發現 127.0.0.53 是 systemd-resolved 使用
1-1. https://www.freedesktop.org/software/sy ... olved.html#
Additionally, systemd-resolved provides a local DNS stub listener on IP address 127.0.0.53 on the local loopback interface.

2. ubuntu 17.04 改為 systemd-resolved 解析 dns
2-1. https://wiki.ubuntu.com/ZestyZapus/Rele ... Networking
The default DNS resolver is now systemd-resolved.
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 每次必须sudo dhclient -v 才能上网......

#5

帖子 poloshiao » 2017-04-26 18:00

你的問題 解決了嗎
*-network DISABLED
product: 82540EM Gigabit Ethernet Controller
logical name: enp0s3
sudo ifconfig -a
enp0s3: flags=4098<BROADCAST,MULTICAST> mtu 1500
sudo route -nv
1. 沒有合適啟動 沒有獲得分配網址 及 路由
sudo dhclient -v
Listening on LPF/enp0s3/08:00:27:f7:a1:4b
Sending on LPF/enp0s3/08:00:27:f7:a1:4b
Sending on Socket/fallback
DHCPREQUEST of 10.0.2.15 on enp0s3 to 255.255.255.255 port 67 (xid=0x7c309f1a)
DHCPACK of 10.0.2.15 from 10.0.2.2
bound to 10.0.2.15 -- renewal in 33610 seconds.
每次必须 sudo dhclient -v 才能上网
2. 猜測 是透過 IPv6 與 DHCP Server 取得溝通後 才通
sudo cat /etc/resolv.conf
nameserver 127.0.0.53
3. 適用於 Ubuntu 17.04 的暫時解決方案
https://bugs.launchpad.net/ubuntu/+sour ... comments/8
The fix:
ls -la /etc/resolv.conf
lrwxrwxrwx 1 root root 32 mar 8 07:30 /etc/resolv.conf -> /run/systemd/resolve/resolv.conf
回复