Machine-to-Machine (M2M) traffic is growing fast on the Internet, this trend is manifested in the congestion of networks at different levels. The edge cloud unit is used for reducing number of intermediate nodes involved in the communication process and for offloading. The offloading can be seen as three parts. The first is the base station (BS) offloading, as the cloud unit helps the BS in some tasks related to call imitation such as resource allocations. The second is the workload passed from sensor nodes which represents the M2M traffic offloading and the third part is the cellular data offloading. In this paper, we propose an algorithm for offloading the core network using mobile edge computing, which allow devices to exchange traffic with the nearest mobile edge computing for improving QoS and offload channels in the core of the network. © Springer Nature Switzerland AG 2018.