[go: up one dir, main page]

CN114095476B - Method for inquiring router interface by electronic equipment, router and communication system - Google Patents

Method for inquiring router interface by electronic equipment, router and communication system Download PDF

Info

Publication number
CN114095476B
CN114095476B CN202010633237.9A CN202010633237A CN114095476B CN 114095476 B CN114095476 B CN 114095476B CN 202010633237 A CN202010633237 A CN 202010633237A CN 114095476 B CN114095476 B CN 114095476B
Authority
CN
China
Prior art keywords
interface
router
electronic device
target
physical interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010633237.9A
Other languages
Chinese (zh)
Other versions
CN114095476A (en
Inventor
张阔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202010633237.9A priority Critical patent/CN114095476B/en
Publication of CN114095476A publication Critical patent/CN114095476A/en
Application granted granted Critical
Publication of CN114095476B publication Critical patent/CN114095476B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/11Allocation or use of connection identifiers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/20Manipulation of established connections
    • H04W76/25Maintenance of established connections

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application relates to the technical field of communication, and discloses a method for inquiring a router interface of electronic equipment, a method for determining a router interface connected with the electronic equipment by a router, the router and a communication system. Even if cables of a plurality of clients connected to the router interface are interwoven, a user can quickly find a target physical interface connected to the client according to the position of the target physical interface indicated by the router on the router. When a user needs to remove a certain client, the router is correspondingly searched directly based on the indicated position of the target physical interface, and the interface connected with the client is operated. Other clients are not disconnected with the router, and the user experience is improved.

Description

电子设备查询路由器接口的方法、路由器及通信系统Method for querying router interface by electronic equipment, router and communication system

技术领域technical field

本申请涉及通信技术领域,尤其涉及一种电子设备查询路由器接口的方法、路由器确定与电子设备连接的路由器接口的方法、路由器及通信系统。The present application relates to the field of communication technologies, and in particular to a method for an electronic device to query a router interface, a method for a router to determine a router interface connected to an electronic device, a router and a communication system.

背景技术Background technique

路由器是连接因特网中各局域网、广域网的设备,它会根据信道的情况自动选择和设定路由,以最佳路径,按前后顺序发送信号。路由器主要的接口有局域网接口、广域网接口和路由器配置接口。局域网接口类型有以太网、快速以太网、千兆以太网、万兆以太网M等标准网络接口。在每种网络中,又可以支持不同介质标准的接口,如RJ-45接口、光纤接口、粗同轴电缆接口等。广域网接口有同步串行接口、异步串行接口。配置接口有控制接口Console,控制接口Console通常是用来当对路由器进行基本配置时使用专用连接线将该接口与计算机相连接。A router is a device connected to various LANs and WANs in the Internet. It will automatically select and set routes according to the channel conditions, and send signals in the order of the best path. The main interfaces of the router include LAN interface, WAN interface and router configuration interface. LAN interface types include standard network interfaces such as Ethernet, Fast Ethernet, Gigabit Ethernet, and 10 Gigabit Ethernet. In each network, it can support interfaces of different media standards, such as RJ-45 interface, optical fiber interface, thick coaxial cable interface, etc. The WAN interface includes a synchronous serial interface and an asynchronous serial interface. The configuration interface has a control interface Console, and the control interface Console is usually used to connect the interface with a computer using a dedicated connection line when performing basic configuration on the router.

因路由器具有很多的端口,多个计算机与路由器的端口之间通过线缆连接。对于路由器而言,其可以绑定与其连接的计算机的MAC地址和其为计算机分配的IP地址。通过绑定计算机的MAC地址和IP地址为与其连接的计算机提供连接其的总的计算机数量和计算机的参数(如计算机的MAC地址和IP地址)。用户可以通过当路由器的端口连接更多的计算机,相应会增加线缆的数量。当计算机距离路由器过远时,也需相应增加线缆的长度。当用户需要移除某一计算机时,由于连接路由器的线缆过多或过长,会导致用户很难准确找到连接该计算机的路由器的物理接口。也就无法针对该计算机连接的物理接口进行操作。在用户查找与该计算机连接的端口时,很容易导致其他计算机与路由器直接被断开,影响用户体验。Because the router has many ports, multiple computers are connected to the ports of the router by cables. For a router, it can bind the MAC address of the computer connected to it and the IP address it assigns to the computer. By binding the MAC address and IP address of the computer, provide the computer connected to it with the total number of computers connected to it and the parameters of the computer (such as the MAC address and IP address of the computer). Users can connect more computers through the port of the router, which will increase the number of cables accordingly. When the computer is too far away from the router, the length of the cable needs to be increased accordingly. When a user needs to remove a certain computer, it is difficult for the user to accurately find the physical interface of the router connected to the computer due to too many or too long cables connected to the router. It is also impossible to operate on the physical interface to which the computer is connected. When the user searches for the port connected to the computer, it is easy to directly disconnect other computers from the router, which affects the user experience.

发明内容Contents of the invention

本发明的目的在于提供一种电子设备查询路由器接口的方法、路由器确定与电子设备连接的路由器接口的方法、路由器及通信系统,便于用户查找与该计算机连接的端口,避免了其他计算机与路由器断开,提升了用户体验感。The purpose of the present invention is to provide a method for an electronic device to query the router interface, a method for the router to determine the router interface connected to the electronic device, a router and a communication system, which are convenient for the user to find the port connected to the computer, and avoid disconnection between other computers and the router. Open, improve the user experience.

第一方面,本申请实施例公开了一种电子设备查询路由器接口的方法,路由器连接有至少一个电子设备,并为各电子设备分配IP地址。In the first aspect, the embodiment of the present application discloses a method for an electronic device to query an interface of a router. The router is connected to at least one electronic device and assigns an IP address to each electronic device.

至少一个电子设备中的第一电子设备向路由器发送接口查询请求,接口查询请求至少用于向路由器查询至少一个电子设备中的以有线方式与路由器连接的目标电子设备所连接的路由器的物理接口的位置。The first electronic device in the at least one electronic device sends an interface query request to the router, and the interface query request is at least used to query the router for the physical interface of the router connected to the target electronic device connected to the router in a wired manner among the at least one electronic device Location.

对于第一电子设备而言,其可以为具有管理员权限的电子设备,也可以作为目标电子设备。具有管理员权限的第一电子设备可以请求路由器查询连接于路由器上的任意一个或多个目标电子设备的物理接口信息。作为连接于路由器的物理接口的目标电子设备的第一电子设备可以请求路由器查询其自身的物理接口信息。As for the first electronic device, it may be an electronic device with administrator authority, or may be a target electronic device. The first electronic device with administrator authority may request the router to query the physical interface information of any one or more target electronic devices connected to the router. The first electronic device, which is a target electronic device connected to the physical interface of the router, may request the router to inquire about its own physical interface information.

路由器根据接口查询请求,确定与目标电子设备的IP地址关联的目标虚拟接口,并且路由器根据预设的虚拟接口与物理接口的映射关系确定与目标虚拟接口对应的目标物理接口。The router determines the target virtual interface associated with the IP address of the target electronic device according to the interface query request, and the router determines the target physical interface corresponding to the target virtual interface according to the preset mapping relationship between the virtual interface and the physical interface.

对于虚拟接口和物理接口的映射具体是:路由器识别当前电子设备的IP请求从哪个虚拟接口上报,然后由路由器将IP请求中携带的MAC地址与该虚拟接口(作为目标虚拟接口)绑定。或者由接口管理模块将DHCP服务器分配的IP地址与该虚拟接口绑定。或者由路由器将IP请求中携带的MAC地址和DHCP服务器分配的IP地址均与该虚拟接口绑定。如此,虚拟接口的虚拟接口参数包含但不限于与该目标虚拟接口绑定的目标物理接口的物理接口信息、IP请求中携带的电子设备的MAC地址和DHCP服务器分配的IP地址。The mapping between the virtual interface and the physical interface is specifically: the router identifies the virtual interface from which the IP request of the current electronic device is reported, and then the router binds the MAC address carried in the IP request to the virtual interface (as the target virtual interface). Or the interface management module binds the IP address assigned by the DHCP server to the virtual interface. Alternatively, the router binds both the MAC address carried in the IP request and the IP address assigned by the DHCP server to the virtual interface. In this way, the virtual interface parameters of the virtual interface include, but are not limited to, the physical interface information of the target physical interface bound to the target virtual interface, the MAC address of the electronic device carried in the IP request, and the IP address assigned by the DHCP server.

路由器将目标物理接口关联的物理接口信息发送至第一电子设备,物理接口信息至少指示目标电子设备在路由器上的物理接口的位置。The router sends physical interface information associated with the target physical interface to the first electronic device, where the physical interface information at least indicates the location of the physical interface of the target electronic device on the router.

第一电子设备可以在显示屏上以图片形式显示该物理接口信息,也可以通过电子设备播放该物理接口信息。从而便于用户查找目标电子设备的具体的物理接口。The first electronic device may display the physical interface information in the form of a picture on the display screen, or play the physical interface information through the electronic device. Thus, it is convenient for the user to find the specific physical interface of the target electronic device.

物理接口信息包括目标电子设备的接口标识(如接口编号、类型和功能参数等)、目标电子设备的目标物理接口在路由器上的位置(接口示意图)的图片等。The physical interface information includes the interface identification (such as interface number, type and function parameters, etc.) of the target electronic device, a picture of the position (schematic diagram of the interface) of the target physical interface of the target electronic device on the router, and the like.

本申请实施例第一方面公开的一种电子设备查询路由器接口的方法,路由器能为连接至路由器的目标物理接口的客户机提供该目标物理接口在路由器上的位置。即使连接至路由器接口的多个客户机的线缆交织在一起,用户可以根据路由器指示的目标物理接口在路由器上的位置很快的查找到该客户机所连接的目标物理接口。当用户需要移除某一客户机时,直接基于指示的目标物理接口的位置在路由器上对应查找,并对该客户机所连接的接口进行操作。也不会造成其余的客户机与路由器断开,提升了用户体验感。The first aspect of the embodiment of the present application discloses a method for an electronic device to query a router interface. The router can provide a client connected to a target physical interface of the router with the location of the target physical interface on the router. Even if the cables of multiple client computers connected to the router interface are intertwined, the user can quickly find the target physical interface to which the client computer is connected according to the position of the target physical interface indicated by the router on the router. When the user needs to remove a certain client computer, the corresponding search is directly performed on the router based on the position of the indicated target physical interface, and the operation is performed on the interface connected to the client computer. It will not cause other clients to be disconnected from the router, which improves the user experience.

根据本申请第一方面的一些实施例,物理接口信息包括关联的目标物理接口的接口标识。According to some embodiments of the first aspect of the present application, the physical interface information includes an interface identification of the associated target physical interface.

根据本申请第一方面的一些实施例,物理接口信息包括与目标物理接口关联的接口标识,并且路由器基于物理接口信息向第一电子设备提供接口示意图,且以图形的形式显示目标物理接口的在路由器上的位置。According to some embodiments of the first aspect of the present application, the physical interface information includes an interface identifier associated with the target physical interface, and the router provides an interface schematic diagram to the first electronic device based on the physical interface information, and displays the physical interface of the target in a graphical form. location on the router.

根据本申请第一方面的一些实施例,目标电子设备是第一电子设备本身。According to some embodiments of the first aspect of the present application, the target electronic device is the first electronic device itself.

根据本申请第一方面的一些实施例,至少一个电子设备连接路由器的物理接口,并向路由器发送IP请求,According to some embodiments of the first aspect of the present application, at least one electronic device is connected to a physical interface of the router, and sends an IP request to the router,

路由器为至少一个电子设备分配虚拟接口,并经由虚拟接口接收IP请求以及将基于IP请求分配的IP地址发送至电子设备,其中,IP请求中携带电子设备的MAC地址。The router allocates a virtual interface for at least one electronic device, receives an IP request through the virtual interface and sends an IP address allocated based on the IP request to the electronic device, wherein the IP request carries the MAC address of the electronic device.

根据本申请第一方面的一些实施例,目标虚拟接口的虚拟接口参数包括目标物理接口的物理接口信息、目标电子设备的MAC地址和目标电子设备的IP地址。According to some embodiments of the first aspect of the present application, the virtual interface parameters of the target virtual interface include physical interface information of the target physical interface, a MAC address of the target electronic device, and an IP address of the target electronic device.

根据本申请第一方面的一些实施例,路由器绑定IP地址和目标虚拟接口;According to some embodiments of the first aspect of the present application, the router binds the IP address and the target virtual interface;

路由器基于IP地址查询与IP地址对应的目标虚拟接口,并基于虚拟接口参数确定目标物理接口的物理接口信息。The router queries the target virtual interface corresponding to the IP address based on the IP address, and determines the physical interface information of the target physical interface based on the virtual interface parameters.

根据本申请第一方面的一些实施例,电子设备从路由器的目标物理接口移除后,路由器擦除IP地址和目标虚拟接口的绑定信息。According to some embodiments of the first aspect of the present application, after the electronic device is removed from the target physical interface of the router, the router erases the binding information of the IP address and the target virtual interface.

根据本申请第一方面的一些实施例,接口查询请求包括IP地址和/或MAC地址。According to some embodiments of the first aspect of the present application, the interface query request includes an IP address and/or a MAC address.

根据本申请第一方面的一些实施例,IP地址和MAC地址相绑定。According to some embodiments of the first aspect of the present application, the IP address and the MAC address are bound.

根据本申请第一方面的一些实施例,路由器绑定MAC地址和目标虚拟接口;According to some embodiments of the first aspect of the present application, the router binds the MAC address and the target virtual interface;

路由器基于MAC地址查询与MAC地址关联的IP地址;The router queries the IP address associated with the MAC address based on the MAC address;

路由器基于MAC地址查询与MAC地址对应的目标虚拟接口,并基于虚拟接口参数确定目标物理接口的物理接口信息。The router queries the target virtual interface corresponding to the MAC address based on the MAC address, and determines the physical interface information of the target physical interface based on the virtual interface parameters.

根据本申请第一方面的一些实施例,电子设备从路由器的目标物理接口移除后,路由器擦除电子设备的MAC地址和关联的虚拟接口的绑定信息。According to some embodiments of the first aspect of the present application, after the electronic device is removed from the target physical interface of the router, the router erases the binding information of the MAC address of the electronic device and the associated virtual interface.

根据本申请第一方面的一些实施例,物理接口信息还包括电子设备的MAC地址。According to some embodiments of the first aspect of the present application, the physical interface information further includes a MAC address of the electronic device.

根据本申请第一方面的一些实施例,物理接口信息还包括所有连接于路由器的电子设备的数量。According to some embodiments of the first aspect of the present application, the physical interface information further includes the numbers of all electronic devices connected to the router.

第二方面,本申请实施例公开了一种路由器确定与电子设备连接的路由器接口的方法,路由器连接有至少一个电子设备,并为各电子设备分配IP地址,方法包括:In the second aspect, the embodiment of the present application discloses a method for a router to determine a router interface connected to an electronic device. The router is connected to at least one electronic device, and assigns an IP address to each electronic device. The method includes:

基于接口查询请求确定与目标电子设备的IP地址关联的目标虚拟接口,并且根据预设的虚拟接口与物理接口的映射关系确定与目标虚拟接口对应的目标物理接口;determining a target virtual interface associated with the IP address of the target electronic device based on the interface query request, and determining a target physical interface corresponding to the target virtual interface according to a preset mapping relationship between a virtual interface and a physical interface;

接口查询请求由至少一个电子设备中的第一电子设备向路由器发送,接口查询请求至少用于向路由器查询至少一个电子设备中以有线方式接入路由器的目标电子设备所连接的路由器的物理接口的位置;The interface query request is sent to the router by the first electronic device in the at least one electronic device, and the interface query request is at least used to query the router for the physical interface of the router connected to the target electronic device connected to the router in a wired manner among the at least one electronic device Location;

将目标物理接口关联的物理接口信息发送至第一电子设备,物理接口信息至少指示目标电子设备在路由器上的物理接口的位置。The physical interface information associated with the target physical interface is sent to the first electronic device, where the physical interface information at least indicates the location of the physical interface of the target electronic device on the router.

本申请实施例第二方面公开的一种路由器确定与电子设备连接的路由器接口的方法,路由器能为连接至路由器的目标物理接口的客户机提供该目标物理接口在路由器上的位置。即使连接至路由器接口的多个客户机的线缆交织在一起,用户可以根据路由器指示的目标物理接口在路由器上的位置很快的查找到该客户机所连接的目标物理接口。当用户需要移除某一客户机时,直接基于指示的目标物理接口的位置在路由器上对应查找,并对该客户机所连接的接口进行操作。也不会造成其余的客户机与路由器断开,提升了用户体验感。The second aspect of the embodiment of the present application discloses a method for a router to determine a router interface connected to an electronic device. The router can provide a client connected to a target physical interface of the router with the location of the target physical interface on the router. Even if the cables of multiple client computers connected to the router interface are intertwined, the user can quickly find the target physical interface to which the client computer is connected according to the position of the target physical interface indicated by the router on the router. When the user needs to remove a certain client computer, the corresponding search is directly performed on the router based on the position of the indicated target physical interface, and the operation is performed on the interface connected to the client computer. It will not cause other clients to be disconnected from the router, which improves the user experience.

根据本申请第二方面的一些实施例,基于来自与路由器连接的目标电子设备的接口查询请求确定目标电子设备的物理接口信息。According to some embodiments of the second aspect of the present application, the physical interface information of the target electronic device is determined based on an interface query request from the target electronic device connected to the router.

第三方面,本申请实施例公开了一种路由器,路由器连接有至少一个电子设备,并为各电子设备分配IP地址,路由器包括:至少一个存储器和至少一个处理器;In the third aspect, the embodiment of the present application discloses a router, the router is connected with at least one electronic device, and assigns an IP address to each electronic device, and the router includes: at least one memory and at least one processor;

至少一个存储器中存储有指令;instructions are stored in at least one memory;

当指令被至少一个处理器执行时,使得路由器执行以下操作:The instructions, when executed by at least one processor, cause the router to:

基于接口查询请求确定与目标电子设备的IP地址关联的目标虚拟接口,并且根据预设的虚拟接口与物理接口的映射关系确定与目标虚拟接口对应的目标物理接口;determining a target virtual interface associated with the IP address of the target electronic device based on the interface query request, and determining a target physical interface corresponding to the target virtual interface according to a preset mapping relationship between a virtual interface and a physical interface;

接口查询请求由至少一个电子设备中的第一电子设备向路由器发送,接口查询请求至少用于向路由器查询至少一个电子设备中以有线方式接入路由器的目标电子设备所连接的路由器的物理接口的位置;The interface query request is sent to the router by the first electronic device in the at least one electronic device, and the interface query request is at least used to query the router for the physical interface of the router connected to the target electronic device connected to the router in a wired manner among the at least one electronic device Location;

将目标物理接口关联的物理接口信息发送至第一电子设备,物理接口信息至少指示目标电子设备在路由器上的物理接口的位置。The physical interface information associated with the target physical interface is sent to the first electronic device, where the physical interface information at least indicates the location of the physical interface of the target electronic device on the router.

本申请实施例第三方面公开的一种路由器,路由器能为连接至路由器的目标物理接口的客户机提供该目标物理接口在路由器上的位置。即使连接至路由器接口的多个客户机的线缆交织在一起,用户可以根据路由器指示的目标物理接口在路由器上的位置很快的查找到该客户机所连接的目标物理接口。当用户需要移除某一客户机时,直接基于指示的目标物理接口的位置在路由器上对应查找,并对该客户机所连接的接口进行操作。也不会造成其余的客户机与路由器断开,提升了用户体验感。The router disclosed in the third aspect of the embodiment of the present application is capable of providing a location of the target physical interface on the router for a client connected to the router's target physical interface. Even if the cables of multiple client computers connected to the router interface are intertwined, the user can quickly find the target physical interface to which the client computer is connected according to the position of the target physical interface indicated by the router on the router. When the user needs to remove a certain client computer, the corresponding search is directly performed on the router based on the position of the indicated target physical interface, and the operation is performed on the interface connected to the client computer. It will not cause other clients to be disconnected from the router, which improves the user experience.

第四方面,本申请实施例公开了一种通信系统,包括:至少一个电子设备和路由器;In a fourth aspect, the embodiment of the present application discloses a communication system, including: at least one electronic device and a router;

路由器连接有至少一个电子设备,并为各电子设备分配IP地址;The router is connected to at least one electronic device, and assigns an IP address to each electronic device;

至少一个电子设备中的第一电子设备向路由器发送接口查询请求,接口查询请求至少用于向路由器查询至少一个电子设备中以有线方式接入路由器的目标电子设备所连接的路由器的物理接口的位置;The first electronic device in the at least one electronic device sends an interface query request to the router, and the interface query request is at least used to query the router for the location of the physical interface of the router to which the target electronic device connected to the router in the at least one electronic device is wired. ;

路由器根据接口查询请求,确定与目标电子设备的IP地址关联的目标虚拟接口,并且路由器根据预设的虚拟接口与物理接口的映射关系确定与目标虚拟接口对应的目标物理接口;The router determines the target virtual interface associated with the IP address of the target electronic device according to the interface query request, and the router determines the target physical interface corresponding to the target virtual interface according to the preset mapping relationship between the virtual interface and the physical interface;

路由器将目标物理接口关联的物理接口信息发送至第一电子设备,物理接口信息至少指示目标电子设备在路由器上的物理接口的位置。The router sends physical interface information associated with the target physical interface to the first electronic device, where the physical interface information at least indicates the location of the physical interface of the target electronic device on the router.

本申请实施例第四方面公开的一种通信系统,路由器能为连接至路由器的目标物理接口的客户机提供该目标物理接口在路由器上的位置。即使连接至路由器接口的多个客户机的线缆交织在一起,用户可以根据路由器指示的目标物理接口在路由器上的位置很快的查找到该客户机所连接的目标物理接口。当用户需要移除某一客户机时,直接基于指示的目标物理接口的位置在路由器上对应查找,并对该客户机所连接的接口进行操作。也不会造成其余的客户机与路由器断开,提升了用户体验感。In the communication system disclosed in the fourth aspect of the embodiment of the present application, the router can provide the location of the target physical interface on the router for the clients connected to the router's target physical interface. Even if the cables of multiple client computers connected to the router interface are intertwined, the user can quickly find the target physical interface to which the client computer is connected according to the position of the target physical interface indicated by the router on the router. When the user needs to remove a certain client computer, the corresponding search is directly performed on the router based on the position of the indicated target physical interface, and the operation is performed on the interface connected to the client computer. It will not cause other clients to be disconnected from the router, which improves the user experience.

本发明其他特征和相应的有益效果在说明书的后面部分进行阐述说明,且应当理解,至少部分有益效果从本发明说明书中的记载变的显而易见。Other features and corresponding beneficial effects of the present invention are explained in the following part of the specification, and it should be understood that at least part of the beneficial effects become obvious from the description in the specification of the present invention.

附图说明Description of drawings

图1为本申请实施例提供的一种应用场景中的路由器与客户机组成的通信系统的结构示意图;FIG. 1 is a schematic structural diagram of a communication system composed of a router and a client in an application scenario provided by an embodiment of the present application;

图2(a)为本申请实施例提供的一种应用场景中的路由器的硬件结构示意图;FIG. 2(a) is a schematic diagram of a hardware structure of a router in an application scenario provided by an embodiment of the present application;

图2(b)为本申请实施例提供的一种应用场景中的路由器的软件框架示意图;FIG. 2(b) is a schematic diagram of a software framework of a router in an application scenario provided by an embodiment of the present application;

图3为本申请实施例提供的一种应用场景中的客户机的结构示意图;FIG. 3 is a schematic structural diagram of a client in an application scenario provided by an embodiment of the present application;

图4(a)为本申请实施例提供的一种应用场景中的路由器向客户机分配IP地址的具体实现的信号流向示意图;FIG. 4(a) is a schematic diagram of the signal flow of a specific implementation of assigning an IP address to a client computer by a router in an application scenario provided by an embodiment of the present application;

图4(b)为本申请实施例提供的一种应用场景中的路由器向客户机分配IP地址的具体实现结构示意图;FIG. 4(b) is a schematic structural diagram of a specific implementation of assigning an IP address to a client computer by a router in an application scenario provided by an embodiment of the present application;

图4(c)为本申请实施例提供的一种应用场景中的路由器向客户机提供接口显示信息的具体实现结构示意图;FIG. 4(c) is a schematic structural diagram of a specific implementation of the router providing interface display information to the client in an application scenario provided by the embodiment of the present application;

图5(a)为本申请实施例提供的一种客户机和路由器接口组成的系统实现IP分配的结构示意图;Fig. 5 (a) is the structural diagram that the system that a kind of client computer and router interface are formed of the embodiment of the present application realizes IP distribution;

图5(b)为本申请实施例提供的一种客户机和路由器接口组成的系统实现接口信息查询的结构示意图;Fig. 5 (b) is a schematic diagram of the structure of a system composed of a client and a router interface provided by the embodiment of the present application to realize interface information query;

图5(c)为本申请实施例提供的一种客户机查询路由器接口的方法的流程示意图;FIG. 5(c) is a schematic flow diagram of a method for a client to query a router interface provided in an embodiment of the present application;

图5(d)为本申请实施例提供的一种客户机显示路由器接口的示意图;Figure 5(d) is a schematic diagram of a client displaying a router interface provided by an embodiment of the present application;

图6为本申请实施例公开的一种路由器的结构示意图;FIG. 6 is a schematic structural diagram of a router disclosed in an embodiment of the present application;

图7为本申请实施例公开的一种SOC的结构示意图。FIG. 7 is a schematic structural diagram of an SOC disclosed in an embodiment of the present application.

具体实施方式detailed description

在本申请的一些实施例中,以电子设备为客户机为例对本申请实施例所提供的电子设备和路由器的连接方法进行说明。可以理解的是,本申请中所指的路由器,可以为Hilink路由器,还可以为具备路由功能的其他电子设备,例如具有路由功能的电脑以及智能家居设备等。本申请中所指的客户机可以为电脑、手机、平板、膝上计算机等。In some embodiments of the present application, the method for connecting the electronic device and the router provided in the embodiments of the present application is described by taking the electronic device as a client as an example. It can be understood that the router referred to in this application may be a Hilink router, or other electronic equipment with a routing function, such as a computer with a routing function and a smart home device. The client computer referred to in this application may be a computer, a mobile phone, a tablet, a laptop computer, and the like.

图1为本申请实施例提供的一种应用场景中的路由器与客户机组成的通信系统的结构示意图。FIG. 1 is a schematic structural diagram of a communication system composed of a router and a client in an application scenario provided by an embodiment of the present application.

图1所示的由路由器和客户机构成的通信系统,包括路由器30,以及通过线缆501与路由器30连接的多个客户机40,如图中所示,3个客户机40与路由器30以有线的方式连接。The communication system composed of routers and clients shown in FIG. 1 includes a router 30 and a plurality of clients 40 connected to the router 30 through cables 501. As shown in the figure, three clients 40 are connected to the router 30 with Wired connection.

三个客户机40均通过线缆501分别连接至局域网接口3030的局域网接口30301、局域网接口30302和局域网接口30303。The three clients 40 are all connected to the LAN interface 30301 , the LAN interface 30302 and the LAN interface 30303 of the LAN interface 3030 through cables 501 .

路由器30的接口303(物理接口)包括但不限于局域网接口3030、广域网接口3031和路由器配置接口3032。值得注意的是,局域网接口3030、广域网接口3031和路由器配置接口3032的数量均不限于一个。如本申请实施例提供的图1中应用场景的局域网接口3030为三个,分别为局域网接口30301、局域网接口30302和局域网接口30303。广域网接口3031包括三个接口和路由器配置接口3032包括一个接口The interface 303 (physical interface) of the router 30 includes but not limited to a LAN interface 3030 , a WAN interface 3031 and a router configuration interface 3032 . It should be noted that the number of LAN interface 3030, WAN interface 3031 and router configuration interface 3032 is not limited to one. As provided in the embodiment of the present application, there are three LAN interfaces 3030 in the application scenario in FIG. 1 , which are LAN interface 30301 , LAN interface 30302 , and LAN interface 30303 . WAN interface 3031 includes three interfaces and router configuration interface 3032 includes one interface

根据本申请中的一些实施例,路由器30的局域网接口3030、广域网接口3031和路由器配置接口3032用于分别连接客户机40。According to some embodiments of the present application, the LAN interface 3030 , the WAN interface 3031 and the router configuration interface 3032 of the router 30 are used to connect to the client 40 respectively.

在路由器30作为能够实现无线路由的情形中,还可以有客户机50通过无线方式500与路由器30连接。In the case that the router 30 is capable of wireless routing, there may also be a client 50 connected to the router 30 through a wireless method 500 .

无论是通过有线或者无线方式连接到路由器的客户机,可以查询本身与路由器连接的物理接口信息,以及在权限允许的情况下,查询其他电子设备的物理接口信息。例如,当某台设备是作为该路由器的管理员身份运行,它可以查询与路由器连接的所有电子设备的物理接口信息。下面对本申请实施例中图1中包括的路由器和客户机的具体结构进行说明:Whether it is a client computer connected to the router in a wired or wireless manner, it can query the physical interface information connected to the router itself, and query the physical interface information of other electronic devices when the authority allows. For example, when a device is running as an administrator of the router, it can query the physical interface information of all electronic devices connected to the router. The specific structures of the router and the client included in Figure 1 in the embodiment of the present application are described below:

请参见图2(a),图2(a)为本申请实施例公开的一种路由器30的硬件结构示意图。Referring to FIG. 2( a ), FIG. 2( a ) is a schematic diagram of a hardware structure of a router 30 disclosed in an embodiment of the present application.

路由器30包括:存储器301,处理器302,接口303(物理接口),电源模块306和交换机307。接口303(物理接口)包括但不限于局域网接口3030、广域网接口3031和路由器配置接口3032。路由器配置接口3032包括控制台端口和辅助端口。The router 30 includes: a memory 301 , a processor 302 , an interface 303 (physical interface), a power module 306 and a switch 307 . Interfaces 303 (physical interfaces) include but are not limited to LAN interface 3030 , WAN interface 3031 and router configuration interface 3032 . Router configuration interface 3032 includes a console port and an auxiliary port.

可以理解的是,本申请实施例示意的结构并不构成对路由器30的具体限定。在本申请另一些实施例中,路由器30可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that, the structure shown in the embodiment of the present application does not constitute a specific limitation on the router 30 . In other embodiments of the present application, the router 30 may include more or fewer components than shown in the figure, or combine certain components, or separate certain components, or arrange different components. The illustrated components can be realized in hardware, software or a combination of software and hardware.

在本申请的一些实施例中,存储器301可以采用非易失性存储器,随机存取存储器,闪存以及只读存储器。In some embodiments of the present application, the memory 301 may adopt non-volatile memory, random access memory, flash memory and read-only memory.

随机存取存储器是在路由器启动或供电间隙时会丢弃其信息,只读存储器保存路由器的启动软件,启动软件是路由器运行的第一个软件,负责路由器进入正常的工作状态,路由器将完整的操作系统作为备用保存在随机存储存储器中,以便在操作系统不能使用时,作为备份使用。路由器30拥有动态主机配置协议服务器(Dynamic Host ConfigurationProtocol,DHCP server)。The random access memory will discard its information when the router is started or the power supply gap is. The read-only memory stores the startup software of the router. The startup software is the first software that the router runs. It is responsible for the router to enter the normal working state. The system is saved in the random access memory as a backup, so that it can be used as a backup when the operating system cannot be used. The router 30 has a Dynamic Host Configuration Protocol server (Dynamic Host Configuration Protocol, DHCP server).

随机存取存储器中可以作为IP池子的存储器件,当客户机40请求路由器30分配IP地址时,路由器30的DHCP server从IP池中选取一IP地址并分配至客户机40。此外,随机存取存储器中还可以存储客户机40的MAC地址、路由器30分配给客户机40的IP地址、客户机40的MAC地址和IP地址的绑定关系等各个参数。The random access memory can be used as a storage device for an IP pool. When the client 40 requests the router 30 to assign an IP address, the DHCP server of the router 30 selects an IP address from the IP pool and assigns it to the client 40 . In addition, various parameters such as the MAC address of the client 40, the IP address assigned to the client 40 by the router 30, and the binding relationship between the MAC address and the IP address of the client 40 can also be stored in the random access memory.

此外,随机存取存储器中还可以存储路由器30的物理接口(如LAN接口)对应的虚拟接口(LAN接口的虚拟LAN接口)的图片资源数据(LAN接口在路由器上的位置、接口参数、外形等)、物理接口和虚拟接口之间的映射关系等。In addition, the image resource data (position of the LAN interface on the router, interface parameters, appearance, etc.) ), the mapping relationship between physical interfaces and virtual interfaces, etc.

只读存储器通常设置在一个或多个芯片上,焊接在路由器的主机板上ROM is usually set on one or more chips, soldered on the motherboard of the router

闪存的主要用途是存储路由器30的操作系统,维持路由器的正常工作,如果路由器安装了闪存,则主要用来引导路由器操作系统的默认位置,只要闪存的容量足够,可以保存多个操作系统映像,以提供多重启动选项,其中,路由器30的操作系统采用Linux操作系统。The main purpose of the flash memory is to store the operating system of the router 30 to maintain the normal operation of the router. If the router is equipped with a flash memory, it is mainly used to guide the default position of the router operating system. As long as the capacity of the flash memory is sufficient, multiple operating system images can be saved. To provide multiple boot options, wherein, the operating system of the router 30 adopts the Linux operating system.

非易失性存储器的主要作用是保存操作系统启动时读入的配置数据(启动配置)。随机存取存储器主要作为操作系统表和缓冲的存储区,操作系统可以通过随机存取存储器满足所有的常规存储需要,让路由器能迅速访问这些信息,其中,随机存取存储器的存储速度优于以上提到的三种。The main function of the non-volatile memory is to save the configuration data (startup configuration) read in when the operating system is started. The random access memory is mainly used as the storage area of the operating system table and buffer. The operating system can meet all the conventional storage needs through the random access memory, so that the router can quickly access the information. Among them, the storage speed of the random access memory is better than the above mentioned three.

可以理解的是,路由器的IP池、客户机40的参数、图片资源数据以及客户机40的MAC地址和IP地址的绑定关系等参数也可以存储在非易失性存储器或其他类型的存储器中,本申请实施例在此并不作限定。It can be understood that parameters such as the IP pool of the router, the parameters of the client 40, the picture resource data, and the binding relationship between the MAC address and the IP address of the client 40 can also be stored in a non-volatile memory or other types of memory , the embodiment of the present application is not limited here.

处理器302可以包括一个或多个处理单元,例如,可以包括中央处理器CPU(Central Processing Unit)、图像处理器GPU(Graphics Processing Unit)、数字信号处理器DSP、微处理器MCU(Micro-programmed Control Unit)、AI(ArtificialIntelligence,人工智能)处理器或可编程逻辑器件FPGA(Field Programmable GateArray)等的处理模块或处理电路。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。处理器302中可以设置存储单元,用于存储指令和与路由器30相关的参数和客户机40相关的参数。The processor 302 may include one or more processing units, for example, may include a central processing unit CPU (Central Processing Unit), an image processor GPU (Graphics Processing Unit), a digital signal processor DSP, a microprocessor MCU (Micro-programmed Control Unit), AI (Artificial Intelligence, artificial intelligence) processor or programmable logic device FPGA (Field Programmable Gate Array) and other processing modules or processing circuits. Wherein, different processing units may be independent devices, or may be integrated in one or more processors. A storage unit may be set in the processor 302 for storing instructions and parameters related to the router 30 and parameters related to the client 40 .

处理器302中的处理单元(可以称为MAC处理单元(包括硬件部分(可以称为GMAC硬件)和软件部分(可以称为GMAC软件))可以对路由器30的数据包转换为比特流发送至交换机307。交换机307对来自于MAC处理单元的比特流进行解析,得到客户机的MAC地址。路由器30查找该MAC地址对应的客户机40,将对应的数据(如IP地址)发送至对应的物理接口,通过物理接口发送至客户机40。The processing unit in the processor 302 (may be referred to as a MAC processing unit (including a hardware part (may be referred to as GMAC hardware) and a software part (may be referred to as GMAC software)) can convert the data packet of the router 30 into a bit stream and send it to the switch 307. The switch 307 resolves the bitstream from the MAC processing unit to obtain the MAC address of the client. The router 30 searches for the corresponding client 40 of the MAC address, and sends corresponding data (such as IP address) to the corresponding physical interface , sent to the client 40 through the physical interface.

如图2(a)所示的,处理器302对接交换机307和接口303,交换机307和接口303连接。处理器302通过交换机307和接口303实现与客户机40的对接。As shown in FIG. 2( a ), the processor 302 is connected to the switch 307 and the interface 303 , and the switch 307 is connected to the interface 303 . The processor 302 is connected to the client 40 through the switch 307 and the interface 303 .

路由器30的接口303包括但不限于局域网接口3030、广域网接口3031和路由器配置接口3032。值得注意的是,局域网接口3030、广域网接口3031和路由器配置接口3032的数量均不限于一个。如本申请实施例提供的图1中应用场景的局域网接口3030为三个,分别为局域网接口30301、局域网接口30302和局域网接口30303。广域网接口3031包括三个接口和路由器配置接口3032包括一个接口。The interface 303 of the router 30 includes but not limited to a LAN interface 3030 , a WAN interface 3031 and a router configuration interface 3032 . It should be noted that the number of LAN interface 3030, WAN interface 3031 and router configuration interface 3032 is not limited to one. As provided in the embodiment of the present application, there are three LAN interfaces 3030 in the application scenario in FIG. 1 , which are LAN interface 30301 , LAN interface 30302 , and LAN interface 30303 . The WAN interface 3031 includes three interfaces and the router configuration interface 3032 includes one interface.

路由器30的接口303都有各自的名称和编号,一个接口的全名称可以由接口的类型标志与数字编号构成。编号自0开始,对于接口固定的路由器30或采用模块化接口的路由器30,在接口的全名称中,只采用一个数字,并根据其在路由器30的物理顺序进行编号。例如Ethernet0表示第1个以太网接口,Serial1表示第2个串口。对于支持“在线插拔和删除”或具有更改物理接口配置的路由器,其接口全名称中至少包含两个数字,中间用斜杠“/”分割,其中,第1个数字代表插槽编号,第2个数字代表接口卡内的端口编号。对于支持“万用接口处理器”的路由器,其接口编号形式为“插槽/端口适配器/端口号”,如Ethernet4/0/1是4号插槽上第1个端口适配器的第2个以太网接口。The interfaces 303 of the router 30 have their own names and numbers, and the full name of an interface can be composed of the type identifier and the number of the interface. Numbering starts from 0. For a router 30 with a fixed interface or a router 30 with a modular interface, only one number is used in the full name of the interface, and it is numbered according to its physical order in the router 30 . For example, Ethernet0 indicates the first Ethernet interface, and Serial1 indicates the second serial port. For routers that support "online plugging and removal" or change the physical interface configuration, the full name of the interface must contain at least two numbers separated by a slash "/". The first number represents the slot number, and the first number represents the slot number. The 2 digits represent the port number within the interface card. For routers that support "universal interface processor", the interface numbering format is "slot/port adapter/port number". For example, Ethernet4/0/1 is the second Ethernet of the first port adapter on slot 4. network interface.

局域网接口(LAN接口)3030的类型有以太网、快速以太网、千兆以太网、万兆以太网M等标准网络接口。在每种网络中,又可以支持不同介质标准的接口,如RJ45接口、光纤接口、粗同轴电缆接口等。路由器30可以通过RJ45接口与客户机40连接,以实现与客户机40的数据通讯。The types of the local area network interface (LAN interface) 3030 include standard network interfaces such as Ethernet, Fast Ethernet, Gigabit Ethernet, and Ten Gigabit Ethernet. In each network, interfaces of different media standards can be supported, such as RJ45 interface, optical fiber interface, thick coaxial cable interface, etc. The router 30 can be connected to the client computer 40 through the RJ45 interface, so as to realize data communication with the client computer 40 .

广域网接口(Wide area network interface,WAN)3031有同步串行接口、异步串行接口。路由器30通过WAN口与广域网连接以实现跨地区的广域网数据通讯网络。Wide area network interface (Wide area network interface, WAN) 3031 has synchronous serial interface and asynchronous serial interface. The router 30 is connected to the WAN through the WAN port to realize the inter-regional WAN data communication network.

控制台端口Console通常是用来当对路由器30进行基本配置时使用专用连接线将该接口与客户机40相连接。The console port Console is usually used to connect the interface with the client 40 using a dedicated connection line when performing basic configuration on the router 30 .

路由器30的配置接口3032包括控制台端口Console和辅助端口。控制台端口Console通常是用来当对路由器30进行基本配置时使用专用连接线将该接口与客户机40相连接。作为控制台端口是使得用户或管理员能够利用入网设备与路由器30进行通讯,完成路由器的配置,该端口提供了一个EIA/TIA-232异步串行接口,用于在路由器30进行配置。The configuration interface 3032 of the router 30 includes a console port Console and an auxiliary port. The console port Console is usually used to connect the interface with the client 40 using a dedicated connection line when performing basic configuration on the router 30 . As a console port, users or administrators can communicate with the router 30 by using network access equipment to complete the configuration of the router. This port provides an EIA/TIA-232 asynchronous serial interface for configuration on the router 30 .

作为辅助端口也提供一个EIA/TIA-232异步串行接口,不同的是,其常用于连接调制解调器以实现对路由器的远程管理。An EIA/TIA-232 asynchronous serial interface is also provided as an auxiliary port. The difference is that it is often used to connect a modem for remote management of the router.

电源模块306可以包括电源、电源管理部件等。电源管理部件用于管理电源的充电和电源向其他模块的供电。The power module 306 may include a power supply, power management components, and the like. The power management component is used to manage the charging of the power supply and the power supply from the power supply to other modules.

可选的,对于无线路由器而言,其还具有无线通讯模块(图中未示出)。使得无线路由器可以实现如图1所示的客户机50实现无线通讯。无线通信模块可以提供应用在客户机上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wirelessfidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),近距离无线通信技术(near fieldcommunication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块可以是集成至少一个通信处理模块的一个或多个器件。Optionally, for the wireless router, it also has a wireless communication module (not shown in the figure). This enables the wireless router to realize the wireless communication of the client 50 shown in FIG. 1 . The wireless communication module can provide applications including wireless local area networks (wireless local area networks, WLAN) (such as wireless fidelity (Wi-Fi) network), bluetooth (bluetooth, BT), short-distance wireless communication technology (near fieldcommunication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module may be one or more devices integrating at least one communication processing module.

请参见图2(b),图2(b)为本申请实施例公开的一种路由器30的软件框架示意图。Please refer to FIG. 2( b ), which is a schematic diagram of a software framework of a router 30 disclosed in an embodiment of the present application.

路由器30具有操作系统内核模块301、驱动程序模块302、路由网络模块303和应用开发框架模块304。The router 30 has an operating system kernel module 301 , a driver module 302 , a routing network module 303 and an application development framework module 304 .

操作系统内核模块301包括文件系统、内存管理、进程调度以及进程通信。The operating system kernel module 301 includes file system, memory management, process scheduling and process communication.

文件系统定义路由器30的操作系统中所有文件的数据块信息,并据此建立文件索引,为内存管理、进程调度以及进程通信提供文件查询与更改的支撑。The file system defines the data block information of all files in the operating system of the router 30, and establishes a file index based on it, providing support for file query and modification for memory management, process scheduling, and process communication.

内存管理为进程调度模块提供运行的地址空间,并对进程调度模块运行中所涉及的数据信息进行管理。The memory management provides the running address space for the process scheduling module, and manages the data information involved in the running of the process scheduling module.

进程调度模块负责处理上层路由器的应用程序的应用请求。The process scheduling module is responsible for processing the application requests of the application programs of the upper router.

进程通信模块负责为进程调度模块的运行提供通信支撑。The process communication module is responsible for providing communication support for the operation of the process scheduling module.

驱动程序模块302对路由器30的操作系统中的所有硬件进行封装并向操作系统的文件系统开放接口,在文件系统中形成文件供上层调用。如对接路由器30的处理器302或其他的硬件。The driver module 302 encapsulates all the hardware in the operating system of the router 30 and opens an interface to the file system of the operating system, and forms a file in the file system for the upper layer to call. For example, it is connected to the processor 302 of the router 30 or other hardware.

应用开发框架模块304包括:虚拟机,其为应用程序提供运行环境,按照应用需求调用下层硬件并提供所述操作系统内核模块的接口支持。在本申请实施例中,虚拟机中运行着本申请实施例中的网络产品界面模块(Website User Interface,WebUI)的应用程序和接口管理模块。WebUI模块在客户机40访问时为客户机40提供物理接口信息。接口管理模块用于对客户机40连接的物理接口进行管理(如对物理接口和对应的虚拟接口进行绑定、对虚拟接口和对应的客户机40的物理地址(Media Access Control Address,MAC)和IP地址进行绑定等)。The application development framework module 304 includes: a virtual machine, which provides an operating environment for the application program, invokes the underlying hardware according to application requirements, and provides interface support for the operating system kernel module. In the embodiment of the present application, the application program and the interface management module of the web product interface module (Website User Interface, WebUI) in the embodiment of the present application are running in the virtual machine. The WebUI module provides physical interface information for the client computer 40 when the client computer 40 accesses it. The interface management module is used to manage the physical interface connected to the client computer 40 (such as binding the physical interface and the corresponding virtual interface, the physical address (Media Access Control Address, MAC) and the physical address (Media Access Control Address, MAC) of the virtual interface and the corresponding client computer 40) IP address for binding, etc.).

应用开发接口,将操作系统内的所有功能进行对象化封装,为开发智能路由器的应用程序提供对象化的接口。针对于路由器30的物理接口,对应在虚拟机建立与物理接口对应的虚拟接口,虚拟接口和应用开发框架模块304中WebUI模块和接口管理模块通过路由网络模块303进行数据通信。The application development interface encapsulates all the functions in the operating system object-oriented, and provides an object-oriented interface for developing the application program of the smart router. For the physical interface of the router 30, a virtual interface corresponding to the physical interface is established in the virtual machine, and the WebUI module and the interface management module in the virtual interface and application development framework module 304 perform data communication through the routing network module 303.

路由网络模块303可以基于传输控制协议/网际协议(Transmission ControlProtocol/Internet Protocol,TCP/IP)或其他通讯协议进行通讯。路由网络模块303中的动态主机配置协议服务器(Dynamic Host Configuration Protocol,DHCP)基于TCP/IP网络协议进行数据通信。The routing network module 303 can communicate based on Transmission Control Protocol/Internet Protocol (Transmission Control Protocol/Internet Protocol, TCP/IP) or other communication protocols. The dynamic host configuration protocol server (Dynamic Host Configuration Protocol, DHCP) in the routing network module 303 performs data communication based on the TCP/IP network protocol.

请参见图3,图3为本申请实施例提供的一种应用场景中的客户机的结构示意图。Please refer to FIG. 3 . FIG. 3 is a schematic structural diagram of a client in an application scenario provided by an embodiment of the present application.

客户机40包括:存储器401,处理器402,接口403,电源模块404,显示屏405。接口403包括但不限于通用串行总线(Universal Serial Bus,USB)接口、IEEE 1394接口、RJ45网线接口等。The client 40 includes: a memory 401 , a processor 402 , an interface 403 , a power module 404 , and a display 405 . The interface 403 includes, but is not limited to, a Universal Serial Bus (Universal Serial Bus, USB) interface, an IEEE 1394 interface, an RJ45 network cable interface, and the like.

在本申请的一些实施例中,存储器401可以采用非易失性存储器,随机存取存储器,闪存以及只读存储器。随机存取存储器中可以存储客户机40的MAC地址。当客户机40的DHCP客户端请求路由器30分配IP地址时,客户机40的DHCP客户端将MAC地址发送至路由器30,路由器30的DHCP服务器从IP池中选取一IP地址并分配至客户机40,由客户机40的随机存取存储器进行存储。In some embodiments of the present application, the memory 401 may adopt non-volatile memory, random access memory, flash memory and read-only memory. The MAC address of the client machine 40 may be stored in random access memory. When the DHCP client of the client computer 40 requested the router 30 to distribute the IP address, the DHCP client of the client computer 40 sent the MAC address to the router 30, and the DHCP server of the router 30 selected an IP address from the IP pool and distributed it to the client computer 40 , is stored by the random access memory of the client 40.

此外,随机存取存储器中还可以存储来自于连接于路由器30的物理接口(如LAN接口)对应的虚拟接口(LAN接口的虚拟LAN接口)的图片资源数据(LAN接口在路由器上的位置、接口参数、外形等)。In addition, the random access memory can also store picture resource data (the position of the LAN interface on the router, the interface parameters, shape, etc.).

显示屏405用于显示图像,视频等。显示屏405包括显示面板。The display screen 405 is used to display images, videos and the like. The display screen 405 includes a display panel.

路由器30的DHCP服务器将客户机40所连接的路由器30的物理接口对应的虚拟接口的图片资源发送至客户机40。可以在客户机40的显示屏405上显示客户机40所连接的路由器30具体的物理接口的参数、位置以及连接状态等。同时,也可以在客户机40的显示屏405上显示路由器30上连接的客户机的数量。The DHCP server of the router 30 sends the picture resource of the virtual interface corresponding to the physical interface of the router 30 to which the client 40 is connected to the client 40 . The parameters, location and connection status of the specific physical interface of the router 30 to which the client 40 is connected can be displayed on the display screen 405 of the client 40 . At the same time, the number of client computers connected to the router 30 may also be displayed on the display screen 405 of the client computer 40 .

接口403中的IEEE 1394接口,广泛应用在数码摄像机、网络、存储设备中的串行接口的正式名称,别名火线(FireWire)接口,其是一种高速传送接口。The IEEE 1394 interface in the interface 403 is an official name of a serial interface widely used in digital cameras, networks, and storage devices, and is also called a FireWire (FireWire) interface, which is a high-speed transmission interface.

接口403中的RJ45网线接口用于与路由器30进行连接以实现数据通信。The RJ45 network cable interface in the interface 403 is used to connect with the router 30 to realize data communication.

客户机50除了包含如图3所示的客户机40所具有的部件外,还具有无线通信模块(图中未示出)以实现与路由器30之间的无线通信。无线通信模块可以提供应用在客户机上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wirelessfidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),近距离无线通信技术(near fieldcommunication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块可以是集成至少一个通信处理模块的一个或多个器件。In addition to the components of the client 40 shown in FIG. 3 , the client 50 also has a wireless communication module (not shown in the figure) to realize wireless communication with the router 30 . The wireless communication module can provide applications including wireless local area networks (wireless local area networks, WLAN) (such as wireless fidelity (Wi-Fi) network), bluetooth (bluetooth, BT), short-distance wireless communication technology (near fieldcommunication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module may be one or more devices integrating at least one communication processing module.

可以理解的是,本申请实施例示意的结构并不构成对客户机40和客户机50的具体限定。在本申请另一些实施例中,客户机40和客户机50可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that the structure shown in the embodiment of the present application does not constitute a specific limitation on the client 40 and the client 50 . In other embodiments of the present application, the client 40 and the client 50 may include more or fewer components than those shown, or combine some components, or separate some components, or arrange different components. The illustrated components can be realized in hardware, software or a combination of software and hardware.

下面对本申请实施例提供的一种路由器为客户机分配IP地址的过程进行说明:The process of assigning an IP address to a client computer by a router provided in the embodiment of the present application is described below:

根据本申请实施例提供的一种实现方式,客户机40接入路由器30的物理接口后,路由器30向客户机40分配IP地址使得客户机40可以经由路由器30接入互联网。对于客户机40而言,其具有用来确认客户机40位置的MAC地址和动态主机配置协议(Dynamic HostConfiguration Protocol,DHCP)客户端。对于路由器30而言,其具有DHCP服务器和通过DHCP服务器配置好的IP地址池。According to an implementation provided by the embodiment of the present application, after the client 40 accesses the physical interface of the router 30, the router 30 assigns an IP address to the client 40 so that the client 40 can access the Internet via the router 30. For the client 40, it has a MAC address and a Dynamic Host Configuration Protocol (Dynamic Host Configuration Protocol, DHCP) client for confirming the location of the client 40 . For the router 30, it has a DHCP server and an IP address pool configured by the DHCP server.

如图4(a)所示的,客户机40通过线缆接入局域网接口,客户机40向路由器30发送IP请求(请求路由器30分配IP地址),IP请求中携带客户机40的MAC地址。路由器30接收IP请求并解析IP请求得到MAC地址,路由器30的DHCP服务器从IP池中分配IP地址并基于MAC地址发送至客户机40。As shown in Figure 4 (a), the client computer 40 is connected to the LAN interface through a cable, and the client computer 40 sends an IP request to the router 30 (requesting the router 30 to assign an IP address), and the IP request carries the MAC address of the client computer 40. The router 30 receives the IP request and parses the IP request to obtain a MAC address. The DHCP server of the router 30 allocates an IP address from the IP pool and sends it to the client 40 based on the MAC address.

为进一步说明路由器30为客户机40分配IP地址的流程,下面结合图4(b)对图4(a)中所示的IP地址分配过程进行说明。In order to further illustrate the flow of the router 30 assigning an IP address to the client 40, the IP address assignment process shown in FIG. 4(a) will be described below in conjunction with FIG. 4(b).

如图4(b)所示的,在硬件层,客户机40通过线缆接入局域网接口,例如图中所示的接口30301,客户机40向路由器发出IP请求。IP请求是以数据包的形式被发送至路由器中的交换机307。交换机307解析IP请求后得到客户机40的MAC地址,并将MAC地址和IP请求中携带的其余的数据发送至处理器302中的MAC处理单元进行处理。处理器302中的MAC处理单元可以包括硬件部分(可以称为GMAC硬件)和软件部分(可以称为GMAC软件,通过控制器运行相应代码来实现功能)),其对路由器30的数据包转换为比特流。经由处理器302中的MAC处理单元处理过的数据,例如MAC地址和IP请求中携带的其余的数据被转送至软件层的驱动程序模块302,再通过与局域网接口30301对应的虚拟接口和路由网络模块303发送至DHCP服务器。As shown in FIG. 4( b ), at the hardware layer, the client 40 is connected to a LAN interface through a cable, such as the interface 30301 shown in the figure, and the client 40 sends an IP request to the router. The IP request is sent to the switch 307 in the router in the form of data packets. The switch 307 obtains the MAC address of the client 40 after parsing the IP request, and sends the MAC address and other data carried in the IP request to the MAC processing unit in the processor 302 for processing. The MAC processing unit in the processor 302 may include a hardware part (which may be referred to as GMAC hardware) and a software part (which may be referred to as GMAC software, and the corresponding code is run by the controller to realize the function)), which converts the data packet of the router 30 into bitstream. The data processed by the MAC processing unit in the processor 302, such as the MAC address and the rest of the data carried in the IP request, is transferred to the driver module 302 of the software layer, and then passes through the virtual interface corresponding to the LAN interface 30301 and the routing network Module 303 is sent to the DHCP server.

DHCP服务器响应IP请求,并从地址池中分配IP地址,通过与接收IP请求相同的虚拟接口将局域网接口30301的数据以数据包的形式发送至处理器302。处理器302中的MAC处理单元将数据包转换为比特流发送至交换机307。交换机307从比特流解析出客户机40的MAC地址,并基于MAC地址将IP地址发送到局域网接口30301供客户机40通过该IP地址访问路由器30。The DHCP server responds to the IP request, and allocates an IP address from the address pool, and sends the data of the LAN interface 30301 to the processor 302 in the form of data packets through the same virtual interface as receiving the IP request. The MAC processing unit in the processor 302 converts the data packet into a bit stream and sends it to the switch 307 . The switch 307 parses out the MAC address of the client 40 from the bit stream, and sends the IP address to the LAN interface 30301 based on the MAC address for the client 40 to access the router 30 through the IP address.

此外,路由器30将局域网接口30301处的客户机40的MAC地址发送到接口管理模块,由接口管理模块对客户机40的MAC地址和IP地址进行绑定。接口管理模块记录局域网接口30301处的客户机40的MAC地址。并由接口管理模块记录连接至路由器30的接口303的所有的客户机40的数量(即MAC地址的数量)。In addition, the router 30 sends the MAC address of the client 40 at the LAN interface 30301 to the interface management module, and the interface management module binds the MAC address and the IP address of the client 40 . The interface management module records the MAC address of the client 40 at the LAN interface 30301. And the number of all clients 40 connected to the interface 303 of the router 30 (that is, the number of MAC addresses) is recorded by the interface management module.

可以理解的是,其余的客户机40请求路由器30分配IP地址的流程可以和图4(a)和图4(b)互相参照。It can be understood that, for the rest of the flow of the client 40 requesting the router 30 to allocate an IP address, reference can be made to FIG. 4( a ) and FIG. 4( b ).

路由器30为局域网接口30301处的客户机40分配IP地址之后,为了便于客户机40知晓此时连接至路由器30的客户机总的数量或者局域网接口30301处的客户机40的MAC地址时。局域网接口30301处的客户机40可以请求路由器30的WebUI模块为其提供MAC地址和连接至路由器30的客户机总的数量并以WebUI模块中预置的方式(预置的方式包括图片显示、文字显示等)在客户机40的显示屏194上显示。After the router 30 assigns an IP address to the client 40 at the LAN interface 30301, in order for the client 40 to know the total number of clients connected to the router 30 at this time or the MAC address of the client 40 at the LAN interface 30301. The client 40 at the LAN interface 30301 can request the WebUI module of the router 30 to provide the MAC address and the total number of clients connected to the router 30 in a preset way in the WebUI module (the preset way includes picture display, text, etc.) display, etc.) is displayed on the display screen 194 of the client 40.

下面结合图4(c)对客户机40请求路由器30的WebUI模块为其与路由器连接的电子设备的相关接口显示信息的过程进行说明。举例来说,MAC地址和连接至路由器30的客户机总的数量作为接口显示信息。The process of the client 40 requesting the WebUI module of the router 30 to display information for the relevant interface of the electronic device connected to the router will be described below with reference to FIG. 4( c ). For example, MAC addresses and the total number of clients connected to the router 30 are displayed as interface information.

根据本申请实施例中的一些实现方式,局域网接口30301处的客户机40向路由器30发出接口查询请求。接口查询请求中携带客户机40的MAC地址和/或路由器30为其分配的IP地址。接口查询请求经局域网接口30301、交换机307、处理器302中包括的MAC处理单元、局域网接口30301对应的虚拟接口发送到WebUI模块。WebUI模块从接口管理模块中获取接口管理模块中记录的MAC地址的数量。由WebUI模块将MAC地址的数量和/或局域网接口30301处的客户机40的MAC地址信息发送到局域网接口30301。并以WebUI模块预置的方式(预置的方式包括图片显示、文字显示等)在局域网接口30301处的客户机40的显示屏194上显示。According to some implementations in the embodiments of the present application, the client 40 at the LAN interface 30301 sends an interface query request to the router 30 . The interface query request carries the MAC address of the client 40 and/or the IP address assigned to it by the router 30 . The interface query request is sent to the WebUI module through the LAN interface 30301, the switch 307, the MAC processing unit included in the processor 302, and the virtual interface corresponding to the LAN interface 30301. The WebUI module obtains the number of MAC addresses recorded in the interface management module from the interface management module. The number of MAC addresses and/or the MAC address information of the client 40 at the LAN interface 30301 is sent to the LAN interface 30301 by the WebUI module. And it is displayed on the display screen 194 of the client 40 at the LAN interface 30301 in a manner preset by the WebUI module (the preset manner includes picture display, text display, etc.).

值得注意的是,接口查询请求经过局域网接口30301、交换机307、处理器302中包括的MAC处理单元、局域网接口30301对应的虚拟接口的处理过程和图4(b)所示的IP请求经局域网接口30301、交换机307、处理器302中包括的MAC处理单元、局域网接口30301对应的虚拟接口的处理过程相同,本申请实施例在此不再赘述。It is worth noting that the interface query request passes through the MAC processing unit included in the LAN interface 30301, the switch 307, the processor 302, the processing process of the virtual interface corresponding to the LAN interface 30301, and the IP request shown in FIG. 4(b) through the LAN interface. 30301 , the switch 307 , the MAC processing unit included in the processor 302 , and the virtual interface corresponding to the local area network interface 30301 have the same processing procedures, which will not be repeated in this embodiment of the present application.

可以理解的是,连接至路由器30的其余的客户机40请求路由器30的WebUI模块为其提供MAC地址和连接至路由器30的客户机总的数量可以和图4(c))互相参照。It can be understood that the remaining clients 40 connected to the router 30 request the WebUI module of the router 30 to provide MAC addresses and the total number of clients connected to the router 30 can be cross-referenced with FIG. 4( c )).

值得注意的是,本申请实施例中除了客户机40对应连接于局域网接口3030、广域网接口3031和路由器配置接口3032上对路由器30进行访问外。具有管理员权限的客户机40可以请求路由器30的DHCP服务器为连接至路由器30的其余的客户机分配IP,或者请求WebUI模块为连接至路由器30的其余的客户机提供MAC地址和连接至路由器30的客户机总的数量。It should be noted that in the embodiment of the present application, except that the client 40 is correspondingly connected to the LAN interface 3030 , the WAN interface 3031 and the router configuration interface 3032 to access the router 30 . The client computer 40 with administrator authority can request the DHCP server of the router 30 to assign IPs for the remaining clients connected to the router 30, or request the WebUI module to provide MAC addresses and connect to the router 30 for the remaining clients connected to the router 30 total number of clients.

通过本申请以上的实施方式,路由器30的WebUI模块可以能为连接至局域网接口3030的客户机40提供MAC地址和连接至路由器30的客户机总的数量。但是,如上所述的这些信息在某些场景下还不够。举例来说,当连接至局域网接口30301、局域网接口30302和局域网接口30303的线缆过多时,线缆会交织在一起,用户很难找到每条线缆501对应连接的客户机40和路由器30的接口。当用户需要移除某一客户机40时,需要逐一的对每条线缆501进行排查,容易导致其他客户机40与路由器30直接被断开,影响用户体验。本申请实施例例进一步提供了向客户机提供关于物理接口的位置的方法,下面对本申请提供的另一些实施方式所提到的附图进行说明:Through the above embodiments of the present application, the WebUI module of the router 30 may be able to provide the MAC address and the total number of clients connected to the router 30 for the client 40 connected to the LAN interface 3030 . However, the above information is not enough in some scenarios. For example, when there are too many cables connected to the LAN interface 30301, the LAN interface 30302, and the LAN interface 30303, the cables will be intertwined, and it is difficult for the user to find the corresponding connection between the client 40 and the router 30 for each cable 501. interface. When a user needs to remove a certain client 40, it is necessary to check each cable 501 one by one, which may easily cause other clients 40 to be directly disconnected from the router 30, affecting user experience. The embodiment of the present application further provides a method for providing the location of the physical interface to the client. The following describes the drawings mentioned in other implementations provided by the present application:

图5(a)为本申请实施例提供的一种客户机和路由器接口组成的系统实现IP分配的结构示意图;图5(a)为本申请实施例提供的一种客户机和路由器接口组成的系统实现接口信息查询的结构示意图;图5(c)为本申请实施例提供的一种客户机查询路由器接口的方法的流程示意图;图5(d)为本申请实施例提供的一种客户机显示路由器接口的示意图。Fig. 5 (a) is a kind of client computer that the embodiment of the application forms and the system that router interface forms realizes the structural diagram of IP assignment; The structural diagram of the system implementing interface information query; Figure 5 (c) is a schematic flow diagram of a method for a client to query a router interface provided by the embodiment of the application; Figure 5 (d) is a client provided by the embodiment of the application A diagram showing the router's interfaces.

仍以图1所示的应用场景为例,接口303中的局域网接口3030、广域网接口3031和路由器配置接口3032均对应映射有虚拟接口。局域网接口3030、广域网接口3031和路由器配置接口3032和虚拟接口直接映射的方式是在进行路由器设计时,将接口303中的每一个物理接口分别绑定一个虚拟接口。即在虚拟接口标记对应的物理接口的接口标识,如此,通过该接口标识(如物理接口的编号、类型或功能参数等)即可查找到该虚拟接口对应的物理接口。Still taking the application scenario shown in FIG. 1 as an example, the LAN interface 3030, the WAN interface 3031, and the router configuration interface 3032 in the interface 303 are all mapped with virtual interfaces. The manner in which the LAN interface 3030, the WAN interface 3031, and the router configuration interface 3032 are directly mapped to the virtual interface is to bind each physical interface in the interface 303 to a virtual interface when designing the router. That is, the interface identifier of the corresponding physical interface is marked on the virtual interface, so that the physical interface corresponding to the virtual interface can be found through the interface identifier (such as the number, type, or function parameter of the physical interface, etc.).

下面对路由器30为客户机40分配IP地址的过程进行说明:The process of assigning an IP address to the client 40 by the router 30 is described below:

首先,如图5(a)所示的,客户机和路由器接口组成的系统实现IP分配的结构包括局域网接口30301处的客户机40、交换机307、处理器302、与局域网接口30301相映射的虚拟接口和与其余的路由器的物理接口映射的虚拟接口、DHCP服务器、路由网络模块303(TCP/IP协议)和接口管理模块。At first, as shown in Fig. 5 (a), the structure that the system that the client computer and router interface forms realizes IP allocation includes the client computer 40 at LAN interface 30301, switch 307, processor 302, the virtual network that maps with LAN interface 30301 The interface and the virtual interface mapped with the physical interface of the remaining routers, the DHCP server, the routing network module 303 (TCP/IP protocol) and the interface management module.

值得注意的是,接口查询请求经过局域网接口30301、交换机307、处理器302中包括的MAC处理单元、局域网接口30301对应的虚拟接口的处理过程和图4(b)所示的IP请求经局域网接口30301、交换机307、处理器302中包括的MAC处理单元、局域网接口30301对应的虚拟接口的处理过程相同,本申请实施例在此不再赘述。It is worth noting that the interface query request passes through the MAC processing unit included in the LAN interface 30301, the switch 307, the processor 302, the processing process of the virtual interface corresponding to the LAN interface 30301, and the IP request shown in FIG. 4(b) through the LAN interface. 30301 , the switch 307 , the MAC processing unit included in the processor 302 , and the virtual interface corresponding to the local area network interface 30301 have the same processing procedures, which will not be repeated in this embodiment of the present application.

针对图5(a),下面对图5(a)中路由器30为客户机40分配IP地址的流程进行说明:With respect to Fig. 5(a), the process of assigning an IP address to the client 40 by the router 30 in Fig. 5(a) is described below:

局域网接口30301处的客户机40向路由器30发送IP请求,IP请求中携带该客户机40的MAC地址。IP请求经局域网接口30301、交换机307、处理器302中包括的MAC处理单元和与局域网接口30301相绑定的虚拟接口传输到路由器30的DHCP服务器和接口管理模块。The client 40 at the LAN interface 30301 sends an IP request to the router 30, and the IP request carries the MAC address of the client 40. The IP request is transmitted to the DHCP server and the interface management module of the router 30 through the LAN interface 30301 , the switch 307 , the MAC processing unit included in the processor 302 and the virtual interface bound to the LAN interface 30301 .

DHCP服务器为局域网接口30301处的客户机40分配IP地址。分配IP地址具体是:DHCP服务器响应IP请求,并从地址池中分配IP地址,通过一虚拟接口将局域网接口30301的数据以数据包的形式发送至处理器302。处理器302中的MAC处理单元将数据包转换为比特流发送至交换机307。交换机307从比特流解析出客户机40的MAC地址,并基于MAC地址将IP地址发送到局域网接口30301供客户机40通过该IP地址访问路由器30。The DHCP server assigns an IP address to the client 40 at the LAN interface 30301. Assigning an IP address specifically includes: the DHCP server responds to the IP request, allocates an IP address from the address pool, and sends the data of the LAN interface 30301 to the processor 302 in the form of a data packet through a virtual interface. The MAC processing unit in the processor 302 converts the data packet into a bit stream and sends it to the switch 307 . The switch 307 parses out the MAC address of the client 40 from the bit stream, and sends the IP address to the LAN interface 30301 based on the MAC address for the client 40 to access the router 30 through the IP address.

值得注意的是,IP请求经过局域网接口30301、交换机307、处理器302中包括的MAC处理单元、局域网接口30301对应的虚拟接口的处理过程和图4(b)所示的IP请求经局域网接口30301、交换机307、处理器302中包括的MAC处理单元、局域网接口30301对应的虚拟接口的处理过程相同,本申请实施例在此不再赘述。It is worth noting that the IP request passes through the MAC processing unit included in the LAN interface 30301, the switch 307, the processor 302, the processing process of the virtual interface corresponding to the LAN interface 30301, and the IP request shown in FIG. 4(b) passes through the LAN interface 30301 , the switch 307 , the MAC processing unit included in the processor 302 , and the virtual interface corresponding to the local area network interface 30301 have the same processing procedures, which will not be repeated in this embodiment of the present application.

接口管理模块识别当前客户机40的IP请求从哪个虚拟接口上报,然后由接口管理模块将IP请求中携带的MAC地址与该虚拟接口(作为目标虚拟接口)绑定。或者由接口管理模块将DHCP服务器分配的IP地址与该虚拟接口绑定。或者由接口管理模块将IP请求中携带的MAC地址和DHCP服务器分配的IP地址均与该虚拟接口绑定。如此,虚拟接口的虚拟接口参数包含但不限于与该目标虚拟接口绑定的目标物理接口的物理接口信息、IP请求中携带的MAC地址和DHCP服务器分配的IP地址。The interface management module identifies the virtual interface from which the IP request of the current client 40 is reported, and then the interface management module binds the MAC address carried in the IP request to the virtual interface (as the target virtual interface). Or the interface management module binds the IP address assigned by the DHCP server to the virtual interface. Alternatively, the interface management module binds both the MAC address carried in the IP request and the IP address assigned by the DHCP server to the virtual interface. Thus, the virtual interface parameters of the virtual interface include, but are not limited to, the physical interface information of the target physical interface bound to the target virtual interface, the MAC address carried in the IP request, and the IP address assigned by the DHCP server.

进一步,在客户机40从路由器30的接口移除时,为了避免对路由器30的虚拟接口的占用。本申请实施例中在客户机40从路由器30的接口移除时。由路由器擦除IP地址和目标虚拟接口的绑定信息、或者由路由器擦除客户机的MAC地址和目标虚拟接口的绑定信息或者由路由器擦除客户机的MAC地址和IP地址与目标虚拟接口的绑定信息从而避免了占用路由器的虚拟接口资源。进一步的,也可以由路由器擦除该客户机40的IP地址和MAC地址。Further, when the client 40 is removed from the interface of the router 30, in order to avoid occupation of the virtual interface of the router 30. In the embodiment of the present application, when the client 40 is removed from the interface of the router 30 . The router erases the binding information between the IP address and the target virtual interface, or the router erases the binding information between the client's MAC address and the target virtual interface, or the router erases the client's MAC address and IP address and the target virtual interface binding information to avoid occupying the virtual interface resources of the router. Further, the IP address and MAC address of the client 40 may also be erased by the router.

其次,对路由器30为客户机40的局域网接口30301的信息进行查询的过程进行说明:Secondly, the process of querying the information of the router 30 as the LAN interface 30301 of the client 40 is described:

如图5(b)所示的,客户机和路由器接口组成的系统实现接口信息查询的结构包括局域网接口30301处的客户机40、交换机307、处理器302、与局域网接口30301相映射的虚拟接口和与其余的路由器的物理接口映射的虚拟接口、WebUI模块、路由网络模块303(TCP/IP协议)和接口管理模块。As shown in Fig. 5 (b), the structure that the system that client computer and router interface are formed realizes interface information query includes client computer 40 at LAN interface 30301, switch 307, processor 302, the virtual interface that maps with LAN interface 30301 And the virtual interface mapped with the physical interface of the remaining routers, the WebUI module, the routing network module 303 (TCP/IP protocol) and the interface management module.

根据本申请实施例中的一些实现方式,局域网接口30301处的客户机40向路由器30发出接口查询请求。接口查询请求中携带客户机40的MAC地址和/或路由器30为其分配的IP地址。接口查询请求经局域网接口30301、交换机307、处理器302中包括的MAC处理单元、局域网接口30301对应的虚拟接口发送到WebUI模块。WebUI模块从接口管理模块中获取接口管理模块中该IP地址对应的路由器30的物理接口信息。由WebUI模块将物理接口信息发送到局域网接口30301。并以WebUI模块预置的方式(预置的方式包括图片显示、文字显示等)在局域网接口30301处的客户机40的显示屏194上显示。According to some implementations in the embodiments of the present application, the client 40 at the LAN interface 30301 sends an interface query request to the router 30 . The interface query request carries the MAC address of the client 40 and/or the IP address assigned to it by the router 30 . The interface query request is sent to the WebUI module through the LAN interface 30301, the switch 307, the MAC processing unit included in the processor 302, and the virtual interface corresponding to the LAN interface 30301. The WebUI module obtains the physical interface information of the router 30 corresponding to the IP address in the interface management module from the interface management module. The physical interface information is sent to the LAN interface 30301 by the WebUI module. And it is displayed on the display screen 194 of the client 40 at the LAN interface 30301 in a manner preset by the WebUI module (the preset manner includes picture display, text display, etc.).

针对图5(b),下面对结合图5(c)对图5(b)中路由器30对客户机40连接的局域网接口30301的接口信息查询的流程进行说明。Referring to FIG. 5( b ), the process of querying the interface information of the LAN interface 30301 connected to the client 40 by the router 30 in FIG. 5( b ) will be described below in conjunction with FIG. 5( c ).

如图5(c)所示,客户机查询路由器接口的方法包括:As shown in Figure 5(c), the methods for the client to query the router interface include:

步骤S30:局域网接口30301处的客户机40(作为目标电子设备)向路由器30发送接口查询请求。Step S30: the client 40 (as the target electronic device) at the LAN interface 30301 sends an interface query request to the router 30 .

接口查询请求中携带局域网接口30301处的客户机40的MAC地址和/或路由器30为其分配的IP地址。连接至局域网接口30302和局域网接口30303或其余接口的客户机或其他设备可以作为其余的电子设备。值得注意的是,具有管理员权限的客户机或其他类型的电子设备可以作为本申请实施例中的第一电子设备,查询连接至路由器30上的其余电子设备或者局域网接口30301处的客户机40的物理接口信息。The interface query request carries the MAC address of the client 40 at the LAN interface 30301 and/or the IP address assigned to it by the router 30 . Clients or other devices connected to the LAN interface 30302 and the LAN interface 30303 or other interfaces can serve as the rest of the electronic equipment. It should be noted that a client computer or other type of electronic device with administrator authority can be used as the first electronic device in the embodiment of the present application to inquire about other electronic devices connected to the router 30 or the client computer 40 at the LAN interface 30301 physical interface information.

局域网接口30301处的客户机40向路由器30发送接口查询请求时,接口查询请求经局域网接口30301、交换机307、处理器302中的MAC处理单元和与局域网接口30301相绑定的虚拟接口传输到路由器30的WebUI模块。When the client 40 at the LAN interface 30301 sends an interface query request to the router 30, the interface query request is transmitted to the router through the MAC processing unit in the LAN interface 30301, the switch 307, the processor 302 and the virtual interface bound to the LAN interface 30301 30 WebUI modules.

值得注意的是,接口查询请求经过局域网接口30301、交换机307、处理器302中包括的MAC处理单元、局域网接口30301对应的虚拟接口的处理过程和图4(b)所示的IP请求经局域网接口30301、交换机307、处理器302中包括的MAC处理单元、局域网接口30301对应的虚拟接口的处理过程相同,本申请实施例在此不再赘述。It is worth noting that the interface query request passes through the MAC processing unit included in the LAN interface 30301, the switch 307, the processor 302, the processing process of the virtual interface corresponding to the LAN interface 30301, and the IP request shown in FIG. 4(b) through the LAN interface. 30301 , the switch 307 , the MAC processing unit included in the processor 302 , and the virtual interface corresponding to the local area network interface 30301 have the same processing procedures, which will not be repeated in this embodiment of the present application.

步骤S31:路由器30根据接口查询请求,确定局域网接口30301处的客户机40的IP地址关联的目标虚拟接口。具体是接口管理模块获取到接口查询请求中局域网接口30301处的客户机40的IP地址和MAC地址。路由器30的WebUI模块请求接口管理模块查询该客户机40的IP地址和/或MAC地址绑定的虚拟接口(作为目标虚拟接口)。Step S31: The router 30 determines the target virtual interface associated with the IP address of the client 40 at the LAN interface 30301 according to the interface query request. Specifically, the interface management module obtains the IP address and MAC address of the client 40 at the LAN interface 30301 in the interface query request. The WebUI module of the router 30 requests the interface management module to query the virtual interface bound to the IP address and/or MAC address of the client 40 (as the target virtual interface).

步骤S32:路由器30根据预设的虚拟接口和物理接口的映射关系确定目标虚拟接口对应的目标物理接口。预设的虚拟接口和物理接口的映射关系指的是:对每一个物理接口都对应配置一个虚拟接口。虚拟接口的虚拟接口参数中包含物理接口的接口标识,以一一对应的方式将虚拟接口和物理接口进行映射配置。记录虚拟接口和与虚拟接口对应的物理接口的映射关系的配置文件被存储在路由器的存储器中。确定目标虚拟接口对应的目标物理接口的过程具体是:路由器的接口管理模块根据该目标虚拟接口中预设的目标物理接口的接口标识确定与该目标虚拟接口对应的目标物理接口。Step S32: The router 30 determines the target physical interface corresponding to the target virtual interface according to the preset mapping relationship between the virtual interface and the physical interface. The preset mapping relationship between a virtual interface and a physical interface means that a virtual interface is correspondingly configured for each physical interface. The virtual interface parameter of the virtual interface includes the interface identifier of the physical interface, and the virtual interface and the physical interface are mapped and configured in a one-to-one correspondence manner. The configuration file recording the mapping relationship between the virtual interface and the physical interface corresponding to the virtual interface is stored in the memory of the router. The process of determining the target physical interface corresponding to the target virtual interface is specifically: the interface management module of the router determines the target physical interface corresponding to the target virtual interface according to the interface identifier of the target physical interface preset in the target virtual interface.

步骤S33:路由器30查找目标物理接口的物理接口信息,并将目标物理接口的目标物理接口发送至客户机40。具体是:路由器30的WebUI模块将该目标物理接口的物理接口信息提供至局域网接口30301处的客户机40。Step S33: the router 30 searches for the physical interface information of the target physical interface, and sends the target physical interface of the target physical interface to the client 40. Specifically: the WebUI module of the router 30 provides the physical interface information of the target physical interface to the client 40 at the LAN interface 30301 .

局域网接口30301处的客户机40可以在显示屏405上以图片形式显示该物理接口信息,也可以通过客户机40播放该物理接口信息。从而便于用户查找局域网接口30301。The client 40 at the LAN interface 30301 can display the physical interface information in the form of a picture on the display screen 405 , and can also play the physical interface information through the client 40 . Thereby, it is convenient for the user to find the LAN interface 30301.

物理接口信息包括局域网接口30301的接口标识(如接口编号、型号和功能参数等)、局域网接口30301在路由器30上的位置(接口示意图)的图片等。The physical interface information includes the interface identification of the LAN interface 30301 (such as interface number, model, and function parameters, etc.), a picture of the location of the LAN interface 30301 on the router 30 (interface schematic diagram), and the like.

如图5(d)所示的,客户机40在显示屏405上显示客户机40的基本信息(电量信息101B和时间101C)和物理接口信息。物理接口信息以图片形式显示局域网接口30301在路由器30上的具体位置、局域网接口的编号(如30301)、连接至路由器的客户机的数量(r如3个)、局域网接口处客户机的MAC地址(如44-45-53-54-00-01)、局域网接口30301上连接的客户机的名称(如Bob)等信息。本申请实施例中以图片形式显示局域网接口30301在路由器30上的具体位置具体以路由器30上的其余的物理接口为参照,以重色显示该局域网接口30301并同时显示局域网接口的编号30301。值得注意的是,物理显示信息可以在客户机40上还可以以其他方式提示,如语音播报、文字说明等方式,本申请实施例在此并不作限定。客户机40在显示屏405上以图片形式显示的信息也并不局限于图5(d)的示例。As shown in FIG. 5( d ), the client 40 displays the basic information (power information 101B and time 101C) and physical interface information of the client 40 on the display screen 405 . The physical interface information displays the specific location of the LAN interface 30301 on the router 30, the serial number of the LAN interface (such as 30301), the number of clients connected to the router (such as 3), and the MAC address of the client computer at the LAN interface in the form of a picture. (such as 44-45-53-54-00-01), the name of the client connected to the LAN interface 30301 (such as Bob) and other information. In the embodiment of the present application, the specific location of the LAN interface 30301 on the router 30 is displayed in the form of a picture, specifically referring to the rest of the physical interfaces on the router 30, and the LAN interface 30301 is displayed in a heavy color and the serial number 30301 of the LAN interface is displayed at the same time. It is worth noting that the physical display information can be prompted on the client 40 or in other ways, such as voice broadcast, text description, etc., which are not limited in this embodiment of the present application. The information displayed by the client computer 40 in the form of pictures on the display screen 405 is not limited to the example shown in FIG. 5( d ).

值得注意的是,物理接口信息中还可以包含连接至局域网接口30301的客户机40的MAC地址、所有连接至路由器30的客户机40的数量等。对于物理接口信息包含的内容本申请实施例并不作限定。It should be noted that the physical interface information may also include the MAC address of the client 40 connected to the LAN interface 30301 , the number of all clients 40 connected to the router 30 , and the like. The content contained in the physical interface information is not limited in this embodiment of the application.

通过本申请以上的实施方式,可以看出的是,路由器能为连接至路由器的目标物理接口的客户机提供该目标物理接口在路由器上的位置。即使连接至路由器接口的多个客户机的线缆交织在一起,用户可以根据路由器指示的目标物理接口在路由器上的位置很快的查找到该客户机所连接的目标物理接口。当用户需要移除某一客户机时,直接基于指示的目标物理接口的位置在路由器上对应查找,并对该客户机所连接的接口进行操作。也不会造成其余的客户机与路由器断开,提升了用户体验感。Through the above implementation manners of the present application, it can be seen that the router can provide the client connected to the target physical interface of the router with the location of the target physical interface on the router. Even if the cables of multiple client computers connected to the router interface are intertwined, the user can quickly find the target physical interface to which the client computer is connected according to the position of the target physical interface indicated by the router on the router. When the user needs to remove a certain client computer, the corresponding search is directly performed on the router based on the position of the indicated target physical interface, and the operation is performed on the interface connected to the client computer. It will not cause other clients to be disconnected from the router, which improves the user experience.

其中,本申请实施例公开的一种路由器连接有至少一个电子设备,并为各电子设备分配IP地址。路由器确定与电子设备连接的路由器接口的方法包括以下步骤:Wherein, a router disclosed in the embodiment of the present application is connected with at least one electronic device, and assigns an IP address to each electronic device. A method for a router to determine a router interface connected to an electronic device includes the following steps:

基于接口查询请求确定与目标电子设备的IP地址关联的目标虚拟接口,并且根据预设的虚拟接口和物理接口的映射关系确定与目标虚拟接口对应的目标物理接口。The target virtual interface associated with the IP address of the target electronic device is determined based on the interface query request, and the target physical interface corresponding to the target virtual interface is determined according to a preset mapping relationship between the virtual interface and the physical interface.

接口查询请求由至少一个电子设备中的第一电子设备向路由器发送,接口查询请求至少用于向路由器查询至少一个电子设备中以有线方式接入路由器的目标电子设备所连接的路由器的物理接口的位置。The interface query request is sent to the router by the first electronic device in the at least one electronic device, and the interface query request is at least used to query the router for the physical interface of the router connected to the target electronic device connected to the router in a wired manner among the at least one electronic device Location.

将目标物理接口关联的物理接口信息发送至第一电子设备,物理接口信息至少指示目标电子设备在路由器上的物理接口的位置。The physical interface information associated with the target physical interface is sent to the first electronic device, where the physical interface information at least indicates the location of the physical interface of the target electronic device on the router.

对于第一电子设备而言,其可以为具有管理员权限的电子设备,也可以作为目标电子设备。具有管理员权限的第一电子设备可以请求路由器查询连接于路由器上的任意一个或多个目标电子设备的物理接口信息。作为连接于路由器的物理接口的目标电子设备的第一电子设备可以请求路由器查询其自身的物理接口信息。As for the first electronic device, it may be an electronic device with administrator authority, or may be a target electronic device. The first electronic device with administrator authority may request the router to query the physical interface information of any one or more target electronic devices connected to the router. The first electronic device, which is a target electronic device connected to the physical interface of the router, may request the router to inquire about its own physical interface information.

对于路由器为电子设备分配IP地址的具体过程是:连接于路由器的物理接口的各电子设备向路由器发送IP请求。IP请求中携带路由器的MAC地址。IP请求经物理接口和与物理接口相绑定的虚拟接口传输到路由器的DHCP服务器和接口管理模块。The specific process for the router to assign IP addresses to electronic devices is: each electronic device connected to the physical interface of the router sends an IP request to the router. The MAC address of the router is carried in the IP request. The IP request is transmitted to the DHCP server and the interface management module of the router through the physical interface and the virtual interface bound to the physical interface.

DHCP服务器为连接于物理接口处的电子设备分配IP地址。分配IP地址具体是:DHCP服务器响应IP请求,并从地址池中分配IP地址,通过于物理接口绑定的虚拟接口基于MAC地址将IP地址发送到物理接口供电子设备通过该IP地址访问路由器。A DHCP server assigns IP addresses to electronic devices connected to physical interfaces. Assigning an IP address is specifically: the DHCP server responds to the IP request, and assigns an IP address from the address pool, and sends the IP address to the physical interface based on the MAC address through the virtual interface bound to the physical interface for the electronic device to access the router through the IP address.

接口管理模块识别当前电子设备的IP请求从哪个虚拟接口上报,然后由接口管理模块将IP请求中携带的MAC地址与该虚拟接口(作为目标虚拟接口)绑定。或者由接口管理模块将DHCP服务器分配的IP地址与该虚拟接口绑定。或者由接口管理模块将IP请求中携带的MAC地址和DHCP服务器分配的IP地址均与该虚拟接口绑定。如此,虚拟接口的虚拟接口参数包含但不限于与该目标虚拟接口绑定的目标物理接口的物理接口信息、IP请求中携带的MAC地址和DHCP服务器分配的IP地址。The interface management module identifies the virtual interface from which the IP request of the current electronic device is reported, and then the interface management module binds the MAC address carried in the IP request to the virtual interface (as the target virtual interface). Or the interface management module binds the IP address assigned by the DHCP server to the virtual interface. Alternatively, the interface management module binds both the MAC address carried in the IP request and the IP address assigned by the DHCP server to the virtual interface. Thus, the virtual interface parameters of the virtual interface include, but are not limited to, the physical interface information of the target physical interface bound to the target virtual interface, the MAC address carried in the IP request, and the IP address assigned by the DHCP server.

进一步,接口查询请求中携带连接于目标物理接口的目标电子设备的MAC地址和/或路由器为其分配的IP地址。值得注意的是,具有管理员权限的电子设备可以作为本申请实施例中的第一电子设备,查询连接至路由器上的其余电子设备的物理接口信息。Further, the interface query request carries the MAC address of the target electronic device connected to the target physical interface and/or the IP address assigned to it by the router. It should be noted that the electronic device with administrator authority can serve as the first electronic device in the embodiment of the present application, and query the physical interface information of other electronic devices connected to the router.

第一电子设备发送接口查询请求时,接口查询请求经物理接口、交换机、处理器和与物理接口相绑定的虚拟接口传输到路由器的WebUI模块。When the first electronic device sends an interface query request, the interface query request is transmitted to the WebUI module of the router via the physical interface, the switch, the processor, and the virtual interface bound to the physical interface.

路由器根据接口查询请求,确定目标物理接口处的目标电子设备的IP地址关联的目标虚拟接口。具体是接口管理模块获取到接口查询请求中的目标电子设备IP地址和MAC地址。路由器的WebUI模块请求接口管理模块查询该目标电子设备的IP地址和/或MAC地址绑定的虚拟接口(作为目标虚拟接口)。The router determines the target virtual interface associated with the IP address of the target electronic device at the target physical interface according to the interface query request. Specifically, the interface management module obtains the IP address and MAC address of the target electronic device in the interface query request. The WebUI module of the router requests the interface management module to query the virtual interface bound to the IP address and/or MAC address of the target electronic device (as the target virtual interface).

路由器根据预设的虚拟接口和物理接口的映射关系确定目标虚拟接口对应的目标物理接口。具体是:路由器的接口管理模块根据该目标虚拟接口中预设的目标物理接口的接口标识确定与该目标虚拟接口对应的目标物理接口。The router determines the target physical interface corresponding to the target virtual interface according to the preset mapping relationship between the virtual interface and the physical interface. Specifically, the interface management module of the router determines the target physical interface corresponding to the target virtual interface according to the preset interface identifier of the target physical interface in the target virtual interface.

路由器查找目标物理接口的物理接口信息,并将目标物理接口的目标物理接口发送至第一电子设备。具体是:路由器的WebUI模块将该目标物理接口的物理接口信息提供至请求查询目标电子设备的物理接口信息的第一电子设备。The router searches the physical interface information of the target physical interface, and sends the target physical interface of the target physical interface to the first electronic device. Specifically, the WebUI module of the router provides the physical interface information of the target physical interface to the first electronic device that requests to query the physical interface information of the target electronic device.

第一电子设备可以在显示屏上以图片形式显示该物理接口信息,也可以通过电子设备播放该物理接口信息。从而便于用户查找目标电子设备的具体的物理接口。The first electronic device may display the physical interface information in the form of a picture on the display screen, or play the physical interface information through the electronic device. Thus, it is convenient for the user to find the specific physical interface of the target electronic device.

物理接口信息包括目标电子设备的接口标识(如接口编号、类型和功能参数等)、目标电子设备的目标物理接口在路由器上的位置(接口示意图)的图片等。The physical interface information includes the interface identification (such as interface number, type and function parameters, etc.) of the target electronic device, a picture of the position (schematic diagram of the interface) of the target physical interface of the target electronic device on the router, and the like.

在本申请一些实施例中,还提供了一种路由器,如图2(a)所示例的,运行指令以实施上述路由器确定与电子设备连接的路由器接口的方法。In some embodiments of the present application, a router is also provided, as shown in FIG. 2( a ), running instructions to implement the above method for the router to determine the router interface connected to the electronic device.

现在参考图7,图7为本申请实施例公开的一种SOC的结构示意图,所示为根据本申请的一实施例的SoC(SystemonChip,片上系统)1000的框图。在图7中,相似的部件具有同样的附图标记。另外,虚线框是更先进的SoC的可选特征。该SoC可以被用于根据本申请的一实施例的路由器,根据其内所存储的指令,可以实现相应的功能。Referring now to FIG. 7 , FIG. 7 is a schematic structural diagram of an SOC disclosed in an embodiment of the present application, showing a block diagram of a SoC (System on Chip, system on chip) 1000 according to an embodiment of the present application. In Fig. 7, similar parts have the same reference numerals. Also, dashed boxes are optional features for more advanced SoCs. The SoC can be used in a router according to an embodiment of the present application, and corresponding functions can be realized according to instructions stored therein.

在图7中,SoC1000包括:互连单元1002,其被耦合至处理器1001;系统代理单元1006;总线控制器单元1005;集成存储器控制器单元1003;一组或一个或多个协处理器1007,其可包括集成图形逻辑、图像处理器、音频处理器和视频处理器;静态随机存取存储器(SRAM)单元1008;直接存储器存取(DMA)单元1004。在一个实施例中,协处理器1007包括专用处理器,诸如例如网络或通信处理器、压缩引擎、GPGPU、高吞吐量MIC处理器、或嵌入式处理器等等。In FIG. 7, SoC 1000 includes: interconnection unit 1002, which is coupled to processor 1001; system agent unit 1006; bus controller unit 1005; integrated memory controller unit 1003; one or more coprocessors 1007 , which may include integrated graphics logic, an image processor, an audio processor, and a video processor; a static random access memory (SRAM) unit 1008; a direct memory access (DMA) unit 1004. In one embodiment, the coprocessor 1007 includes a special purpose processor such as, for example, a network or communication processor, a compression engine, a GPGPU, a high throughput MIC processor, or an embedded processor, among others.

静态随机存取存储器(SRAM)单元1008中可以包括用于存储数据和/或指令的一个或多个计算机可读介质。计算机可读存储介质中可以存储有指令,具体而言,存储有该指令的暂时和永久副本。One or more computer-readable media for storing data and/or instructions may be included in static random access memory (SRAM) unit 1008 . Computer-readable storage media may have instructions stored thereon, and specifically, both temporary and permanent copies of the instructions.

在SoC1000被应用于根据本申请的路由器上时,计算机可读存储介质中存储有指令可以包括:由处理器中的至少一个单元执行时导致路由器实施如以上实施例所提到的路由器确定与电子设备连接的路由器接口的指令。当指令在计算机上运行时,使得计算机执行上述如以上实施例所提到的路由器确定与电子设备连接的路由器接口的指令。When the SoC1000 is applied to a router according to the present application, the instructions stored in the computer-readable storage medium may include: when executed by at least one unit in the processor, cause the router to implement the router determination and electronic Instructions for the router interface to which the device is connected. When the instruction is run on the computer, the computer is made to execute the above-mentioned instruction for the router to determine the router interface connected to the electronic device as mentioned in the above embodiment.

此外,本申请实施例还公开了一种计算机可读存储介质,计算机可读存储介质上存储有处理程序,处理程序被处理器执行时实现如以上实施例所提到的路由器确定与电子设备连接的路由器接口的指令。In addition, the embodiment of the present application also discloses a computer-readable storage medium. The computer-readable storage medium stores a processing program. When the processing program is executed by the processor, the router as mentioned in the above embodiments can determine the connection with the electronic device. Instructions for the router interface.

计算机可读存储介质可以为只读存储器、随机存取存储器、硬盘或者光盘等。The computer-readable storage medium may be a read-only memory, a random access memory, a hard disk, or an optical disk.

Claims (18)

1.一种电子设备查询路由器接口的方法,所述路由器连接有至少一个电子设备,并为各所述电子设备分配IP地址,其特征在于,1. A method for an electronic device to inquire about a router interface, the router is connected with at least one electronic device, and distributes an IP address for each of the electronic devices, wherein, 至少一个所述电子设备中的第一电子设备向所述路由器发送接口查询请求,所述接口查询请求至少用于向所述路由器查询至少一个所述电子设备中的以有线方式与所述路由器连接的目标电子设备所连接的所述路由器的物理接口的位置,所述接口查询请求包括与所述目标电子设备的IP地址关联的目标虚拟接口的标识信息;A first electronic device in at least one of the electronic devices sends an interface query request to the router, and the interface query request is at least used to query the router for at least one of the electronic devices connected to the router in a wired manner The location of the physical interface of the router to which the target electronic device is connected, and the interface query request includes identification information of a target virtual interface associated with the IP address of the target electronic device; 所述路由器根据所述接口查询请求,确定与所述目标电子设备的IP地址关联的所述目标虚拟接口,并且所述路由器根据预设的虚拟接口与物理接口的映射关系确定与所述目标虚拟接口对应的目标物理接口;The router determines the target virtual interface associated with the IP address of the target electronic device according to the interface query request, and the router determines the target virtual interface according to a preset mapping relationship between a virtual interface and a physical interface. The target physical interface corresponding to the interface; 所述路由器将所述目标物理接口关联的物理接口信息发送至所述第一电子设备,所述物理接口信息至少指示所述目标电子设备在所述路由器上的物理接口的位置,所述物理接口信息为所述路由器向所述第一电子设备提供便于用户查找所述目标电子设备在所述路由器上的物理接口的信息;The router sends physical interface information associated with the target physical interface to the first electronic device, where the physical interface information at least indicates the location of the physical interface of the target electronic device on the router, and the physical interface The information is for the router to provide the first electronic device with information that facilitates the user to find the physical interface of the target electronic device on the router; 所述第一电子设备根据所述物理接口信息,呈现所述目标电子设备在所述路由器上的物理接口的位置。The first electronic device presents the location of the physical interface of the target electronic device on the router according to the physical interface information. 2.如权利要求1所述的电子设备查询路由器接口的方法,其特征在于,所述物理接口信息包括关联的所述目标物理接口的接口标识。2. The method for querying a router interface by an electronic device according to claim 1, wherein the physical interface information includes an associated interface identifier of the target physical interface. 3.如权利要求2所述的电子设备查询路由器接口的方法,其特征在于,所述物理接口信息包括与所述目标物理接口关联的接口标识,并且所述路由器基于所述物理接口信息向所述第一电子设备提供接口示意图,且以图形的形式显示所述目标物理接口的在路由器上的位置。3. The method for an electronic device to query a router interface according to claim 2, wherein the physical interface information includes an interface identifier associated with the target physical interface, and the router reports to the target physical interface based on the physical interface information. The first electronic device provides a schematic diagram of the interface, and displays the position of the target physical interface on the router in a graphic form. 4.如权利要求1所述的电子设备查询路由器接口的方法,其特征在于,所述目标电子设备是所述第一电子设备本身。4. The method for an electronic device to query a router interface according to claim 1, wherein the target electronic device is the first electronic device itself. 5.如权利要求1所述的电子设备查询路由器接口的方法,其特征在于,5. The method for electronic device query router interface as claimed in claim 1, characterized in that, 至少一个所述电子设备连接所述路由器的物理接口,并向所述路由器发送IP请求,At least one of the electronic devices is connected to the physical interface of the router, and sends an IP request to the router, 所述路由器为至少一个所述电子设备分配虚拟接口,并经由所述虚拟接口接收所述IP请求以及将基于所述IP请求分配的IP地址发送至所述电子设备,其中,所述IP请求中携带所述电子设备的MAC地址。The router assigns a virtual interface to at least one of the electronic devices, receives the IP request via the virtual interface and sends the IP address assigned based on the IP request to the electronic device, wherein the IP request carrying the MAC address of the electronic device. 6.如权利要求5所述的电子设备查询路由器接口的方法,其特征在于,所述目标虚拟接口的虚拟接口参数包括所述目标物理接口的物理接口信息、所述目标电子设备的MAC地址和所述目标电子设备的IP地址。6. The method for an electronic device querying a router interface as claimed in claim 5, wherein the virtual interface parameters of the target virtual interface include physical interface information of the target physical interface, the MAC address of the target electronic device, and The IP address of the target electronic device. 7.如权利要求6所述的电子设备查询路由器接口的方法,其特征在于,所述路由器绑定所述IP地址和所述目标虚拟接口;7. The method for an electronic device querying a router interface according to claim 6, wherein the router binds the IP address and the target virtual interface; 所述路由器基于所述IP地址查询与所述IP地址对应的目标虚拟接口,并基于所述虚拟接口参数确定所述目标物理接口的物理接口信息。The router queries a target virtual interface corresponding to the IP address based on the IP address, and determines physical interface information of the target physical interface based on the virtual interface parameters. 8.如权利要求7所述的电子设备查询路由器接口的方法,其特征在于,所述电子设备从所述路由器的目标物理接口移除后,所述路由器擦除所述IP地址和所述目标虚拟接口的绑定信息。8. The method for an electronic device to query a router interface according to claim 7, wherein after the electronic device is removed from the target physical interface of the router, the router erases the IP address and the target Binding information for the virtual interface. 9.如权利要求6所述的电子设备查询路由器接口的方法,其特征在于,所述接口查询请求包括所述IP地址和/或所述MAC地址。9. The method for an electronic device to query a router interface according to claim 6, wherein the interface query request includes the IP address and/or the MAC address. 10.如权利要求9所述的电子设备查询路由器接口的方法,其特征在于,所述IP地址和所述MAC地址相绑定。10. The method for an electronic device to query a router interface according to claim 9, wherein the IP address is bound to the MAC address. 11.如权利要求10所述的电子设备查询路由器接口的方法,其特征在于,所述路由器绑定所述MAC地址和所述目标虚拟接口;11. The method for an electronic device querying a router interface according to claim 10, wherein the router binds the MAC address and the target virtual interface; 所述路由器基于所述MAC地址查询与所述MAC地址关联的IP地址;The router queries the IP address associated with the MAC address based on the MAC address; 所述路由器基于所述MAC地址查询与所述MAC地址对应的目标虚拟接口,并基于所述虚拟接口参数确定所述目标物理接口的物理接口信息。The router queries a target virtual interface corresponding to the MAC address based on the MAC address, and determines physical interface information of the target physical interface based on the virtual interface parameters. 12.如权利要求11所述的电子设备查询路由器接口的方法,其特征在于,所述电子设备从所述路由器的目标物理接口移除后,所述路由器擦除所述电子设备的MAC地址和关联的虚拟接口的绑定信息。12. The method for an electronic device to query a router interface according to claim 11, wherein after the electronic device is removed from the target physical interface of the router, the router erases the MAC address and Binding information for the associated virtual interface. 13.如权利要求1-12任意一项所述的电子设备查询路由器接口的方法,其特征在于,所述物理接口信息还包括所述电子设备的MAC地址。13. The method for querying a router interface by an electronic device according to any one of claims 1-12, wherein the physical interface information further includes a MAC address of the electronic device. 14.如权利要求13所述的电子设备查询路由器接口的方法,其特征在于,所述物理接口信息还包括所有连接于所述路由器的电子设备的数量。14. The method for an electronic device to query a router interface according to claim 13, wherein the physical interface information further includes the numbers of all electronic devices connected to the router. 15.一种路由器确定与电子设备连接的路由器接口的方法,所述路由器连接有至少一个电子设备,并为各所述电子设备分配IP地址,其特征在于,所述方法包括:15. A method for a router to determine a router interface connected to an electronic device, the router is connected to at least one electronic device, and assigns an IP address to each of the electronic devices, wherein the method comprises: 基于接口查询请求确定与目标电子设备的IP地址关联的目标虚拟接口,并且根据预设的虚拟接口与物理接口的映射关系确定与所述目标虚拟接口对应的目标物理接口;determining a target virtual interface associated with the IP address of the target electronic device based on the interface query request, and determining a target physical interface corresponding to the target virtual interface according to a preset mapping relationship between a virtual interface and a physical interface; 所述接口查询请求由至少一个所述电子设备中的第一电子设备向所述路由器发送,所述接口查询请求至少用于向路由器查询至少一个所述电子设备中以有线方式接入所述路由器的目标电子设备所连接的所述路由器的物理接口的位置,所述接口查询请求包括与所述目标电子设备的IP地址关联的所述目标虚拟接口的标识信息;The interface query request is sent to the router by the first electronic device in at least one of the electronic devices, and the interface query request is at least used to query the router for at least one of the electronic devices connected to the router in a wired manner The location of the physical interface of the router to which the target electronic device is connected, and the interface query request includes identification information of the target virtual interface associated with the IP address of the target electronic device; 将所述目标物理接口关联的物理接口信息发送至所述第一电子设备,所述物理接口信息至少指示所述目标电子设备在所述路由器上的物理接口的位置,所述物理接口信息为所述路由器向所述第一电子设备提供便于用户查找所述目标电子设备在所述路由器上的物理接口的信息,使得所述第一电子设备根据所述物理接口信息,呈现所述目标电子设备在所述路由器上的物理接口的位置。sending physical interface information associated with the target physical interface to the first electronic device, where the physical interface information at least indicates the location of the physical interface of the target electronic device on the router, and the physical interface information is the The router provides the first electronic device with information that facilitates the user to find the physical interface of the target electronic device on the router, so that the first electronic device presents the target electronic device according to the physical interface information. The location of the physical interface on the router. 16.如权利要求15所述的路由器确定与电子设备连接的路由器接口的方法,基于来自与所述路由器连接的目标电子设备的所述接口查询请求确定所述目标电子设备的物理接口信息。16. The method for a router to determine a router interface connected to an electronic device according to claim 15, wherein the physical interface information of the target electronic device is determined based on the interface query request from the target electronic device connected to the router. 17.一种路由器,其特征在于,所述路由器连接有至少一个电子设备,并为各所述电子设备分配IP地址,所述路由器包括:至少一个存储器和至少一个处理器;17. A router, characterized in that the router is connected to at least one electronic device, and assigns an IP address to each of the electronic devices, and the router includes: at least one memory and at least one processor; 至少一个所述存储器中存储有指令;instructions are stored in at least one of said memories; 当所述指令被至少一个所述处理器执行时,使得所述路由器执行以下操作:When the instruction is executed by at least one of the processors, the router is made to perform the following operations: 基于接口查询请求确定与所述目标电子设备的IP地址关联的目标虚拟接口,并且根据预设的虚拟接口与物理接口的映射关系确定与所述目标虚拟接口对应的目标物理接口;determining a target virtual interface associated with the IP address of the target electronic device based on an interface query request, and determining a target physical interface corresponding to the target virtual interface according to a preset mapping relationship between a virtual interface and a physical interface; 所述接口查询请求由至少一个所述电子设备中的第一电子设备向所述路由器发送,所述接口查询请求至少用于向路由器查询至少一个所述电子设备中以有线方式接入所述路由器的目标电子设备所连接的所述路由器的物理接口的位置,所述接口查询请求包括与所述目标电子设备的IP地址关联的所述目标虚拟接口的标识信息;The interface query request is sent to the router by the first electronic device in at least one of the electronic devices, and the interface query request is at least used to query the router for at least one of the electronic devices connected to the router in a wired manner The location of the physical interface of the router to which the target electronic device is connected, and the interface query request includes identification information of the target virtual interface associated with the IP address of the target electronic device; 将所述目标物理接口关联的物理接口信息发送至所述第一电子设备,所述物理接口信息至少指示所述目标电子设备在所述路由器上的物理接口的位置,所述物理接口信息为所述路由器向所述第一电子设备提供便于用户查找所述目标电子设备在所述路由器上的物理接口的信息,使得所述第一电子设备根据所述物理接口信息,呈现所述目标电子设备在所述路由器上的物理接口的位置。sending physical interface information associated with the target physical interface to the first electronic device, where the physical interface information at least indicates the location of the physical interface of the target electronic device on the router, and the physical interface information is the The router provides the first electronic device with information that facilitates the user to find the physical interface of the target electronic device on the router, so that the first electronic device presents the target electronic device according to the physical interface information. The location of the physical interface on the router. 18.一种通信系统,其特征在于,包括:至少一个电子设备和路由器;18. A communication system, comprising: at least one electronic device and a router; 所述路由器连接有至少一个电子设备,并为各所述电子设备分配IP地址;The router is connected to at least one electronic device, and assigns an IP address to each of the electronic devices; 至少一个所述电子设备中的第一电子设备向所述路由器发送接口查询请求,所述接口查询请求至少用于向路由器查询至少一个所述电子设备中以有线方式接入所述路由器的目标电子设备所连接的所述路由器的物理接口的位置,所述接口查询请求包括与所述目标电子设备的IP地址关联的目标虚拟接口的标识信息;The first electronic device in at least one of the electronic devices sends an interface query request to the router, and the interface query request is at least used to query the router for a target electronic device in at least one of the electronic devices that is connected to the router in a wired manner. the location of the physical interface of the router to which the device is connected, and the interface query request includes identification information of a target virtual interface associated with the IP address of the target electronic device; 所述路由器根据所述接口查询请求,确定与所述目标电子设备的IP地址关联的所述目标虚拟接口,并且所述路由器根据预设的虚拟接口与物理接口的映射关系确定与所述目标虚拟接口对应的目标物理接口;The router determines the target virtual interface associated with the IP address of the target electronic device according to the interface query request, and the router determines the target virtual interface according to a preset mapping relationship between a virtual interface and a physical interface. The target physical interface corresponding to the interface; 所述路由器将所述目标物理接口关联的物理接口信息发送至所述第一电子设备,所述物理接口信息至少指示所述目标电子设备在所述路由器上的物理接口的位置,所述物理接口信息为所述路由器向所述第一电子设备提供便于用户查找所述目标电子设备在所述路由器上的物理接口的信息;The router sends physical interface information associated with the target physical interface to the first electronic device, where the physical interface information at least indicates the location of the physical interface of the target electronic device on the router, and the physical interface The information is for the router to provide the first electronic device with information that facilitates the user to find the physical interface of the target electronic device on the router; 所述第一电子设备根据所述物理接口信息,呈现所述目标电子设备在所述路由器上的物理接口的位置。The first electronic device presents the location of the physical interface of the target electronic device on the router according to the physical interface information.
CN202010633237.9A 2020-07-02 2020-07-02 Method for inquiring router interface by electronic equipment, router and communication system Active CN114095476B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010633237.9A CN114095476B (en) 2020-07-02 2020-07-02 Method for inquiring router interface by electronic equipment, router and communication system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010633237.9A CN114095476B (en) 2020-07-02 2020-07-02 Method for inquiring router interface by electronic equipment, router and communication system

Publications (2)

Publication Number Publication Date
CN114095476A CN114095476A (en) 2022-02-25
CN114095476B true CN114095476B (en) 2022-12-13

Family

ID=80294764

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010633237.9A Active CN114095476B (en) 2020-07-02 2020-07-02 Method for inquiring router interface by electronic equipment, router and communication system

Country Status (1)

Country Link
CN (1) CN114095476B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116614350A (en) * 2023-06-15 2023-08-18 武汉迈威通信股份有限公司 Dual System Switch Based on Diagnosis and Debugging Function

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005057854A1 (en) * 2003-12-04 2005-06-23 France Telecom Method of constructing a database of physical connections of an information transmission network
US9059941B1 (en) * 2014-05-29 2015-06-16 Amazon Technologies, Inc. Providing router information according to a programmatic interface
US10630543B1 (en) * 2017-03-17 2020-04-21 Amazon Technologies, Inc. Wireless mesh network implementation for IOT devices

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7843923B2 (en) * 2002-01-08 2010-11-30 Verizon Services Corp. Methods and apparatus for determining the port and/or physical location of an IP device and for using that information
US8918841B2 (en) * 2011-08-31 2014-12-23 At&T Intellectual Property I, L.P. Hardware interface access control for mobile applications

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005057854A1 (en) * 2003-12-04 2005-06-23 France Telecom Method of constructing a database of physical connections of an information transmission network
US9059941B1 (en) * 2014-05-29 2015-06-16 Amazon Technologies, Inc. Providing router information according to a programmatic interface
US10630543B1 (en) * 2017-03-17 2020-04-21 Amazon Technologies, Inc. Wireless mesh network implementation for IOT devices

Also Published As

Publication number Publication date
CN114095476A (en) 2022-02-25

Similar Documents

Publication Publication Date Title
US10698717B2 (en) Accelerator virtualization method and apparatus, and centralized resource manager
CN104243265B (en) A kind of gateway control method, apparatus and system based on virtual machine (vm) migration
US8937940B2 (en) Optimized virtual function translation entry memory caching
US9588807B2 (en) Live logical partition migration with stateful offload connections using context extraction and insertion
US8954704B2 (en) Dynamic network adapter memory resizing and bounding for virtual function translation entry storage
CN104468574B (en) A kind of method, system and device of virtual machine dynamic access IP address
CN109496415B (en) Method and system for virtual machine accessing remote acceleration device
KR102388195B1 (en) BRAS system-based message packaging method and device
KR101705596B1 (en) Server device connecting usb device and device sharing method
WO2020216339A1 (en) Method and apparatus for accessing gateway
CN104486589B (en) Access method and device in video monitoring system based on GVRP
CN112040030B (en) Message transmission method and device, computer equipment and storage medium
WO2014183417A1 (en) Method, device, and system for memory management
CN112583655B (en) Data transmission method, device, electronic device and readable storage medium
CN107276826A (en) A kind of capacitor network collocation method and device
CN114095476B (en) Method for inquiring router interface by electronic equipment, router and communication system
CN114745271B (en) Cloud game server optimization method, server and storage medium
CN112087311B (en) Virtual network function VNF deployment method and device
CN104333612B (en) The method and apparatus of switching network address
CN103141072B (en) IP address acquisition method and network access equipment
CN112241307A (en) A kind of virtual machine creation method, apparatus and related equipment
WO2024001549A1 (en) Address configuration method and electronic device
CN116567082A (en) Method and apparatus for container network communication
CN116414515A (en) Information processing method, device, electronic equipment and storage medium
CN113254160A (en) IO resource request method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Patentee after: Honor Terminal Co.,Ltd.

Country or region after: China

Address before: 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong

Patentee before: Honor Device Co.,Ltd.

Country or region before: China