我在工作用的笔记本电脑上运行 Fedora 20 和 KDE。在家时我使用 DHCP,上班时我必须静态分配 IP。前几天我回家时,不知为何它没有获得 IP。更换电缆后,我家网络中的其他计算机运行正常。
在 KDE 网络管理器中,我通常会更改设置。对于接口 enp0s25,需要 IPv4,而忽略 IPv6。
所以我开始在命令行中乱搞。
[user@F20 ~]$ ifconfig
enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::2ad2:44ff:fe31:fece prefixlen 64 scopeid 0x20<link>
ether 28:d2:44:31:fe:ce txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 20 bytes 4832 (4.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xf1600000-f1620000
[user@F20 ~]$ cat /etc/sysconfig/network-scripts/ifcfg-enp0s25
TYPE="Ethernet"
BOOTPROTO=dhcp
DEFROUTE="yes"
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
NAME="enp0s25"
UUID="b32402c2-05f3-4dd5-bd46-2edf21f3358a"
ONBOOT="yes"
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
HWADDR=28:D2:44:31:FE:CE
PEERDNS=yes
PEERROUTES=yes
这一页: 如何在 Linux 上禁用特定接口上的 ipv6?
建议我做出这些改变。
[user@F20 ~]$ cat /etc/sysconfig/network-scripts/ifcfg-enp0s25
IPV6_AUTOCONF="no"
IPV6_DEFROUTE="no"
所以我这样做:
[user@F20 ~]$ sudo /etc/init.d/network restart
Restarting network (via systemctl): Job for network.service failed. See 'systemctl status network.service' and 'journalctl -xn' for details.
[FAILED]
[user@F20 ~]$ journalctl -a | grep failed
Aug 07 14:31:25 F20 systemd[1]: Unit network.service entered failed state.
Aug 07 14:32:13 F20 NetworkManager[975]: <info> (enp0s25): device state change: ip-config -> failed (reason 'ip-config-unavailable') [70 120 5]
Aug 07 14:32:13 F20 NetworkManager[975]: <warn> Activation (enp0s25) failed for connection 'enp0s25'
Aug 07 14:32:13 F20 NetworkManager[975]: <info> (enp0s25): device state change:failed -> disconnected (reason 'none') [120 30 0]
[sudo] password for user:
Redirecting to /bin/systemctl restart NetworkManager.service
所以我尝试这个:
[user@F20 ~]$ cat /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv6.conf.enp0s25.disable_ipv6 = 1
它删除了 IPv6,但仍然没有给我 IPv4 DHCP 地址。
[user@F20 ~]$
enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 28:d2:44:31:fe:ce txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 25 bytes 8650 (8.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xf1600000-f1620000
wlp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.162 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::5e51:4fff:fe54:4589 prefixlen 64 scopeid 0x20<link>
ether 5c:51:4f:54:45:89 txqueuelen 1000 (Ethernet)
RX packets 151 bytes 19996 (19.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 137 bytes 20501 (20.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
我忽略了什么?
答案1
这似乎是一个错误。更新已修复该问题。