@ecoart 就因为多才好啊,你可以 journalctl -U NetworkManager > 1.txt,然后把内容发到 paste.kde.org,然后把 url 贴回来
是这句话后面开始出的问题:
NetworkManager[1293]: <debug> [1529071425.0029] dhcp4 (eth0): running: /sbin/dhclient -d -q -sf /usr/lib/nm-dhcp-helper -pf /var/run/dhclient-eth0.pid -lf /var/lib/NetworkManager/dhclient-badb0db2-0c57-3723-a750-71cce2748287-eth0.lease -cf /var/lib/NetworkManager/dhclient-eth0.conf eth0
dhclient 一直在请求 IPv6 的地址,但是它是 dhcp4 呀.
你的网络是有什么特殊的吗?比如通过 tunnel 在 IPv4 里跑 v6 然后必要的代理还没跑起来?
另外
/var/lib/NetworkManager/dhclient-badb0db2-0c57-3723-a750-71cce2748287-eth0.lease
/var/lib/NetworkManager/dhclient-eth0.conf
这两个文件的内容让我看看。
还有
/var/run/dhclient-eth0.pid 这里面的 pid 和 systemctl status -l 里面那个 dhclient 的 pid 是否一致?
我怀疑是那个 NM 自己生成的 dhclient-eth0.conf 有问题,那个配置文件是通过 merge 得到的,所以我们最终通过修改 /etc/dhclient.conf 干预。现在的思路就是看看那个配置错哪儿了,对应在 /etc/dhclient.conf 里改正。
lease {
interface "eth0";
fixed-address 192.168.1.213;
option subnet-mask 255.255.255.0;
option wpad a;
option dhcp-lease-time 86400;
option routers 192.168.1.1;
option dhcp-message-type 5;
option dhcp-server-identifier 192.168.1.1;
option domain-name-servers 192.168.1.1;
option dhcp-renewal-time 43200;
option dhcp-rebinding-time 75600;
option broadcast-address 192.168.1.255;
option host-name "linux-zpc0";
renew 5 2018/06/15 22:18:57;
rebind 6 2018/06/16 09:24:42;
expire 6 2018/06/16 12:24:42;
}
lease {
interface "eth0";
fixed-address 192.168.1.213;
option wpad a;
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
option dhcp-lease-time 86400;
option dhcp-message-type 5;
option domain-name-servers 192.168.1.1;
option dhcp-server-identifier 192.168.1.1;
option dhcp-renewal-time 43200;
option broadcast-address 192.168.1.255;
option dhcp-rebinding-time 75600;
option host-name "linux-zpc0";
renew 6 2018/06/16 00:13:36;
rebind 6 2018/06/16 11:05:27;
expire 6 2018/06/16 14:05:27;
}
lease {
interface "eth0";
fixed-address 192.168.1.213;
option wpad a;
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
option dhcp-lease-time 86400;
option dhcp-message-type 5;
option domain-name-servers 192.168.1.1;
option dhcp-server-identifier 192.168.1.1;
option dhcp-renewal-time 40097;
option broadcast-address 192.168.1.255;
option dhcp-rebinding-time 72497;
option host-name "linux-zpc0";
renew 6 2018/06/16 09:44:31;
rebind 6 2018/06/16 20:21:53;
expire 0 2018/06/17 00:13:36;
}
lease {
interface "eth0";
fixed-address 192.168.1.213;
option wpad a;
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
option dhcp-lease-time 86400;
option dhcp-message-type 5;
option domain-name-servers 192.168.1.1;
option dhcp-server-identifier 192.168.1.1;
option dhcp-renewal-time 38733;
option broadcast-address 192.168.1.255;
option dhcp-rebinding-time 71133;
option host-name "linux-zpc0";
renew 6 2018/06/16 18:53:36;
rebind 0 2018/06/17 05:30:04;
expire 0 2018/06/17 09:44:31;
}
# Created by NetworkManager
# Merged from /etc/dhclient.conf
#
# /etc/dhclient.conf -- dhclient configuration file
# See "man dhclient.conf" for further details
#
######################################################
# Sometimes, a special configuration is required for
# e.g. Cable Modem providers (@Home -- TCI).
# For example, it may be required to send out a special
# dhcp-client-identifier or to override some settings.
#
# Uncomment and fill in the appropriate settings:
#
#send dhcp-client-identifier "c32423-a"
# or as hex octets
#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#
# Note, that hostname is usually send using -H option.
#send host-name "andare.fugue.com";
#
#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;
#
#####################################################
# uncomment to request a specific lease time, otherwise
# the dhcp server will provide its default lease time:
#send dhcp-lease-time 3600;
#
# Define RFC 3442 classless static route option
#
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
#
# Define RFC 4833 timezone options
#
option rfc4833-tz-posix-string code 100 = string;
option rfc4833-tz-name code 101 = string;
# Request several well known/usefull dhcp options.
# rfc4833-tz-posix-string, rfc4833-tz-name;
# We request above options, require only the IP configuration:
require subnet-mask;
# All another options (DNS, NTP, NIS, ...) are applied using
# netconfig(8) modules.
# To enforce the availability of the dns server list, set to:
#require subnet-mask, domain-name-servers;
reboot 10;
select-timeout 5;
initial-interval 2;
send host-name "linux-zpc0"; # added by NetworkManager
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
option ms-classless-static-routes code 249 = array of unsigned integer 8;
option wpad code 252 = string;
request; # override dhclient defaults
also request subnet-mask;
also request broadcast-address;
also request routers;
also request rfc3442-classless-static-routes;
also request interface-mtu;
also request host-name;
also request domain-name;
also request domain-search;
also request domain-name-servers;
also request nis-domain;
also request nis-servers;
also request nds-context;
also request nds-servers;
also request nds-tree-name;
also request netbios-name-servers;
also request netbios-dd-server;
also request netbios-node-type;
also request netbios-scope;
also request ntp-servers;
also request ms-classless-static-routes;
also request static-routes;
also request wpad;
/var/run/dhclient-eth0.pid中的内容是1996,运行systemctl status -l | grep dhclient得到
│ └─30737 grep --color=auto dhclient
│ └─1996 /sbin/dhclient -d -q -sf /usr/lib/nm-dhcp-helper -pf /var/run/dhclient-eth0.pid -lf /var/lib/NetworkManager/dhclient-badb0db2-0c57-3723-a750-71cce2748287-eth0.lease -cf /var/lib/NetworkManager/dhclient-eth0.conf eth0
#
# /etc/dhclient.conf -- dhclient configuration file
# See "man dhclient.conf" for further details
#
######################################################
# Sometimes, a special configuration is required for
# e.g. Cable Modem providers (@Home -- TCI).
# For example, it may be required to send out a special
# dhcp-client-identifier or to override some settings.
#
# Uncomment and fill in the appropriate settings:
#
#send dhcp-client-identifier "c32423-a"
# or as hex octets
#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#
# Note, that hostname is usually send using -H option.
#send host-name "andare.fugue.com";
#
#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;
#
#####################################################
# uncomment to request a specific lease time, otherwise
# the dhcp server will provide its default lease time:
#send dhcp-lease-time 3600;
#
# Define RFC 3442 classless static route option
#
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
#
# Define RFC 4833 timezone options
#
option rfc4833-tz-posix-string code 100 = string;
option rfc4833-tz-name code 101 = string;
# Request several well known/usefull dhcp options.
request subnet-mask, broadcast-address, routers, rfc3442-classless-static-routes, interface-mtu, host-name, domain-name, domain-search, domain-name-servers, nis-domain, nis-servers, nds-context, nds-servers, nds-tree-name, netbios-name-servers, netbios-dd-server, netbios-node-type, netbios-scope, ntp-servers;
# rfc4833-tz-posix-string, rfc4833-tz-name;
# We request above options, require only the IP configuration:
require subnet-mask;
# All another options (DNS, NTP, NIS, ...) are applied using
# netconfig(8) modules.
# To enforce the availability of the dns server list, set to:
#require subnet-mask, domain-name-servers;
timeout 60;
retry 60;
reboot 10;
select-timeout 5;
initial-interval 2;
(eth0): linklocal6: starting IPv6 with method 'auto', but the device has no link-local addresses configured. Wait.
(eth0): timed out waiting for IPv6 router advertisement
能讲讲你的 IPv6 的情况么?校园网?这里 dhclient 取不到 v6 的地址.
如果我没猜错的话,你重启后运行 ip a 应该是有 IPv4 的地址的.
你看下 ip a 和 ip route list 的结果.
应该不是 NM 和 dhclient 的锅,感觉像是你就没有 v6.
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state DORMANT group default qlen 1000
link/ether ea:1d:bc:eb:bb:e0 brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether ac:9e:17:1f:31:04 brd ff:ff:ff:ff:ff:ff
inet6 fe80::2462:b213:4f82:d744/64 scope link noprefixroute
valid_lft forever preferred_lft forever
ip rule show
0: from all lookup local
32766: from all lookup main
32767: from all lookup default
我这网络没有IPv6,用这个网站测试了也是没有的http://test-ipv6.com
关闭了IPv6还是不行:joy:
你怎么关的 IPv6 啊?NM 会自动打开 IPv6 的,sysctl 禁用的方法会失败。
这是用哪个命令呢?