什么是接口标识符

什么是接口标识符

本文介绍了什么是接口标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台笔记本电脑,该笔记本电脑使用一个或多个网络适配器连接到组织的网络.我正在尝试编写一个工具,该工具将连续监视每个网络的连接状态和连接质量.但是,我的网络知识有限,术语使我感到困惑.

I have a laptop that is connected to my organization's network using one or more network adapters. I am trying to write a tool that will continuously monitor the connectivity status and connection quality of each network. However my networking knowledge to limited and the terminology confuses me.

专门查找所有网络适配器.有人建议我使用命令ifconfig,它给了我所谓的接口标识符".

Specifically finding all the network adapters. Someone suggested that I use the command ifconfig and it gave me what are called "interface identifiers".

例如:

['lo0', 'gif0', 'stf0', 'en0', 'en1', 'en2', 'bridge0', 'p2p0']

我不确定这如何帮助我解决问题,因为我不知道接口标识符是什么,也不确定如何利用此信息.我的假设是它们代表网络中的计算机或路由器.

I'm not quite sure how this helps me solve my problem because I don't know what interface identifiers are and I am not sure how to leverage this information. My assumption is that they represent a computer or a router in the network.

如果有人可以解决这个问题,或者用外行的话向我解释,那将非常有帮助.

If someone could clear this up or explain it to me in layman's terms that would be really helpful.

推荐答案

首先,您需要了解计算机中可能存在物理网卡(OR/AND逻辑网络适配器),以识别连接/管理连接.

First of all, you need to understand that there may be physical network cards(OR/AND logical network adapters) present in the computer to identify connection/manage connection.

IPv6非常大的地址大小的回报

在IPv4中,IP地址与用于基础数据链路层网络技术的地址无关.使用以太网接口卡(NIC)连接到TCP/IP网络的主机具有一个以太网MAC地址和一个IP地址,但是这两个数字是不同的,并且在任何方面都不相关.

In IPv4, IP addresses have no relationship to the addresses used for underlying data link layer network technologies. A host that connects to a TCP/IP network using an Ethernet network interface card (NIC) has an Ethernet MAC address and an IP address, but the two numbers are distinct and unrelated in any way.

随着对IPv6寻址的全面改革,出现了一个机会,创造了一种更好的方式来映射IP单播地址和物理网络地址.实施这种高级映射技术是IPv6地址如此之大的原因之一.总共有128位,即使为网络前缀保留了完整的48位,为站点子网保留了16位,我们仍然剩下64位用于接口标识符,这类似于IPv4下的主机ID.

With the overhaul of addressing in IPv6, an opportunity presented itself to create a better way of mapping IP unicast addresses and physical network addresses. Implementing this superior mapping technique was one of the reasons why IPv6 addresses were made so large. With 128 total bits, even with a full 48 bits reserved for network prefix and 16 bits for site subnet, we are still left with 64 bits to use for the interface identifier, which is analogous to the host ID under IPv4.

我们可以使用这么多位,这给了我们极大的灵活性.除了可以为主机使用任意虚构"标识符之外,我们还可以将接口ID基于基础数据链路层硬件地址,只要该地址的长度不超过64位即可.由于几乎所有设备都使用64位或更少的第二层地址,因此使用这些地址作为IP地址中的接口标识符没有问题.这提供了直接的好处:由于我们不必为每个主机记录两个任意数字,因此使网络的管理更加容易. IP地址可以从MAC地址和网络标识符中得出.这也意味着我们将来可以从MAC地址分辨IP地址,反之亦然.

Having so many bits at our disposal gives us great flexibility. Instead of using arbitrary "made-up" identifiers for hosts, we can base the interface ID on the underlying data link layer hardware address, as long as that address is no greater than 64 bits in length. Since virtually all devices use layer two addresses of 64 bits or fewer, there is no problem in using those addresses for the interface identifier in IP addresses. This provides an immediate benefit: it makes networks easier to administer, since we don't have to record two arbitrary numbers for each host. The IP address can be derived from the MAC address and the network identifier. It also means we can in the future tell the IP address from the MAC address and vice-versa.

访问此链接,以更清楚地了解接口ID.

Visit this link for more clear understanding about interface ID.

现在,要清除您的困惑,

Now,returning to clear your confusion,

所有连接(接口),例如Ethernet-0,Ethernet-1,WiFi-1等.有自己的interface identifier.您可以将它们视为一种特殊的标识号,用于标识当时可用的接口类型!

all of the connections(interfaces) such as Ethernet-0,Ethernet-1,WiFi-1,etc. have their own interface identifier.You can think of them as a kind of special identification number which identifies the kind of interfaces available at that moment!

在Linux中键入ifconfig时,它将显示当前活动接口的状态.

When you type ifconfig in Linux, it displays the status of the currently active interfaces.

现在,在示例部分上,假设您的系统上有两个以太网连接,例如eth0eth1(这些是接口名称)---因此ifconfig将打印这两个结果它是输出!

Now,coming on the example part, let's say you have two Ethernet connections on your system, say, eth0 and eth1(these are interface names) ---so ifconfig will print these two as a result of it's output!

此外,您提到的接口是一些最常用的接口:-

Also,the interfaces which you have mentioned are some of the most-commonly used interfaces :-

'lo0','gif0','stf0','en0','en1','en2','bridge0','p2p0'

'lo0', 'gif0', 'stf0', 'en0', 'en1', 'en2', 'bridge0', 'p2p0'

  1. lo0 ---局域网连接(0表示lan的第一连接)
  2. en0-以太网连接(以太网上的第一,第二和第三连接为0,1,2)
  3. bridge0-与本机的桥接连接
  4. p2p0 ---对等连接
  1. lo0---local network connection(0 for 1st connection of lan)
  2. en0---ethernet connection(0,1,2 for 1st,2nd and 3rd connection on Ethernet)
  3. bridge0---a bridged connection to this machine
  4. p2p0---a peer-to-peer connection

不了解gifstf.请注意,这里有逻辑连接/虚拟连接,而不是物理连接(使用NIC卡)的限制!

don't know about gif,stf.Please note that there are logical connections/virtual connections,instead of limitation of physical connections(using NIC cards) too!

这篇关于什么是接口标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 11:59