A network device for handling a packet tunnel, the network device comprising: a core layer of a network device performing a routing process that is determining a transmission path of a packet and a tunneling process that is building a tunnel for a received packet according to a routing table, when a routing is operated in a wireless network, a receiving module, for receiving a packet from an input port; a query module, coupled to the receiving module, for querying a mapping table according to the input port and a header of the packet, to generate a query result; a processing module, coupled to the query module, for performing instructions of: determining a transformed header and an output port according to the querying result, wherein the instruction of determining the transformed header and the output port according to the querying result comprising: a tunnel message comprising the transformed header and the output port, when the querying result indicates that the mapping table comprises the tunnel message comprising the input port and the header; and determining the transformed header and the output port according to the input port and the header, and generating the tunnel message and storing the tunnel message in the mapping table according to the routing table of the core layer and tunnel information, when the querying result indicates that the mapping table does not comprise the tunnel message comprising the input port and the header; and replacing the header with the transformed header, to generate a transformed packet; and a transmitting module, coupled to the processing module, for transmitting the transformed packet via the output port. a core layer of a network device performing a routing process that is determining a transmission path of a packet and a tunneling process that is building a tunnel for a received packet according to a routing table, when a routing is operated in a wireless network, a receiving module, for receiving a packet from an input port; a query module, coupled to the receiving module, for querying a mapping table according to the input port and a header of the packet, to generate a query result; a processing module, coupled to the query module, for performing instructions of: determining a transformed header and an output port according to the querying result, wherein the instruction of determining the transformed header and the output port according to the querying result comprising: a tunnel message comprising the transformed header and the output port, when the querying result indicates that the mapping table comprises the tunnel message comprising the input port and the header; and determining the transformed header and the output port according to the input port and the header, and generating the tunnel message and storing the tunnel message in the mapping table according to the routing table of the core layer and tunnel information, when the querying result indicates that the mapping table does not comprise the tunnel message comprising the input port and the header; and replacing the header with the transformed header, to generate a transformed packet; and a transmitting module, coupled to the processing module, for transmitting the transformed packet via the output port. determining a transformed header and an output port according to the querying result, wherein the instruction of determining the transformed header and the output port according to the querying result comprising: a tunnel message comprising the transformed header and the output port, when the querying result indicates that the mapping table comprises the tunnel message comprising the input port and the header; and determining the transformed header and the output port according to the input port and the header, and generating the tunnel message and storing the tunnel message in the mapping table according to the routing table of the core layer and tunnel information, when the querying result indicates that the mapping table does not comprise the tunnel message comprising the input port and the header; and a tunnel message comprising the transformed header and the output port, when the querying result indicates that the mapping table comprises the tunnel message comprising the input port and the header; and determining the transformed header and the output port according to the input port and the header, and generating the tunnel message and storing the tunnel message in the mapping table according to the routing table of the core layer and tunnel information, when the querying result indicates that the mapping table does not comprise the tunnel message comprising the input port and the header; and replacing the header with the transformed header, to generate a transformed packet; and a transmitting module, coupled to the processing module, for transmitting the transformed packet via the output port.