Интерфейсы и подчиненные интерфейсы в маршрутизаторе: что они и для чего они нужны?
Одним из важнейших компонентов любой сети является маршрутизатор. Несмотря на то, что многие люди воспринимают это как устройство, излучающее сигнал Wi-Fi, это гораздо больше. Одной из важных функций маршрутизатора является обеспечение связи между различными VLAN, то есть различными виртуальными локальными сетями, которые создаются для правильной сегментации трафика. Помните, что все VLAN создаются в коммутаторе и применяются для каждого порта к подключенному оборудованию. Это руководство объяснит все, что вам нужно знать о субинтерфейсах маршрутизатора и о том, что отличает его от интерфейсов.
Субинтерфейсы чрезвычайно важны при настройке связи между двумя или более VLAN. Особенно, если вы работаете с оборудованием от производителя Cisco. Однако важно усилить несколько важных концепций, прежде чем переходить к рассматриваемым субинтерфейсам. Эти подчиненные интерфейсы также существуют в любом Linuxна основе маршрутизатора, хотя они и называются не субинтерфейсами, а виртуальными интерфейсами, но на самом деле это одно и то же, и служит той же цели: для взаимодействия имеющихся у нас VLAN.
Маршрутизатор имеет несколько портов, каждый из которых, в свою очередь, является сетевым интерфейсом. Когда мы говорим о сетевом интерфейсе, мы имеем в виду аппаратный компонент, который позволяет устройству подключаться к любой сети. Следовательно, маршрутизатор имеет несколько сетевых интерфейсов, то есть несколько сетевых карт, упакованных в одно устройство.
Please enable JavaScript
В некоторой степени он похож на компьютер. Хотя все компьютеры имеют один проводной сетевой интерфейс, в соответствии с нашими потребностями вы можете добавить одну или несколько сетевых карт, чтобы у вашего компьютера было несколько интерфейсов. То же самое относится к беспроводным сетевым интерфейсам, то есть на одном компьютере может быть несколько беспроводных сетевых интерфейсов. Последнее особенно полезно, если вас интересуют действия, связанные со взломом сетей Wi-Fi.
С другой стороны, какова именно роль маршрутизатора? Это устройство может подключаться к одной или нескольким сетям. В свою очередь, он может подключаться к другим маршрутизаторам для обмена информацией о маршрутизации. Сама маршрутизация стала возможной благодаря таблицам маршрутизации. У каждого маршрутизатора есть таблица маршрутизации, в которой указаны возможные места назначения, по которым следует перенаправить путь, по которому следует каждый пакет данных. Маршрутизатор имеет все необходимые функции, чтобы иметь возможность принимать решения о том, какой из них является наилучшим, чтобы ни один пакет данных не был отброшен или заблокирован в какой-то момент его прохождения по сети.
Маршрутизатор на палочке
Если в вашей сети более одной VLAN, коммутатор не может выполнять функцию, позволяющую компьютеру в VLAN 1 взаимодействовать с VLAN 2, за исключением случаев, когда это коммутатор L2 + или L3, который включает функциональность Inter. -VLAN маршрутизация, в этом случае можно.
Если у вас «нормальный» коммутатор L2, вам потребуются услуги маршрутизатора для взаимодействия сетей VLAN, декапсуляции и инкапсуляции сетей VLAN для правильной связи. Что означает Router-on-a-Stick? Давайте посмотрим на этот пример сети:
Представлены два компьютера, каждый из которых подключен к VLAN. Один к VLAN 10, а другой к VLAN 20. Эти компьютеры подключены к коммутатору через соответствующие интерфейсы. То есть у коммутатора два порта заняты обоими компьютерами. На другой стороне коммутатора есть соединение между ним и маршрутизатором. Если говорить строго на физическом уровне, если у вас две сети VLAN, вы можете выбрать один порт маршрутизатора для каждого порта, чтобы он подключался к коммутатору. Поэтому и в этом случае коммутатор должен иметь два магистральных порта.
Если мы масштабируем случай до четырех, пяти, шести или более VLAN, это будет практически невозможно. Очень легко и маршрутизатор, и порты коммутатора будут заняты, что вызывает различные трудности при управлении обоими устройствами. Вот почему концепция Router-on-a-Stick позволяет создавать суб-интерфейсы в маршрутизаторе, то есть в том же физическом интерфейсе маршрутизатора мы можем создавать виртуальные интерфейсы или суб-интерфейсы, и каждый из них Он будет связан с одной из VLAN, которые есть в нашей сети.
Что касается коммутатора, если мы применим Router-on-a-Stick, нам понадобится только магистральный порт.
Как настроить суб-интерфейсы
Вначале мы отметили, что субинтерфейсы в значительной степени применяются в устройствах производителя Cisco. По этой причине мы собираемся продемонстрировать его работу через конфигурацию через CLI (интерфейс командной строки) самого маршрутизатора Cisco. Первое, что мы должны гарантировать, это то, что коммутатор или коммутаторы в нашей сети правильно настроены для портов доступа и назначения VLAN.
Switch1#configure terminal
Switch1 (config)# interface gigabitEthernet 0/1
Switch1 (config-if)# switchport mode access
Switch1 (config-if)# switchport access vlan 100
Switch1 (config-if)# interface gigabitEthernet 0/2
Switch1 (config-if)# switchport mode access
Switch1 (config-if)# switchport access vlan 200
Мы также должны гарантировать правильную конфигурацию нашего магистрального порта, которая позволит трафику различных VLAN перемещаться к маршрутизатору и наоборот.
Switch1 (config)# interface gigabitEthernet 0/24
Switch1 (config-if)# switchport trunk encapsulation dot1q
Switch1 (config-if)# switchport mode trunk
Одна из введенных нами команд такова:
switchport trunk encapsulation dot1q
Это относится к IEEE 802.1Q связь стандарт . По сути, это протокол, который позволяет каждому кадру Ethernet, генерируемому хостами (компьютерами), иметь идентификатор VLAN, то есть идентификатор, который указывает, в какую VLAN этот кадр должен перейти. Этот протокол работает только между сетевыми устройствами: маршрутизаторами и коммутаторами. Он не применяется к хостам, поэтому, как только он достигает места назначения, этот идентификатор VLAN отправляется без тегов или без тегов, то есть он представляется как обычный кадр Ethernet.
Теперь мы настраиваем роутер. Всегда перед настройкой субинтерфейсов мы должны убедиться, что интерфейсы действительно работают. Поэтому мы всегда должны начинать с команды «без выключения», чтобы активировать их. Затем вы можете начать с подчиненных интерфейсов.
(config)# interface gigabitEthernet 0/0
(config-if)# no shutdown
(config-if)# exit
(config-if)# interface gigabitEthernet 0/0.100
(config-subif)# encapsulation dot1Q 100
(config-subif)# ip address 192.168.1.1 255.255.255.0
(config-subif)# exit
(config)# interface gigabitEthernet 0/0.200
(config-subif)# encapsulation dot1Q 200
(config-subif)# ip address 192.168.2.1 255.255.255.0
(config-subif)# exit
Совет, который используется, заключается в том, что каждый подчиненный интерфейс имеет ту же нумерацию, что и номер VLAN, с которой мы работаем. Как мы видим в примерах команд, один субинтерфейс — .100 (для VLAN 100), а другой — .200 (для VLAN 200). Это больше, чем что-либо для настройки и администрирования намного легче и избежать проблем.
С другой стороны, мы снова видим команду «encapsulation dot1Q», и на этот раз она сопровождается идентификатором соответствующей ей VLAN. Это позволит каждому подинтерфейсу интерпретировать все тегированные кадры 802.1Q, поступающие из магистрального порта коммутатора. Если это не настроено, маршрутизатор не будет интерпретировать кадры и не будет знать, куда направить каждый из них.
Наконец, мы видим назначение IP-адресов для каждого подчиненного интерфейса. Эти же IP-адреса будут настроены на каждом хосте и будут действовать как шлюз по умолчанию . То есть на каждом компьютере в VLAN 100 должен быть настроен адрес 192.168.1.1 как шлюз. То же самое и с VLAN 200, IP-адрес шлюза 192.168.2.1.
Router-on-a-Stick — одна из самых важных концепций, когда дело касается сетей. Он выделяется, главным образом, тем, что позволяет в полной мере использовать несколько портов наших сетевых устройств. Интерфейс маршрутизатора может иметь один или несколько подчиненных интерфейсов. Это обеспечивает масштабируемость и гибкость нашей сети без ненужных затрат. Важным аспектом является то, что настоятельно рекомендуется, чтобы эта магистраль работала на мультигигабитных скоростях и даже на скоростях 10 Гбит / с, чтобы не создавать узких мест в этом канале при передаче файлов между VLAN.
What is a Subinterface in a Cisco Router and how to create a subinterface in a Cisco Router
A subinterface is a virtual interface created by dividing one physical interface into multiple logical interfaces. A sub-interface in a Cisco Router uses the parent physical interface for sending and receiving data.
Subinterfaces are used for a variety of purposes. If we have one Router with one physical interface, but needed to have the router connected to two IP networks to route traffic between two routers, we can create two sub interfaces within the physical interface, assign each sub interface an IP address within each subnet and then route the data between two subnets.
We use Subinterfaces for inter VLAN traffic routing by using a Router-on-a-Stick configuration, NBMA (Non Broadcast Multiple Access) WAN solutions like frame-relay or ATM etc.
A Subinterface can be configured just like a physical interface. If you take the help from Cisco IOS using question mark, we can see the number range which be can used to create subinterfaces.
To create a subinterface and configure it with an IP address, use the following commands.
To bring the physical interface from Administrativly down state to up, first go to the physical interface and issue "no shutdown" command as shown below.
Now create and configure a sub interface as shown below. In below configuration example the encapulation is set to IEEE 802.1q for Inter-VLAN routing for VLAN 100.
What is a Subinterface in a Cisco Router
A Subinterface is a virtual interface that is created by dividing one physical interface into many logical interfaces, the subinterface uses the parent physical interface in order to send and receive messages like Fast Ethernet 0/0.1 is the subinterface Fast Ethernet Port 0/0. To know more about What is a Subinterface in a Cisco Router, keep reading this article till the end.
The commonly use of Cisco router subinterface is done when we want to enable communication between two different VLANs. If we have a router that has only one interface and there is required to configured two networks, then we can create sub-interfaces assign each sub-interface with the appropriate IP address and route the data between subnets.
A Sub-interface is configured the same as physical interface and if you look number range that could be configured at any physical Interface is too huge.
Sub-Interface Range on Physical Interface
Before configuring the sub-interfaces, firstly make the interface up by using the following command.
Making the Interface up
Now create the subinterface with the encapsulation of 802.1Q for inter VLAN routing of VLAN 100.
Inter VLAN Communication
Also, read…
- Cisco IOS Command Line Modes
- Cisco Router Show Commands
How to configure Layer 3 sub-interface?
The following steps should be followed in order to configure the layer-3 sub interface.
- Enable
- Configure the terminal
- Encapsulation dot1q VLAN-number
- End
Example
Example
Example
Sub-interface configuration for Inter-vlan communication
Remember the layer 3 interface forwards packets from one subnet to another, you can use layer-3 interface for IP routing and inter VLAN routing of Layer-2 Traffic.
The following features are supported at Layer-3 sub interfaces
- IPV4 addressing and routing.
- Unicast routing
- Multicast routing
- FHRP (First Hop redundancy protocol), HSRP (hot standby routing protocol), VRRP (Virtual router Redundancy protocol) and Gateway Load Balancing Protocol (GLBP).
- VRF (Virtual routing and forwarding)
- QoS (Quality of service)
In frame relay network there could be two types of sub-interfaces Multi-point and point to point-sub interfaces. In point to pint frame relay, the sub-interfaces act as leased line and each point to point connection require its own subnet, while in multi-point frame-relay network sub-interfaces acts as NBMA network and they can save the network as they use the single subnet.
Interface and Hardware Component Configuration Guide, Cisco IOS XE Gibraltar 16.12.x
The documentation set for this product strives to use bias-free language. For the purposes of this documentation set, bias-free is defined as language that does not imply discrimination based on age, disability, gender, racial identity, ethnic identity, sexual orientation, socioeconomic status, and intersectionality. Exceptions may be present in the documentation due to language that is hardcoded in the user interfaces of the product software, language used based on RFP documentation, or language that is used by a referenced third-party product. Learn more about how Cisco is using Inclusive Language.
Book Title
Interface and Hardware Component Configuration Guide, Cisco IOS XE Gibraltar 16.12.x
Configuring Virtual Interfaces
View with Adobe Reader on a variety of devices
Results
Chapter: Configuring Virtual Interfaces
Configuring Virtual Interfaces
Virtual interfaces are software-based interfaces that you create in the memory of the networking device using Cisco IOS XE commands. Virtual interfaces do not have a hardware component such as the RJ-45 female port on a 100BASE-T Fast Ethernet network interface card. This module describes the four common types of virtual, or logical, interfaces that can be configured using Cisco IOS XE software:
Finding Feature Information
Your software release may not support all the features documented in this module. For the latest caveats and feature information, see Bug Search Tool and the release notes for your platform and software release. To find information about the features documented in this module, and to see a list of the releases in which each feature is supported, see the feature information table.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to https://cfnng.cisco.com/. An account on Cisco.com is not required.
Prerequisites for Configuring Virtual Interfaces
Before virtual interfaces can be used in your network, you must have some physical (hardware) interfaces configured and you must be able to communicate between the networking devices on which you wish to use virtual interfaces.
Information About Configuring Virtual Interfaces
Virtual Interfaces
Virtual interfaces are network interfaces that are not associated with a physical interface. Physical interfaces have some form of physical element—for example, an RJ-45 male connector on an Ethernet cable. Virtual interfaces exist only in software; there are no physical elements. You identify an individual virtual interface using a numerical ID after the virtual interface name. For example: loopback 0, tunnel 1, and fastethernet 0/0/0.1. The ID is unique per virtual interface type to make the entire name string unique; for example both a loopback 0 interface and a null 0 interface can exist, but two loopback 0 interfaces cannot exist in a single networking device.
Cisco IOS XE software supports four types of virtual interfaces:
Benefits of Virtual Interfaces
A loopback interface can provide a stable interface on which you can assign a Layer 3 address such as an IP or IPX address. This address can be configured as the source address when the networking device needs to send data for protocols such as NetFlow or Cisco Discovery Protocol (CDP) to another device in your network and you want the receiving device to always see the same source IP address from the networking device. This is an issue in networks with multiple equal-cost paths because under normal circumstances the packets that are generated by a networking device use the IP address from the outbound interface as the source address for the packets and because in a network with two or more equal-cost paths from the networking device to the receiving host each packet might use a different outbound interface.
A null interface provides an alternative method of filtering without the overhead involved with using access lists. For example, instead of creating an outbound access list that prevents traffic to a destination network from being transmitted out an interface, you can configure a static route for the destination network that points to the null interface.
Subinterfaces were invented as a method of virtually subdividing a physical interface into two or more interfaces so that the IP routing protocols would see the network connection to each remote networking device as a separate physical interface even though the subinterfaces share a common physical interface. One of the first uses of subinterfaces was to resolve the problem with split horizon on Frame Relay WANs.
The following are several situations in which tunneling (encapsulating traffic in another protocol) is useful:
To enable multiprotocol local networks over a single-protocol backbone
To provide workarounds for networks that use protocols that have limited hop counts; for example, RIP version 1, AppleTalk
To connect discontiguous subnetworks
To allow virtual private networks across WANs
Loopback Interfaces
You can specify a software-only interface called a loopback interface to emulate a physical interface. Loopback interfaces are supported on all platforms. A loopback interface is a virtual interface on a Cisco router that remains up (active) after you issue the no shutdown command until you disable it with the shutdown command. Unlike subinterfaces, loopback interfaces are independent of the state of any physical interface.
The loopback interface can be considered stable because once you enable it, it will remain up until you shut it down. This makes loopback interfaces ideal for assigning Layer 3 addresses such as IP addresses when you want a single address as a reference that is independent of the status of any physical interfaces in the networking device. A good example of this is using the IP address of a loopback interface as the IP address for the domain name system (DNS) host address for the networking device. Before loopback interfaces were available, network administrators had to configure a DNS host entry for every interface on a router that had an IP address assigned to it because they could never be certain which interface IP address might be available at any given time for managing the router. In the sample interface configuration and DNS entries for Router A shown below, you can see that there is a DNS entry for each interface.
Router A Interface Configuration Before Loopback
Router A DNS Entries Before Loopback
Interfaces on networking devices can fail, and they can also be taken out of service for maintenance. If any of the interfaces in Router A fails or is taken out of service, another networking device will not be able to access that interface. When you configure a networking device with a loopback interface and assign it an IP address that is advertised throughout the network, the networking device will be reachable by using this IP address as long as the networking device has at least one network interface capable of sending and receiving IP traffic. In the sample interface configuration and DNS entries for Router A after a loopback interface is configured, you can see that there is now only one DNS entry that can be used to reach the router over any of its physical interfaces.
Router A Interface Configuration After Loopback
Router A DNS Entries After Loopback
The configured IP address of the loopback interface—172.16.78.1—can be used as the source address for packets generated by the router and forwarded to networking management applications and routing protocols. Unless this loopback interface is explicitly shut down, it is always reachable.
You can use the loopback interface as the termination address for open shortest path first (OSPF) or border gateway protocol (BGP) sessions. A loopback interface can also be used to establish a Telnet session from the console port of the device to its auxiliary port when all other interfaces are down. In applications where other routers or access servers attempt to reach this loopback interface, you should configure a routing protocol to distribute the subnet assigned to the loopback address.
IP Packets routed to the loopback interface are rerouted back to the router or access server and processed locally. IP packets routed out the loopback interface but not destined to the loopback interface are dropped. Under these two conditions, the loopback interface can behave like a null interface.
Loopback Interfaces Versus Loopback Mode
Loopback interfaces provide a stable source interface to ensure that the IP address assigned to the interface is always reachable as long as the IP routing protocols continue to advertise the subnet assigned to the loopback interface. Loopback mode, however, is used to test and diagnose issues with WAN (serial) links such as bit loss or data corruption. The idea is to configure a loop to return the data packets that were received by the interface back out the same interface to the device that originated the traffic. Loopback mode is used to troubleshoot problems by checking that the data packets are returned in the same condition in which they were sent. Errors in the data packets indicate a problem with the WAN infrastructure. Many types of serial interfaces have their own form of loopback command syntax that is entered under interface or controller configuration mode.
Null Interfaces
The null interface is a virtual network interface that is similar to the loopback interface. Whereas traffic to the loopback interface is directed to the router itself, traffic sent to the null interface is discarded. This interface is always up and can never forward or receive traffic; encapsulation always fails. The null interface functions similarly to the null devices available on most operating systems.
Null interfaces are used as a low-overhead method of discarding unnecessary network traffic. For example, if you do not want your network users to be able to reach certain IP subnets, you can create static IP routes for the subnets that point to the null interface of a networking device. Using the static IP routes takes less CPU time for the networking device than using IP access lists. The static-route configuration is also easier to configure than IP access lists because it is done in global configuration mode instead of in interface configuration mode.
The null interface may not be configured with an address. Traffic can be sent to this interface only by configuring a static route where the next hop is the null interface—represented by Null 0. One example of configuring the next hop to be the null interface is to create a route to an aggregate network that can then be announced through the BGP, or to ensure that traffic to a particular range of addresses is not propagated through the router, perhaps for security purposes.
The router always has a single null interface. By default, a packet sent to the null interface causes the router to respond by sending an Internet Control Message Protocol (ICMP) unreachable message to the source IP address of the packet. You can configure the router either to send these responses or to drop the packets silently.
Subinterfaces
Subinterfaces are associated with physical interfaces. Subinterfaces are enabled when the physical interface with which they are associated is enabled, and subinterfaces are disabled when the physical interface is shut down.
Subinterfaces can be enabled and shut down independently of the physical port with which they are associated. However, you cannot enable a subinterface of a physical interface that has been shut down.
Subinterfaces are created by subdividing the physical interface into two or more virtual interfaces on which you can assign unique Layer 3 network addresses such as IP subnets. One of the first uses of subinterfaces was to resolve the problem with split horizon on Frame Relay WANs. Split horizon is a behavior associated with IP routing protocols such as RIP in which IP subnets are not advertised back out the same physical interface that they were learned over. Split horizon was implemented to prevent routing loops in IP networks. A routing loop can be created when the networking devices at both ends of a network connection advertise the same IP routes to each other. Split horizon was an issue for Frame Relay multipoint network interfaces—interfaces that connect to two or more remote networking devices over a single physical interface—because the default behavior of many networking devices was to implement split horizon, which means that the networking device did not advertise the IP routes that were learned over an interface back out the interface to other devices that were also reachable via the same physical interface. Subinterfaces were invented as a method of virtually subdividing a physical interface into two or more interfaces so that the IP routing protocols would see the network connection to each remote networking device as a separate physical interface even though the subinterfaces share a common physical interface. Although TCP/IP now disables split horizon limitations by default, protocols such as AppleTalk and IPX are still constrained by split horizon.
Subinterfaces are identified by a prefix that consists of the hardware interface descriptor (IDB) followed by a period and then by a number that is unique for that prefix. The full subinterface number must be unique to the networking device. For example, the first subinterface for GigabitEthernet interface 0/0/0 might be named GigabitEthernet 0/0/0.1 where .1 indicates the subinterface.
Tunnel Interfaces
Tunneling provides a way to encapsulate arbitrary packets inside a transport protocol. Tunnels are implemented as a virtual interface to provide a simple interface for configuration. The tunnel interface is not tied to specific «passenger» or «transport» protocols, but, rather, it is an architecture that is designed to provide the services necessary to implement any standard point-to-point encapsulation scheme.
There are several ways to implement tunnel interfaces depending on the connectivity that you need to provide. One common use for tunnels is to carry data traffic for a network protocol such as IPX over devices in your network that do not support IPX. For instance, if your network uses IPX in sites at the edge of your network but not in the core of your network, you can connect the IPX sites at the network edges by tunneling IPX in IP over the core of the network.
For more details about the various types of tunneling techniques available using Cisco IOS XE software, see the » Implementing Tunnels » module of the Cisco IOS XE Interface and Hardware Component Configuration Guide.
How to Configure Virtual Interfaces
Configuring a Loopback Interface
This task explains how to configure a loopback interface. A loopback interface can be considered stable because once you enable it, it will remain up until you shut it down. This makes loopback interfaces ideal for assigning Layer 3 addresses such as IP addresses when you want to have a single address to use as a reference that is independent of the status of any of the physical interfaces in the networking device.
Before you begin
The IP address for the loopback interface must be unique and not in use by another interface.