Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
playground:arinc9:network.interfaces [2021/09/20 15:16] – created arinc9playground:arinc9:network.interfaces [2021/09/22 08:31] – [Certain Types of Network Interfaces] arinc9
Line 1: Line 1:
 ====== Network & Network Interfaces ====== ====== Network & Network Interfaces ======
-===== Types of network interfaces ===== +===== Definition of a Network ===== 
-The [[wp>Linux kernel]] universally distinguishes between two types of software network interfaces:+A network represents a group of computers communicating with each other. A computer can be any device with the ability of processing information.\\ 
 +There doesn't necessarily have to be more than one physical computer to form a network. There could be a set of virtualised computers communicating with each other under a single physical computer.
  
-==== Physical Network Interfaces ==== +On softwarecomputers communicate with each other using network interfaces.
-''eth0''''eth8'', ''radio0'', ''wlan19'', .. always represent an actual network hardware device such as a [[wp>Network interface controller|NIC]], [[wp>Wireless network interface controller|WNIC]] or some other kind of [[wp>Modem]]. As soon as the [[wp>device driver]] is loaded into the Kernel a corresponding physical network interface becomes present and available.+
  
-Any physical network interface is a named software representation by the operating system to the user to enable him to configure the hardware network device and also to integrate it into programs and scripts. 
  
-==== Virtual Network Interfaces ==== +===== Definition of a Network Interface ===== 
-''lo''''eth0:1''''eth0.1''''vlan2''''br0'', ''pppoe-dsl'', ''gre0'', ''sit0'' ''tun0'', ''imq0'', ''teql0'', .. are virtual network interfaces that do NOT represent an existent hardware device but are linked to one (otherwise they would be useless). Virtual network interfaces were invented to give the system administrator maximum flexibility when configuring a Linux-based operating system. A virtual network interface is generally associated with a physical network interface (eth6) or another virtual interface (eth6.9) or be stand alone such as the [[wp>Loopback#Virtual_network_interface|loopback interface]] ''lo''+A network interface is the point of interconnectionimplemented on the softwarebetween computersThe term "interface"when used in computer networkingis short for the term "network interface".
  
-=== Types of Virtual Network Interfaces === +Data transmission between interfaces can be made over Ethernet [[wp>IEEE 802.3]] or WLAN [[wp>IEEE 802.11]] which are the most common communication protocols. 
-  * <color maroon>**//aliases//**</color>''eth4:5'', ''eth4:6'', ..\\  IP-aliases are an obsolete way to manage multiple IP-addresses/masks per interface. Newer tools such as iproute2 support multiple address/prefixes per interfacebut aliases are still supported for backwards compatibility. [[https://www.kernel.org/doc/html/latest/networking/alias.html|Documentation/networking/alias.html]] + 
-  * <color maroon>**//VLANs//**</color>: ''eth4.0''''eth4.1'', ''eth4.3'', ''vlan0'', ..\\ are created to partition single layer 2 network into multiple virtual ones. The drivers all participating network cards must support [[wp>IEEE 802.1Q]] and be configured accordingly. This standard allows for up to 4096 VLANs (12Bits). +Each entry on the output of ''ip link'' represents a network interface. Network interfaces can be created by making use of physical devices (a switch[[wp>Network interface controller|NIC]], a [[wp>Wireless network interface controller|wireless NIC]]and/or features of the software (vlan, bridging, tunnelling). 
-  <color maroon>**//Stacked VLANs//**</color>: [[wp>IEEE 802.1ad]]-support was mainlined in [[http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=8ad227ff89a7e6f05d07cd0acfd95ed3a24450ca|2013-04-19netvlanadd 802.1ad support]] Configuration is done using ''ip link'':<code bash+<code> 
-ip link add link eth0 eth0.1000 type vlan proto 802.1ad id 1000 +# ip link 
-ip link add link eth0.1000 eth0.1000.1000 type vlan proto 802.1q id 1000+1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 
 +    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 
 +2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1508 qdisc mq state UP mode DEFAULT group default qlen 1024 
 +    link/ether a1:b2:c3:d4:e5:f6 brd ff:ff:ff:ff:ff:ff 
 +5: lan2@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN mode DEFAULT group default qlen 1000 
 +    link/ether a1:b2:c3:d4:e5:f6 brd ff:ff:ff:ff:ff:ff 
 +6: lan1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br0 state UP mode DEFAULT group default qlen 1000 
 +    link/ether a1:b2:c3:d4:e5:f6 brd ff:ff:ff:ff:ff:ff 
 +7: wan@eth0: <NO-CARRIER,BROADCAST,MULTICAST,UPmtu 1500 qdisc noqueue master br0 state LOWERLAYERDOWN mode DEFAULT group default qlen 1000 
 +    link/ether a1:b2:c3:d4:e5:f6 brd ff:ff:ff:ff:ff:ff 
 +11: br0: <BROADCAST,MULTICAST,UP,LOWER_UPmtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000 
 +    link/ether a1:b2:c3:d4:e5:f6 brd ff:ff:ff:ff:ff:ff 
 +17: br0.5@br0<BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000 
 +    link/ether a1:b2:c3:d4:e5:f6 brd ff:ff:ff:ff:ff:ff 
 +18: br0.8@br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000 
 +    link/ether a1:b2:c3:d4:e5:f6 brd ff:ff:ff:ff:ff:ff 
 +74155: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP mode DEFAULT group default qlen 1000 
 +    link/ether a1:b2:c3:d4:e5:f6 brd ff:ff:ff:ff:ff:ff 
 +74156: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UPmtu 1500 qdisc mq master br0 state UP mode DEFAULT group default qlen 1000 
 +    link/ether a1:b2:c3:d4:e5:f6 brd ff:ff:ff:ff:ff:ff permaddr 60:38:e0:c9:0c:11 
 +74157: wlan1-1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP mode DEFAULT group default qlen 1000 
 +    link/ether a1:b2:c3:d4:e5:f6 brd ff:ff:ff:ff:ff:ff 
 +24015: pppoe-wan: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1492 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 3 
 +    link/ppp 
 +24016: wg: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 
 +    link/none
 </code> </code>
-  * <color maroon>**//bridges//**</color>: ''br0'', ''br-lan'' \\ are used to make multiple virtual or physical network interfaces act as if they were just one network interface (quasi the opposite of VLANs). Can also be used for VPN and bridged interfaces. The Linux Ethernet bridge can be used for connecting multiple Ethernet devices together. The connecting is fully transparent: hosts connected to one Ethernet device see hosts connected to the other Ethernet devices directly.  [[https://forum.openwrt.org/viewtopic.php?id=45783|understanding how bridge-interfaces work]] 
-  * <color maroon>**//tunnel interfaces//**</color>: ''pppoe-dsl'', ''pppoa-dsl'', ''tun0'', ''vpn1'',\\ used to send packets over a [[wp>tunneling protocol]] such as [[wp>Generic Routing Encapsulation|GRE]], [[wp>IPsec]]  [[wp>Point-to-point protocol over Ethernet|PPPoE]], etc. 
-  * <color maroon>**//special purpose//**</color>: ''[[http://www.linuximq.net/|imq0]], [[http://lartc.org/howto/lartc.loadshare.html|teql3]]''\\ used to change the order of outgoing network packets, or incoming network packet 
-  * <color maroon>**//wireless operating mode virtual interfaces//**</color>: ''wlan0'', ''wlan0_1'', ''ath3'', ''ath_monitor'', ..\\ [[docs:guide-user:network:wifi:wireless.overview|Linux wireless subsystem]]: There is always one //physical network interface// for each WNIC called the //master interface//. The //master interface// is invisible. Then, depending on the wireless operating mode the master interface is configured to, //ad-hoc (IBSS), managed , AP , WDS, mesh point, monitor//, //wireless virtual network interfaces// with different properties are created. This is done automatically by default. When the WNIC driver is loaded, there always will be the master interface __and__ (at least) one virtual interface! 
  
  
 +==== Certain Types of Network Interfaces ====
 +Network interfaces can be distinguished, by software, by what the interface uses (physical devices & software features) to transmit data.\\
 +For example: Ethernet interface (uses a NIC), wireless interface (uses a wireless NIC), loopback interface, bridge interface (uses bridging feature of software), 802.1q vlan interface (uses vlan feature of software), veth interface (uses virtual ethernet feature of software), tunnel interface (uses tunnelling feature of software), dummy interface, etc.
 +
 +  * <color maroon>**//Ethernet Interfaces//**</color>: ''eth0'', ''eth1'', etc.\\ are created using ethernet devices (switches, NICs, virtual NICs, etc.). As soon as the [[https://www.kernel.org/doc/html/latest/networking/device_drivers/ethernet/index.html| Ethernet Device driver]] is loaded on the kernel, the driver creates the corresponding network interface.
 +
 +  * <color maroon>**//Wireless Interfaces//**</color>: ''wlan0'', ''wlan0-1'', ''wlan1'', ''ath3'', ''ath_monitor'', etc.
 +
 +  * <color maroon>**//VLAN Interfaces//**</color>: ''eth0.1'', ''eth0.2'', ''br0.1'', ''vlan0'', etc.\\ are created to virtually create multiple network segments to separate [[wp>Broadcast domain]]s. The drivers all participating network cards must support [[wp>IEEE 802.1Q]] and be configured accordingly. This standard allows for up to 4096 VLANs (12Bits).
 +
 +  * <color maroon>**//Stacked VLAN Interfaces//**</color>: [[wp>IEEE 802.1ad]]-support was mainlined in [[http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=8ad227ff89a7e6f05d07cd0acfd95ed3a24450ca|2013-04-19: net: vlan: add 802.1ad support]] Configuration is done using ''ip link'':<code bash>
 +ip link add link eth0 name eth0.1000 type vlan proto 802.1ad id 1000
 +ip link add link eth0.1000 name eth0.1000.1000 type vlan proto 802.1q id 1000
 +</code>
 +
 +  * <color maroon>**//Bridge Interfaces//**</color>: ''br0'', ''br-lan'', etc.\\ are used to make multiple network interfaces act as if they were just one network interface (merging broadcast domains into one). The bridge is fully transparent: hosts connected to one interface see hosts connected to the other interface directly. [[https://goyalankit.com/blog/linux-bridge|More information about bridge interfaces]]
 +
 +  * <color maroon>**//Tunnel Interfaces//**</color>: ''pppoe-dsl'', ''pppoa-dsl'', ''tun0'', ''vpn1'', etc.\\ used to send packets over a [[wp>tunneling protocol]] such as [[wp>Generic Routing Encapsulation|GRE]], [[wp>IPsec]]  [[wp>Point-to-point protocol over Ethernet|PPPoE]], etc.
 +
 +  * <color maroon>**//Alias Interfaces//**</color>: ''eth4:5'', ''eth4:6'', etc.\\  IP-aliases are an obsolete way to manage multiple IP-addresses/masks per interface. Newer tools such as iproute2 support multiple address/prefixes per interface, but aliases are still supported for backwards compatibility. [[https://www.kernel.org/doc/html/latest/networking/alias.html|Documentation/networking/alias.html]]
  
 Two network interfaces can also be bonded together (please see [[wp>Link aggregation]] and [[wp>Channel bonding]] and [[http://wiki.ubuntuusers.de/Netzwerkkarten_b%C3%BCndeln|Ubuntu Wiki]]), [[http://lxr.free-electrons.com/source/Documentation/networking/bonding.txt|Documentation/networking/bonding.txt]] Two network interfaces can also be bonded together (please see [[wp>Link aggregation]] and [[wp>Channel bonding]] and [[http://wiki.ubuntuusers.de/Netzwerkkarten_b%C3%BCndeln|Ubuntu Wiki]]), [[http://lxr.free-electrons.com/source/Documentation/networking/bonding.txt|Documentation/networking/bonding.txt]]
  
-| {{:meta:icons:tango:dialog-information.png?nolink}} |[[docs:techref:uci]] is a small C utility designed to centralize configuration in OpenWrt.\\ ''[[docs:guide-user:base-system:basic-networking|/etc/config/network]]'' is the network configuration file.\\ ''[[docs:guide-user:network:wifi:basic|/etc/config/wireless]]'' is the wireless configuration file.\\ <color maroon>**UCI creates an abstraction layer for configuring network interfaces**</color>:\\ In ''[[docs:guide-user:base-system:basic-networking|/etc/config/network]]'you allocate name like //lan// or //internet_wire// or //whatever// to each ''ifname''-variable for every device and then this name is consistently used through the entire UCI configurationBut this can only be used in conjunction with UCI!|+==== Subinterfaces & Naming the Network Interfaces ==== 
 +The term "subinterface" means that an interface is based off of another interfaceThis term is mostly used for VLAN interfaces.\\ 
 +For example, if the ''br0.5'' VLAN interface is based off of ''br0'', it'subinterface of ''br0''.
  
-===== OpenWrt default configuration ===== +<code> 
-The OpenWrt default configuration is explained in ...+17: br0.5@br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000 
 +    link/ether a1:b2:c3:d4:e5:f6 brd ff:ff:ff:ff:ff:ff 
 +18: br0.8@br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000 
 +    link/ether a1:b2:c3:d4:e5:f6 brd ff:ff:ff:ff:ff:ff 
 +</code> 
 + 
 +Interfaces can be named anything. However, it's more convenient to name for example:\\ 
 +  * A bridge interface with ''br'' to figure out it's a bridge interface\\ 
 +  * A VLAN interface with ''br0'' and ''.5'' to figure out which interface it's based off of and what VLAN ID it uses\\ 
 +by just looking at the name of the interface. 
 +===== OpenWrt Configuration ===== 
 +| {{:meta:icons:tango:dialog-information.png?nolink}} |[[docs:techref:uci]] is a small C utility designed to centralize configuration in OpenWrt.\\ ''[[docs:guide-user:base-system:basic-networking|/etc/config/network]]'' is the network configuration file.\\ ''[[docs:guide-user:network:wifi:basic|/etc/config/wireless]]'' is the wireless configuration file.\\ <color maroon>**UCI creates an abstraction layer for configuring network interfaces**</color>:\\ In ''[[docs:guide-user:base-system:basic-networking|/etc/config/network]]'' you allocate a name like //lan// or //internet_wire// or //whatever// to each ''ifname''-variable for every device and then this name is consistently used through the entire UCI configuration. But this can only be used in conjunction with UCI!|
  
  
  • Last modified: 2022/09/10 07:34
  • by arinc9