Method, device and system for setting DNS server address
Technical Field
The invention relates to the field of computing application, in particular to a method, a device and a system for setting a DNS (domain name system) server address on a MacOSX operating system.
Background
The existing internet operates on the basis of the IPv4 protocol. IPv6 (internet protocol version6, version6 of the internet protocol) is the next version of the internet protocol, and its proposal was originally made because with the rapid development of the internet, the limited address space defined by IPv4 will be exhausted, and the shortage of the address space will certainly affect the further development of the internet. IPv6 has: the method has the advantages of expanding the address space, improving the overall throughput of the network, improving the quality of service (QoS), better ensuring the security, supporting plug and play and mobility, better realizing the multicast function and the like. The DNS (Domain name System) server is used for binding the domain name and the IP address on the network, so that the user can access the site corresponding to the IP address by directly inputting the domain name in the browser.
The automatic configuration of the IP address of the host in the IPv6 protocol is currently implemented with the following methods:
full state auto configuration (stateful auto configuration):
the configuration is performed based on the DHCPv6 protocol, and by applying for an IP address from a DHCP (dynamic host configuration protocol) server and obtaining related configuration information (such as a default gateway, a DNS server, etc.), the IP address configuration method is substantially the same as IPv 4.
However, all versions (10.4 version/10.5 version/10.6 version) of the MacOSX operating system (personal computer operating system of apple inc.) do not support the DHCPv6 protocol, and only the IPv6 address can be configured through the ICMPv6 protocol, but the ICMPv6 protocol only can configure the IP address, but does not support obtaining other configuration information, such as the DNS server address, and the like, so the DNS server address under the MacOSX operating system needs to be manually set by the user at the network configuration interface. When network service is provided for a host running a MacOSX operating system by using a network access terminal device (such as a network access card, a data card, a modem and the like), the IPv6DNS server address of the host cannot be automatically configured, only manual configuration can be performed by a user, and the problems of complicated manual configuration operation and low efficiency exist.
Disclosure of Invention
The embodiment of the invention provides a method, a device and a system for setting a DNS (domain name system) server address, which can solve the problems that the existing internet-surfing terminal equipment for providing network service for a host running a MacOSX operating system cannot automatically configure the IPv6DNS server address, the manual configuration of the DNS server address is complicated in operation and low in efficiency, the DNS server address can be automatically configured, and the operation is simple and the efficiency is high.
A method of setting a DNS server address for a host running a MacOSX operating system with which an IPv6 connection has been established and which has set an IP address, comprising:
and receiving a query command sent by the host, and returning a DNS server address to the host according to the query command, so that the host calls an API (application program interface) of the MacOSX operating system to set the DNS server address for the host.
An apparatus for setting a DNS server address for a host running a MacOSX operating system, comprising: a connection unit for establishing an IPv6 connection with a host running a MacOSX operating system, further comprising:
the device comprises a receiving unit and a main control unit; wherein,
the receiving unit is connected with the connecting unit and used for receiving the query command sent by the host and transmitting the query command to the main control unit;
and the main control unit is connected with the receiving unit and used for returning a DNS server address to the host according to the query command so that the host calls an API of the MacOSX operating system to set the DNS server address for the host.
A method for setting a DNS server address for a host running a MacOSX operating system, the host having established an IPv6 connection with a network terminal device and having set an IP address, comprising:
acquiring a DNS server address from the internet access terminal equipment through a query command;
and calling an API of the MacOSX operating system to set the acquired DNS server address for the host.
An apparatus for setting DNS server address, used in a host running a MacOSX operating system, comprising: the connection establishing unit is used for establishing IPv6 connection with the internet-surfing terminal equipment, and further comprises:
a main control processing unit and an address setting unit; wherein,
the main control processing unit is connected with the connection establishing unit and used for acquiring a DNS server address from the internet access terminal equipment through a query command and transmitting the DNS server address to the address setting unit;
the address setting unit is connected with the main control processing unit and used for calling an API (application program interface) of the MacOSX operating system according to the DNS address acquired by the main control processing unit from the network terminal equipment and setting the acquired DNS address for the host.
A system for setting DNS server addresses, comprising:
a host and an internet terminal device of the MacOSX operating system are operated, and the internet terminal device adopts the device for setting the DNS server address provided by the second embodiment of the invention;
the host is provided with the device for setting the DNS server address provided by the fourth embodiment of the present invention, and the device is in communication connection with the internet access terminal device and is used for setting the DNS server address of the host.
According to the technical scheme, the operating host of the MacOSX operating system is matched with the internet access terminal equipment, and the DNS server address information for configuration is acquired by using the query command, so that the configuration of the DNS server address of the host is automatically completed. Therefore, the address of the host DNS server of the MacOSX operating system can be automatically configured by using the internet-surfing terminal equipment for realizing the network service, manual operation of a user is not needed, and the use convenience and the configuration efficiency are improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
FIG. 1 is a flowchart of a method provided in accordance with an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a device according to a second embodiment of the present invention;
FIG. 3 is a flowchart of a method provided in a third embodiment of the present invention;
FIG. 4 is a flowchart illustrating a method according to a third embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a system according to a fifth embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention are clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
The core of the invention is that: after an IPv6 connection is established between a host running the MacOSX operating system and an internet-surfing terminal device (the internet-surfing terminal device can be a device providing network connection for the host running the MacOSX operating system, such as a wireless internet surfing card or a router, a modem and the like), the configuration of the DNS server address of the host running the MacOSX operating system is automatically completed after DNS server address information for configuration is acquired through the cooperation of the internet-surfing terminal device and the host.
Example one
This embodiment provides a method for setting a DNS server address, which is used to set a DNS server address for a host running a MacOSX operating system, where an internet access terminal device establishes an IPv6 connection with the host and the host sets an IP address, and the method includes the following steps, as shown in fig. 1:
step 1, receiving a query command sent by a host, and returning a DNS server address to the host according to the query command;
and 2, enabling the host to call the API of the MacOSX operating system and setting the DNS server address for the host.
In the step 1, returning the DNS server address to the host according to the query command is: and acquiring the DNS server address from the internet access terminal equipment through a USB command or an HTTP command. Specifically, what kind of query command is adopted can be determined according to the type of the internet access terminal device, if the internet access terminal device is a USB data card, the USB command can be adopted, and if the internet access terminal device is a router of an ethernet interface, the query command can be an HTTP command.
In the above method, the internet access terminal device establishes an IPv6 connection with the host, and the host sets an IP address:
the internet-surfing terminal equipment receives the ICMPv6 command sent by the host, returns the IP address to the host according to the received ICMPv6 command and enables the host to set the IP address. Wherein returning the IP address to the host according to the received ICMPv6 command is:
and the internet-surfing terminal equipment returns an IP address to the host by utilizing an ICMPv6 object according to the received ICMPv6request for inquiring the IP address, wherein the returned IP address is an IPv6 address.
In the method, the IP address and the DNS server address obtained by the internet access terminal device are the IP address and the DNS server address obtained from the network side in the process of establishing the connection with the network side by the internet access terminal.
Example two
This embodiment provides an apparatus for setting a DNS server address, configured to set a DNS server address for a host running a MacOSX operating system, where the apparatus may be used as a network terminal device, such as a wireless network card or a router, a modem, and the like, for providing network connection to the host running the MacOSX operating system, and as shown in fig. 2, the apparatus includes: a connection unit 21, a reception unit 22, and a main control unit 23;
the connection unit 21 is configured to establish an IPv6 connection with a host running a MacOSX operating system;
a receiving unit 22, connected to the connection unit 21, for receiving the ICMPv6 command sent by the host and transmitting the command to the main control unit; the main control unit is used for receiving the query command sent by the host and transmitting the query command to the main control unit;
a main control unit 23 connected to the receiving unit 22, and configured to return an IP address to the host according to the received ICMPv6 command, so that the host sets the IP address; and returning the DNS server address to the host according to the query command so that the host calls an API of the MacOSX operating system to set the DNS server address for the host.
EXAMPLE III
An embodiment of the present invention provides a method for setting a DNS server address, which is used to set a DNS server address for a host running a MacOSX operating system, where the host and an internet access terminal device have established an IPv6 connection and the host has set an IP address, and the method includes the following steps, as shown in fig. 3:
step 31, acquiring a DNS server address from the internet access terminal device through a query command;
and step 32, calling an API of the MacOSX operating system, and setting the acquired DNS server address for the host.
In the step 31, obtaining the DNS server address from the internet access terminal device by the query command is: and acquiring the DNS server address from the internet access terminal equipment through a USB command or an HTTP command. Specifically, what kind of query command is adopted can be determined according to the type of the internet access terminal device, if the internet access terminal device is a USB data card, the USB command can be adopted, and if the internet access terminal device is a router of an ethernet interface, the query command can be an HTTP command.
In the above method, the host running the MacOSX operating system establishes an IPv6 connection with the internet access terminal device, and the IP address set by the host may be:
the host acquires an IP address from the internet-surfing terminal equipment through an ICMPv6 command, and the host sets the acquired IP address. The method for acquiring the IP address from the internet-surfing terminal equipment through the ICMPv6 command by the host specifically comprises the following steps:
after determining to establish IPv6 connection with the Internet access terminal equipment, sending an ICMPv6request for inquiring an IP address to the Internet access terminal equipment;
and receiving the IP address returned by the Internet surfing terminal equipment according to the ICMPv6request of the IP address inquiry. The IP address returned by the internet-surfing terminal device by utilizing the ICMPv6 object can be received, and the returned IP address is the IPv6 address.
In the method, the IP address and the DNS server address obtained by the host from the internet-surfing terminal equipment are the IP address and the DNS server address obtained by the internet-surfing terminal from the network side in the process of establishing the connection with the network side.
The method of the embodiment of the present invention will be described in further detail with reference to fig. 4.
The host running the MacOSX operating system is in communication connection with the internet-surfing terminal equipment, a driving program and a resident process (namely a resident memory service process which is a resident process for obtaining the highest administrator authority of the MacOSX operating system running by the host) matched with the internet-surfing terminal equipment are installed on the host, the host can be connected to an IPv6 network through the internet-surfing terminal equipment, and DNS information is transmitted to the driving program of the internet-surfing terminal equipment after the internet-surfing terminal equipment is connected to the IPv6 network; the driver passes through the DNS information to the resident process, and the resident process calls an application program interface function (API) of the MacOSX operating system to set the DNS information into the host.
As shown in fig. 4, step 41 is: a driver (a driver matched with the internet surfing terminal) running on a host of the MacOSX operating system is connected with the internet surfing terminal equipment in an IPv6 mode;
step 42 is: the host receives a connection notification sent by the internet-surfing terminal equipment through a driving program running on the host;
step 43 is: the host inquires an IP address to the network terminal equipment through an ICMPv6request by a driver running on the host;
step 44 is: the host receives an IP address returned by the Internet surfing terminal equipment through ICMPv6response through a driving program running on the host;
step 45 is: an operating system running on the host automatically configures the IP address of the host according to the IP address obtained by a driving program running on the host;
step 46 is: the host inquires a DNS server address from the network terminal equipment through an inquiry command by a driving program running on the host;
step 47 is: the host receives a DNS server address returned by the internet-surfing terminal equipment through a driving program running on the host, and transmits the DNS server address to a resident process which has obtained root authority and runs on the host;
step 48 is: the resident process running on the host calls the API of the MacOSX operating system to set the DNS server address using the received DNS server address.
In the flow of fig. 4, steps 41 to 44 belong to a process of establishing an IPv6 connection and acquiring an IP address through an ICMPv6 command; in step 46, the host queries the DNS server address from the internet-accessing terminal device through the driver running thereon; in step 47, the host transmits the DNS server address to the resident process running on the host through the driver running on the host; the DNS server address of the host is set by the resident process running on the host calling the system API in step 48.
In the method, the resident process running on the host computer already has root authority (namely the highest administrator authority of the system, otherwise, the API for setting the DNS server address cannot be executed) when the resident process is installed; this enables automatic start-up each time the operating system of the host is restarted.
By the method provided by the embodiment of the invention, after the IPv6 network connection is established on the MacOSX operating system, the DNS server address of the host can be automatically configured without manual operation of a user.
Example four
The embodiment provides an apparatus for setting a DNS server address, which is used in a host running a MacOSX operating system, and as shown in fig. 5, the apparatus includes: a connection establishing unit 51, a main control processing unit 52, and an address setting unit 53;
the connection establishing unit 51 is configured to establish an IPv6 connection with the internet access terminal device;
the main control processing unit 52 is connected with the connection establishing unit 51, and is used for acquiring an IP address from the internet terminal equipment through an ICMPv6 command after determining that the internet terminal equipment connected with the host establishes an IPv6 connection, and transmitting the IP address to the address setting unit; the DNS server is used for acquiring the DNS server address from the internet access terminal equipment through the query command and transmitting the DNS server address to the address setting unit;
an address setting unit 53, connected to the main control processing unit 52, for setting the IP address for the host according to the IP address obtained by the main control processing unit from the network terminal device; and the API used for calling the MacOSX operating system is used for setting the acquired DNS server address for the host according to the DNS address acquired by the main control processing unit from the network terminal equipment.
EXAMPLE five
The present embodiment provides a system for setting a DNS server address, as shown in fig. 6, the system includes:
a host 61 and an internet terminal device 63 which run the MacOSX operating system, wherein the internet terminal device 63 adopts the device for setting the DNS server address given by the implementation II;
the host is provided with a device 62 for setting a DNS server address as given in the fourth embodiment, and the device 62 is in communication connection with the internet access terminal 63 and is used for setting the DNS server address of the host 61.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present invention can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present invention may be substantially implemented or a part of the technical solutions contributing to the prior art may be embodied in the form of a software product, which is stored in a readable storage medium, such as a floppy disk, a hard disk, or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.