我有一块硬连线的以太网卡/电缆连接到我的集线器。我启动了 Fedora 23,但是没有网络,为什么?所以我检查了这张卡是否存在:-
[root@localhost ~]# lspci | grep Ether
00:0b.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8100/8101L/8139 PCI Fast Ethernet Adapter (rev 10)
[root@localhost ~]# lspci -vm -s 00:0b.0
Device: 00:0b.0
Class: Ethernet controller
Vendor: Realtek Semiconductor Co., Ltd.
Device: RTL-8100/8101L/8139 PCI Fast Ethernet Adapter
SVendor: Packard Bell B.V.
SDevice: Device e012
Rev: 10
然后我尝试启动网络(仅供参考,systemctl restart network.service
有相同的输出)...
[root@localhost ~]# service network start
Starting network (via systemctl): Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.
[FAILED]
systemctl status network.service
建议的命令(上面)的结果是......
[root@localhost ~]# systemctl status network.service
● network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network)
Active: failed (Result: exit-code) since Sun 2015-11-08 19:40:26 GMT; 30s ago
Docs: man:systemd-sysv-generator(8)
Process: 3072 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=1/FAILURE)
Nov 08 19:40:23 localhost.localdomain network[3072]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Nov 08 19:40:24 localhost.localdomain network[3072]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Nov 08 19:40:25 localhost.localdomain network[3072]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Nov 08 19:40:25 localhost.localdomain network[3072]: [ OK ]
Nov 08 19:40:26 localhost.localdomain network[3072]: Bringing up interface enp0s11: Error: Connection activation failed: No suitable device found for this connection.
Nov 08 19:40:26 localhost.localdomain network[3072]: [FAILED]
Nov 08 19:40:26 localhost.localdomain systemd[1]: network.service: Control process exited, code=exited status=1
Nov 08 19:40:26 localhost.localdomain systemd[1]: Failed to start LSB: Bring up/down networking.
Nov 08 19:40:26 localhost.localdomain systemd[1]: network.service: Unit entered failed state.
Nov 08 19:40:26 localhost.localdomain systemd[1]: network.service: Failed with result 'exit-code'.
然后我在这里看到了一些建议,我检查了网络脚本的内容,ifcfg-enp0s11ifconfig -a
,上面失败的那个似乎是我正在寻找的那个,MAC地址与该命名设备列出的MAC地址相同
[root@localhost ~]# more /etc/sysconfig/network-scripts/ifcfg-enp0s11
HWADDR=00:13:D4:86:EB:18
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=enp0s11
UUID=b7fce5e7-b3aa-4e95-a014-8661889e9cce
ONBOOT=yes
我在网络脚本中的其他选项是
ifcfg-enp0s11 ifdown-ippp ifdown-routes ifup ifup-ipv6 ifup-ppp ifup-tunnel
ifcfg-lo ifdown-ipv6 ifdown-sit ifup-aliases ifup-isdn ifup-routes ifup-wireless
ifdown ifdown-isdn ifdown-Team ifup-bnep ifup-plip ifup-sit init.ipv6-global
ifdown-bnep ifdown-post ifdown-TeamPort ifup-eth ifup-plusb ifup-Team network-functions
ifdown-eth ifdown-ppp ifdown-tunnel ifup-ippp ifup-post ifup-TeamPort network-functions-ipv6
但是ifup eth
,,,ifup eth1
和ifup eth2
都说没有找到配置? ifup enp0s11
!ifup lo
[root@localhost ~]# ifup eth
/usr/sbin/ifup: configuration for eth not found.
Usage: ifup <device name>
我部分地理解这ifup
些命令实际上不再使用,因为 NetworkManager 正在运行......
[root@localhost ~]# systemctl status NetworkManager.service
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2015-11-08 19:35:13 GMT; 33min ago
Main PID: 905 (NetworkManager)
CGroup: /system.slice/NetworkManager.service
└─905 /usr/sbin/NetworkManager --no-daemon
Nov 08 19:35:30 localhost.localdomain NetworkManager[905]: <info> (virbr0): device state change: secondaries -> activated (reason 'none') [90 100 0]
Nov 08 19:35:30 localhost.localdomain NetworkManager[905]: <info> (virbr0): Activation: successful, device activated.
Nov 08 19:35:35 localhost.localdomain NetworkManager[905]: <info> (virbr0-nic): link disconnected (calling deferred action)
Nov 08 19:36:57 localhost.localdomain NetworkManager[905]: <info> use BlueZ version 5
Nov 08 19:40:31 localhost.localdomain NetworkManager[905]: <info> connectivity: check for uri 'http://fedoraproject.org/static/hotspot.txt' failed with 'Error resolving 'fedoraproject.org': Name or service not known'
Nov 08 19:45:31 localhost.localdomain NetworkManager[905]: <info> connectivity: check for uri 'http://fedoraproject.org/static/hotspot.txt' failed with 'Error resolving 'fedoraproject.org': Name or service not known'
Nov 08 19:50:31 localhost.localdomain NetworkManager[905]: <info> connectivity: check for uri 'http://fedoraproject.org/static/hotspot.txt' failed with 'Error resolving 'fedoraproject.org': Name or service not known'
Nov 08 19:55:31 localhost.localdomain NetworkManager[905]: <info> connectivity: check for uri 'http://fedoraproject.org/static/hotspot.txt' failed with 'Error resolving 'fedoraproject.org': Name or service not known'
Nov 08 20:00:31 localhost.localdomain NetworkManager[905]: <info> connectivity: check for uri 'http://fedoraproject.org/static/hotspot.txt' failed with 'Error resolving 'fedoraproject.org': Name or service not known'
Nov 08 20:05:31 localhost.localdomain NetworkManager[905]: <info> connectivity: check for uri 'http://fedoraproject.org/static/hotspot.txt' failed with 'Error resolving 'fedoraproject.org': Name or service not known'
知道为什么我没有网络吗?
答案1
尝试这个;
sudo vi /etc/sysconfig/network-scripts/ifcfg-enp0s11
然后更改以下内容;
BOOTPROTO="static"
除非您有特殊原因需要动态设置 IP,否则我会设置静态 IP 地址。这样,网络上的所有其他设备始终具有相同的 IP 可供连接,例如 ssh、http、ftp 等。
IPADDR=
路由器设置中的 IP 地址将是您的外部 IP 地址,
GATEWAY=
查看您的路由器设置,
NETMASK=
查看您的路由器设置,
DNS1=
查看您的 路由器设置DNS2=
,查看您的路由器设置,您可以通过在浏览器 URL 中输入路由器的 IP 地址或路由器 IP 来访问路由器。
192.168.1.1
在我的 Linksys 路由器上,我转到“状态”选项卡,所有信息都在“路由器”下。将所有这些信息添加到您的ifcfg-enp0s11
文件中,然后重新启动网络
sudo systemctl restart network.service
确保它已启用,以便您在重启时保持设置
sudo systemctl enable network.service
您可以使用以下方式检查网络状态
sudo systemctl status network.service