好的,所以我看过这个帖子网络连接在几秒钟后断开,
这看起来与我遇到的问题类似,但我刚刚获得 Linux,不知道该怎么做。
在我开始之前。
我有 Opensuse 13.1。
这是在虚拟机上运行的。
我的虚拟机网络设置为 NAT。
问题
当我启动虚拟机时,我可以访问互联网大约 10 秒。
跑步ifconfig
节目
# ifconfig
enp0s3 Link encap:Ethernet HWaddr 08:00:27:CA:F6:EC
inet6 addr: fe80::a00:27ff:feca:f6ec/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7 errors:0 dropped:0 overruns:0 frame:0
TX packets:66 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1668 (1.6 Kb) TX bytes:11704 (11.4 Kb)
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:34 errors:0 dropped:0 overruns:0 frame:0
TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1700 (1.6 Kb) TX bytes:1700 (1.6 Kb)
大约10秒后显示
# ifconfig
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:34 errors:0 dropped:0 overruns:0 frame:0
TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1700 (1.6 Kb) TX bytes:1700 (1.6 Kb)
于是我检查了一下/var/log/messages
,发现它已经被杀了。
以下是我认为相关的内容/var/log/messages
:
2014-07-24T19:07:32.911997+01:00 linux-iqb5 avahi-autoipd(enp0s3)[4043]: Found user 'avahi-autoipd' (UID 499) and group 'avahi-autoipd' (GID 498).
2014-07-24T19:07:32.917851+01:00 linux-iqb5 avahi-autoipd(enp0s3)[4043]: Successfully called chroot().
2014-07-24T19:07:32.919814+01:00 linux-iqb5 avahi-autoipd(enp0s3)[4043]: Successfully dropped root privileges.
2014-07-24T19:07:32.921004+01:00 linux-iqb5 avahi-autoipd(enp0s3)[4043]: Starting with address 169.254.12.33
2014-07-24T19:07:32.925894+01:00 linux-iqb5 avahi-autoipd(enp0s3)[4043]: Routable address already assigned, sleeping.
2014-07-24T19:07:33.007838+01:00 linux-iqb5 network[3444]: Shutting down network interfaces:
2014-07-24T19:07:33.353730+01:00 linux-iqb5 systemd[1]: Stopping ifup managed network interface enp0s3...
2014-07-24T19:07:33.691423+01:00 linux-iqb5 ifdown[4098]: enp0s3 device: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
2014-07-24T19:07:33.703182+01:00 linux-iqb5 ifdown[4098]: enp0s3 device: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
2014-07-24T19:07:33.778217+01:00 linux-iqb5 avahi-autoipd(enp0s3)[4043]: Got SIGTERM, quitting.
2014-07-24T19:07:34.044757+01:00 linux-iqb5 dhcpcd[4175]: enp0s3: sending signal 15 to pid 1418
2014-07-24T19:07:34.046056+01:00 linux-iqb5 dhcpcd[4175]: enp0s3: exiting
2014-07-24T19:07:35.533803+01:00 linux-iqb5 dhcpcd[1418]: enp0s3: exiting
2014-07-24T19:07:35.536473+01:00 linux-iqb5 dhcpcd[4219]: enp0s3: received SIGTERM, stopping
2014-07-24T19:07:35.538001+01:00 linux-iqb5 dhcpcd[4219]: enp0s3: removing default route via 10.0.2.2 metric 0
2014-07-24T19:07:35.540269+01:00 linux-iqb5 dhcpcd[4219]: enp0s3: removing IP address 10.0.2.15/24
2014-07-24T19:07:35.542169+01:00 linux-iqb5 avahi-daemon[509]: Withdrawing address record for 10.0.2.15 on enp0s3.
2014-07-24T19:07:35.543660+01:00 linux-iqb5 avahi-daemon[509]: Leaving mDNS multicast group on interface enp0s3.IPv4 with address 10.0.2.15.
2014-07-24T19:07:35.545181+01:00 linux-iqb5 avahi-daemon[509]: Interface enp0s3.IPv4 no longer relevant for mDNS.
2014-07-24T19:07:36.399152+01:00 linux-iqb5 dhcpcd[4219]: enp0s3: exiting
2014-07-24T19:07:36.974262+01:00 linux-iqb5 avahi-daemon[509]: Interface enp0s3.IPv6 no longer relevant for mDNS.
2014-07-24T19:07:36.975258+01:00 linux-iqb5 avahi-daemon[509]: Leaving mDNS multicast group on interface enp0s3.IPv6 with address fe80::a00:27ff:feca:f6ec.
2014-07-24T19:07:36.976375+01:00 linux-iqb5 avahi-daemon[509]: Withdrawing address record for fe80::a00:27ff:feca:f6ec on enp0s3.
有人知道为什么会发生这种情况吗?
或者最好有解决方案?
另外,如果您需要更多信息,请告诉我您需要什么,我会尽力找到它。
/var/log/messages
这是我尝试重新启动网络服务时遇到的情况。
希望这能提供一些有用的信息。/etc/init.d/network start
仅使用redirecting to "systemctl start network.service"
命令行输出重新启动
2014-07-24T20:36:46.875361+01:00 linux-iqb5 ifup[5635]: Starting DHCP4+DHCP6 client on enp0s3. . . . . . . .
2014-07-24T20:36:46.912559+01:00 linux-iqb5 ifup-dhcp[5722]:
2014-07-24T20:36:46.928787+01:00 linux-iqb5 ifup[5635]: enp0s3 IP address: 10.0.2.15/24
2014-07-24T20:36:46.938725+01:00 linux-iqb5 ifup-dhcp[5722]: enp0s3 IP address: 10.0.2.15/24
2014-07-24T20:36:46.946793+01:00 linux-iqb5 ifup[5635]: enp0s3 DHCP6 continues in background
2014-07-24T20:36:46.956573+01:00 linux-iqb5 ifup-dhcp[5722]: enp0s3 DHCP6 continues in background
2014-07-24T20:36:47.180511+01:00 linux-iqb5 systemd[1]: Started ifup managed network interface enp0s3.
2014-07-24T20:36:47.287777+01:00 linux-iqb5 network[5216]: ..done..done enp0s8 Startmode is 'manual' -> skipping
2014-07-24T20:36:47.297576+01:00 linux-iqb5 ifup[7472]: enp0s8 Startmode is 'manual' -> skipping
2014-07-24T20:36:47.369663+01:00 linux-iqb5 network[5216]: ..skippedSetting up service network . . . . . . . . . . . . ...done
2014-07-24T20:36:49.221664+01:00 linux-iqb5 network[7499]: Shutting down network interfaces:
2014-07-24T20:36:49.385756+01:00 linux-iqb5 systemd[1]: Stopping ifup managed network interface enp0s3...
2014-07-24T20:36:49.688419+01:00 linux-iqb5 ifdown[7816]: enp0s3 device: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
2014-07-24T20:36:49.698333+01:00 linux-iqb5 ifdown[7816]: enp0s3 device: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)
2014-07-24T20:36:49.765709+01:00 linux-iqb5 avahi-autoipd(enp0s3)[6435]: Got SIGTERM, quitting.
2014-07-24T20:36:49.987453+01:00 linux-iqb5 dhcpcd[7892]: enp0s3: sending signal 15 to pid 6591
2014-07-24T20:36:49.991505+01:00 linux-iqb5 dhcpcd[6591]: enp0s3: received SIGTERM, stopping
2014-07-24T20:36:49.992507+01:00 linux-iqb5 dhcpcd[6591]: enp0s3: removing default route via 10.0.2.2 metric 0
2014-07-24T20:36:49.994813+01:00 linux-iqb5 dhcpcd[6591]: enp0s3: removing IP address 10.0.2.15/24
2014-07-24T20:36:49.996912+01:00 linux-iqb5 avahi-daemon[509]: Withdrawing address record for 10.0.2.15 on enp0s3.
2014-07-24T20:36:50.002594+01:00 linux-iqb5 avahi-daemon[509]: Leaving mDNS multicast group on interface enp0s3.IPv4 with address 10.0.2.15.
2014-07-24T20:36:50.006327+01:00 linux-iqb5 avahi-daemon[509]: Interface enp0s3.IPv4 no longer relevant for mDNS.
2014-07-24T20:36:50.007898+01:00 linux-iqb5 dhcpcd[7892]: enp0s3: exiting
2014-07-24T20:36:50.953700+01:00 linux-iqb5 dhcpcd[6591]: enp0s3: exiting
2014-07-24T20:36:52.299847+01:00 linux-iqb5 avahi-daemon[509]: Interface enp0s3.IPv6 no longer relevant for mDNS.
2014-07-24T20:36:52.307888+01:00 linux-iqb5 avahi-daemon[509]: Leaving mDNS multicast group on interface enp0s3.IPv6 with address fe80::a00:27ff:feca:f6ec.
2014-07-24T20:36:52.323000+01:00 linux-iqb5 avahi-daemon[509]: Withdrawing address record for fe80::a00:27ff:feca:f6ec on enp0s3.
2014-07-24T20:36:52.531144+01:00 linux-iqb5 systemd[1]: Stopped ifup managed network interface enp0s3.
2014-07-24T20:36:52.676351+01:00 linux-iqb5 systemd[1]: Stopped ifup managed network interface enp0s8.
2014-07-24T20:36:54.450619+01:00 linux-iqb5 network[7499]: ..done..doneShutting down service network . . . . . . . . . . . ...done
内容ifcfg-enp0s3
BOOTPROTO='dhcp'
BROADCAST=''
ETHTOOL_OPTIONS=''
IPADDR=''
MTU=''
NAME='82540EM Gigabit Ethernet Controller'
NETMASK=''
NETWORK=''
REMOTE_IPADDR=''
STARTMODE='auto'
USERCONTROL='no'
答案1
我在虚拟机上全新安装 opensuse 13.1 32 位时也出现了相同的症状。对我来说,解决方案是:
编辑 /usr/lib/systemd/system/network.service 并Type=oneshot
在 [Service] 部分中设置Type=forking
,而不是按照建议设置这里