![重启后无互联网连接](https://linux22.com/image/83961/%E9%87%8D%E5%90%AF%E5%90%8E%E6%97%A0%E4%BA%92%E8%81%94%E7%BD%91%E8%BF%9E%E6%8E%A5.png)
我重新启动了我的虚拟服务器 (Debian 8),但它没有恢复。好吧,我在我的服务器上使用了救援控制台,服务器似乎运行良好,除了网络坏了。所以我尝试了“ifconfig”,但没有出现任何结果。因此,我尝试使用“ip link set dev venet0 up”和“ifup venet0:0”启用我的接口,现在它出现在我的 ifconfig 列表中:
root@i67svof:/# ifconfig
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:65 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5008 (4.8 KiB) TX bytes:0 (0.0 B)
venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:MYIPV4ADDR P-t-P:addr:MYIPV4ADDR Bcast:addr:MYIPV4ADDR Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
我的 HWaddr 看起来不太好:) 'ip addr' 打印这个结果:
root@i67svof:/# ip addr
1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/void
inet MYIPV4ADDR/32 brd MYIPV4ADDR scope global venet0:0
这些是 /var/log/syslog 中的最后几行:
root@i67svof:/var/www# tail /var/log/syslog
Feb 20 11:34:16 i67svof systemd[1]: Stopping memcached daemon...
Feb 20 11:34:16 i67svof systemd[1]: Stopping Network Name Resolution...
Feb 20 11:34:16 i67svof systemd[1]: Stopping Regular background program processing daemon...
Feb 20 11:34:16 i67svof systemd[1]: Stopping Login Prompts.
Feb 20 11:34:16 i67svof systemd[1]: Stopped target Login Prompts.
Feb 20 11:34:16 i67svof rsyslogd: [origin software="rsyslogd" swVersion="8.4.2" x-pid="22100" x-info="http://www.rsyslog.com"] exiting on signal 15.
Feb 20 12:17:12 i67svof rsyslogd: [origin software="rsyslogd" swVersion="8.4.2" x-pid="129" x-info="http://www.rsyslog.com"] start
Feb 20 12:17:32 i67svof postmulti[222]: warning: /etc/postfix/main.cf, line 18: overriding earlier entry: myorigin=/etc/mailname
Feb 20 12:17:32 i67svof postmulti[222]: fatal: could not find any active network interfaces
Feb 20 12:17:34 i67svof rsyslogd: [origin software="rsyslogd" swVersion="8.4.2" x-pid="129" x-info="http://www.rsyslog.com"] exiting on signal 15.
最后是 /etc/network/interfaces 中的网络配置
# Auto generated lo interface
auto lo
iface lo inet loopback
# Auto generated venet0 interface
auto venet0
iface venet0 inet manual
up ifconfig venet0 up
up ifconfig venet0 127.0.0.2
up route add default dev venet0
down route del default dev venet0
down ifconfig venet0 down
iface venet0 inet6 manual
up ifconfig venet0 add MYIPV6ADDR/64
down ifconfig venet0 del MYIPV6ADDR/64
up route -A inet6 add default dev venet0
down route -A inet6 del default dev venet0
auto venet0:0
iface venet0:0 inet static
address MYIPV4ADDR
netmask 255.255.255.255
谁能帮我解决这个问题吗?提前致谢!
答案1
在设置网络接口之前尝试将其关闭。例如,在 AlpineLinux 中,可以通过将这些行添加到以下内容来完成/etc/init.d/networking
:
for iface in $(find_ifaces); do
ifdown $iface > /dev/null 2>&1
done