Automatic internet port identification method and device for performing the method
An automatic internet port identification method executed after being loaded by a system, includes a step 1: sending DHCP Discovery, PPPoE PADI, and RS packets to multiple ports of a physical network by a router, and a step 2 : monitoring the ports and identifying the port that first receives one of DHCP ACK, PPPoE PADO, or RA packets as a WAN port, the remaining ports being identified as LAN ports. The method automatically identifies WAN ports with both IPv4 and IPv6 internet connection capabilities. By sending specific packets and continuously monitoring the response packets from each port, the identified results are applied to all ports. This allows users to connect ISP and other users' equipment based solely on connection speed without needing to consider the type of port. The method automatically determines the port connected to the ISP as WAN, with the remaining ports as LAN.
1 . An automatic internet port identification method for execution by a system, comprising:
by a router, concurrently sending initialization packets to each port of a plurality of ports of a physical network, the initialization packets to each port of the plurality of ports including at least one DHCP Discovery packet, at least one PPPoE PADI packet, and at least one RS (Router Solicitation) packet;
monitoring the plurality of ports for receipt of a response packet, the response packet being one of a DHCP ACK packet, a PPPoE PADO (PPPoE Active Discovery Offer) packet, or a RA (Router Advertisement) packet;
identifying a port, out of the plurality of ports, to first receive the response packet, as a WAN (Wide Area Network) port; and
identifying each remaining port of the plurality of ports as a LAN (Local Area Network) port.
2 . The automatic internet identification method as claimed in claim 1 , wherein a Router Lifetime tag of a RA (Router Advertisement) that monitors the ports is greater than 0.
3 . The automatic internet identification method as claimed in claim 1 , wherein the WAN port is identified as a WAN configured for IPv6 internet protocol responsive to the received response packet being an RA packet.
4 . An automatic internet identification method of a router for execution by a system, comprising verifying a WAN configuration of a router by:
by the router, selectively sending at least one initialization packet corresponding to a pre-configured WAN protocol to at least one port of a plurality of ports of a physical network, wherein the initialization packet corresponding to a DHCP protocol is a DHCP Discovery or DHCP Request packet, the initialization packet corresponding to a PPPoE protocol is a PPPoE PADI packet, and the initialization packet corresponding to a Static IP protocol is an ARP Request (Address Resolution Protocol Request) packet;
monitoring the plurality of ports for receipt of a response packet corresponding to the sent initialization packet, wherein the response packet corresponding to the DHCP Discovery or DHCP Request packet is a DHCP ACK packet, the response packet corresponding to the PPPoE PADI packet is a PPPoE PADO packet, and the response packet corresponding to the ARP Request packet is an ARP Reply packet;
identifying a port, out of the plurality of ports, to first receive the corresponding response packet, as a WAN (Wide Area Network) port; and
identifying each remaining port of the plurality of ports as a LAN (Local Area Network) port.
5 . The automatic internet port identification method as claimed in claim 4 , wherein the pre-configured WAN protocol is DHCP or Static IP, the method further comprising:
responsive to lack of receipt of the corresponding response packet within a predetermined time period, sending at least one solicitation packet to at least one of the plurality of ports, the at least one solicitation packet being one of an RS (Router Solicitation) packet or an NS (Neighbor Solicitation) packet; and
monitoring the plurality of ports for receipt of a solicitation response packet, the solicitation response packet being one of a RA (Router Advertisement) packet or a NA (Neighbor Advertisement) response packet,
wherein the port, out of the plurality of ports, to first receive the solicitation response packet is identified as a IPv6 WAN port.
6 . The automatic internet port identification method as claimed in claim 5 ,
wherein the pre-configured WAN protocol is IPV6 and Static IP, the solicitation packet is an NS packet and is directly sent to a default gateway port, and the solicitation response packet is an NA response packet.
7 . The automatic internet port identification method as claimed in claim 4 ,
wherein the pre-configured WAN protocol is IPv4 and Static IP, the sent initialization packet is an ARP Request packet and is directly sent to a default gateway port, and the response packet is an ARP Reply packet, and
wherein, responsive to receipt of the response packet by the default gateway port within a predetermined time period, the default gateway port is identified as an IPV4 WAN port.
8 . The automatic internet port identification method as claimed in claim 4 ,
wherein the pre-configured WAN protocol is DHCP or Static IP and is not an IPV6 protocol, and
wherein, responsive to lack of receipt of the response packet within a predetermined time period, each port of the plurality of ports is identified as a LAN port.
9 . The automatic internet port identification method as claimed in claim 4 ,
wherein the pre-configured WAN protocol is IPV4 and Static IP, the sent initialization packet is an ARP Request packet response, and the response packet is an ARP Reply packet, the method further comprising:
responsive to lack of receipt of the corresponding response packet within a predetermined time period, sending at least one solicitation packet to at least one of the plurality of ports, the at least one solicitation packet being one of an RS packet or an NS packet.
10 . The automatic internet port identification method as claimed in claim 9 , further comprising:
monitoring the plurality of ports for receipt of a solicitation response packet, the solicitation response packet being one of a RA (Router Advertisement) packet or a NA (Neighbor Advertisement) response packet,
wherein, responsive to lack of receipt of the solicitation response packet within a predetermined time period, each port of the plurality of ports is identified as a LAN port.
11 . An automatic internet port identification device, comprising:
a processor and at least one storage device, the at least one storage device storing at least one instruction executable by the processor to implement an automatic internet port identification method for an un-configured router, the automatic internet port identification method comprising:
by the router, sending initialization packets to each port of a plurality of ports of a physical network, the initialization packets to each port of the plurality of ports including at least one DHCP Discovery packet, at least one PPPoE PADI packet, and at least one RS (Router Solicitation) packet;
monitoring the plurality of ports for receipt of a response packet, the response packet being one of a DHCP ACK packet, a PPPoE PADO (PPPoE Active Discovery Offer) packet, or a RA (Router Advertisement) packet;
identifying a port, out of the plurality of ports, to first receive the response packet as a WAN (Wide Area Network) port; and
identifying each remaining port of the plurality of ports as a LAN (Local Area Network) port.
12 . The automatic internet port identification device as claimed in claim 11 , wherein the at least one storage device further stores at least one second instruction executable by the processor to implement a second automatic internet port identification method for a configured router, the second automatic internet port identification method comprising verifying a WAN configuration of the router by:
by the router, selectively sending at least one initialization packet corresponding to a pre-configured WAN protocol to at least one port of the plurality of ports of the physical network, wherein the initialization packet corresponding to a DHCP protocol is the DHCP Discovery packet or a DHCP Request packet, the initialization packet corresponding to a PPPoE protocol is the PPPoE PADI packet, and the initialization packet corresponding to a Static IP protocol is an ARP Request (Address Resolution Protocol Request) packet;
monitoring the plurality of ports for receipt of a response packet corresponding to the sent initialization packet, wherein the response packet corresponding to the DHCP Discovery or DHCP Request packet is the DHCP ACK packet, the response packet corresponding to the PPPoE PADI packet is the PPPoE PADO packet, and the response packet corresponding to the ARP Request packet is an ARP Reply packet;
identifying a port, out of the plurality of ports, to first receive the corresponding response packet as the WAN (Wide Area Network) port; and
identifying each remaining port of the plurality of ports as a LAN (Local Area Network) port.