Rapid technological advancement in wireless sensor networks has contributed for the great increase in number of IP-connected smaller smart sensors that, in turn, become part of the Internet of Things (IoT). Efficient utilization of the IoT for Machine-to-Machine (M2M) communication requires security. The IETF 6L0WPAN standard provides the mechanism for IPv6 packet transmission over low-power wireless personal area networks. Thus, the interconnection of wireless sensor devices to the Internet facilitates the M2M communication with many application areas such as smart grid, metering, health, environment, vehicle and home appliances. M2M communication over the 6L0WPAN has security challenges as a result of the greater number of 61owpan devices, smaller packet transmission, low power, low processing and various application areas. In order to secure the subsequent M2M communication over the 6L0WPAN, secure authentication and session key exchange schemes among the communicating parties are needed. Therefore, in this paper we propose SAKES - a secure authentication and key establishment scheme - for the M2M communication in the 6L0WPAN. The security analysis is done for different attack scenarios. The impact of DoS attack in the performance of the 6L0WPAN is evaluated. The evaluation is carried out by using OPNET simulation tool. Our simulation result showed the severity of DoS attack and the necessity of the proposed security scheme so as to maintain the constrained resources.