我的VPS无法登陆了(应该是从16号的12:41到今天17号10:12)。从ssh无法登陆,上面的blog也访问不了。通过后台console检查,发现sshd服务和nginx服务都是正常的。尝试关闭iptables服务,结果也是一样,还是无法登陆。
检查/var/log/messages,发现有关于dhcp的报错:
[root@vultr log]# cat messages
Oct 16 04:02:01 vultr rsyslogd: [origin software="rsyslogd" swVersion="5.8.10" x-pid="1060" x-info="http://www.rsyslog.com"] rsyslogd was HUPed
Oct 16 12:41:07 vultr dhclient[995]: DHCPREQUEST on eth0 to 169.254.169.254 port 67 (xid=0x78f0325a)
Oct 16 12:41:07 vultr dhclient[995]: DHCPACK from 169.254.169.254 (xid=0x78f0325a)
Oct 16 12:41:09 vultr dhclient[995]: bound to 45.76.193.249 -- renewal in 35909 seconds.
Oct 16 18:18:52 vultr ntpd[1557]: 0.0.0.0 0618 08 no_sys_peer
Oct 16 22:39:38 vultr dhclient[995]: DHCPREQUEST on eth0 to 169.254.169.254 port 67 (xid=0x78f0325a)
Oct 16 22:39:43 vultr dhclient[995]: DHCPREQUEST on eth0 to 169.254.169.254 port 67 (xid=0x78f0325a)
Oct 16 22:39:51 vultr dhclient[995]: DHCPREQUEST on eth0 to 169.254.169.254 port 67 (xid=0x78f0325a)
Oct 16 22:40:05 vultr dhclient[995]: DHCPREQUEST on eth0 to 169.254.169.254 port 67 (xid=0x78f0325a)
Oct 16 22:40:20 vultr dhclient[995]: DHCPREQUEST on eth0 to 169.254.169.254 port 67 (xid=0x78f0325a)
Oct 16 22:40:33 vultr dhclient[995]: DHCPREQUEST on eth0 to 169.254.169.254 port 67 (xid=0x78f0325a)
Oct 16 22:40:47 vultr dhclient[995]: DHCPREQUEST on eth0 to 169.254.169.254 port 67 (xid=0x78f0325a)
Oct 16 22:40:59 vultr dhclient[995]: DHCPREQUEST on eth0 to 169.254.169.254 port 67 (xid=0x78f0325a)
Oct 16 22:41:11 vultr dhclient[995]: DHCPREQUEST on eth0 to 169.254.169.254 port 67 (xid=0x78f0325a)
Oct 16 22:41:23 vultr dhclient[995]: DHCPREQUEST on eth0 to 169.254.169.254 port 67 (xid=0x78f0325a)
Oct 16 22:41:44 vultr dhclient[995]: DHCPREQUEST on eth0 to 169.254.169.254 port 67 (xid=0x78f0325a)
Oct 16 22:42:05 vultr dhclient[995]: DHCPREQUEST on eth0 to 169.254.169.254 port 67 (xid=0x78f0325a)
……
Oct 17 10:10:07 vultr dhclient[995]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x78f0325a)
Oct 17 10:10:26 vultr dhclient[995]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x78f0325a)
Oct 17 10:10:43 vultr dhclient[995]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x78f0325a)
Oct 17 10:11:04 vultr dhclient[995]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x78f0325a)
Oct 17 10:11:17 vultr dhclient[995]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x78f0325a)
Oct 17 10:11:32 vultr dhclient[995]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x78f0325a)
Oct 17 10:11:44 vultr dhclient[995]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x78f0325a)
Oct 17 10:11:57 vultr dhclient[995]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x78f0325a)
Oct 17 10:12:16 vultr dhclient[995]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x78f0325a)
Oct 17 10:12:29 vultr dhclient[995]: DHCPREQUEST on eth0 to 255.255.255.255 port 67 (xid=0x78f0325a)
开了case给后台,后台回复说:
Andres Fernandez 2016-10-16 22:04:52
Hello,
Thank you for contacting us.
Please try setting your OS’s network interface configuration for static IP assignments in this case. The blue “network configuration examples” link on the “Settings” tab includes the necessary file paths and configurations. This configuration change can be made via the provided web console.
Setting your instance’s IP to static will prevent any issues that your chosen OS might have with DHCP lease failure. Any instance with additional IPs or private networking enabled will require static addresses on all interfaces as well.
Andres Fernandez
System administrator
Lloyd Slade 2016-10-16 22:32:32 Hello,
We are aware of a bug with certain distributions of Linux that causes DHCP leases to fail in a virtualised environment such as ours. Until a fix is available, we recommend setting a static configuration.
Lloyd W. Slade
System Administrator
可以看到,在虚拟化的环境中,有些linux的版本因为bug,会导致dhcp续租失败。所以任何外部连接都无法连到我的host上了。
解决方法:
采用静态IP,不采用dhcp:
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=12.34.567.890
NETMASK=255.255.254.0
GATEWAY=98.76.543.1
DNS1=111.22.33.44
/etc/sysconfig/network-scripts/route-eth0
666.777.0.0/16 dev eth0