Differences
This shows you the differences between two versions of the page.
|
doc:networking:network.interfaces [2012/11/26 07:01] grumbler_eburg |
doc:networking:network.interfaces [2013/05/12 14:18] (current) ralfbergs Fixed typo. |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ===== Types of network interfaces ===== | ===== Types of network interfaces ===== | ||
| - | GNU/Linux universally distinguishes two types of network interfaces: | + | GNU/Linux universally distinguishes between two types of network interfaces: |
| - | * //physical interfaces//: ''eth0'', ''eth1'', ''eth4'', ''radio0'', ''radio1'', ''wlan0'' ..\\ always represent an actual [[wp>Network interface controller|NIC]] or [[wp>Wireless network interface controller|WNIC]]. As soon as the [[wp>Device driver|driver]] is loaded into the Kernel, one or more physical interface become available. | + | |
| - | * //virtual// (or //logical//) //interfaces//: ''lo'', ''eth0:1'', ''eth0.1'', ''vlan2'', ''br0'', ''pppoe-dsl'', ''gre0'', ''sit0'' ''tun0'', ''imq0'', ''teql0'', ..\\ are NOT a actual physical network devices but a software representation with the same properties of a physical connection but more flexibility. They are generally associated with a physical interface such as eth0.1 or eth1.1 etc. One exception is the loopback interface ''lo''. Virtual/Logical interfaces are a useful tool to those users willing to learn about their usage and configuration. | + | ==== Physical Interfaces ==== |
| + | ''eth0'', ''eth1'', ''eth4'', ''radio0'', ''radio1'', ''wlan0'' .. always represent an actual connection between a computer system and a network such as a [[wp>Network interface controller|NIC]] or [[wp>Wireless network interface controller|WNIC]]. As soon as the [[wp>Device driver|driver]] is loaded into the Kernel, one or more physical interfaces become available. | ||
| + | ==== Virtual Interfaces ==== | ||
| + | ''lo'', ''eth0:1'', ''eth0.1'', ''vlan2'', ''br0'', ''pppoe-dsl'', ''gre0'', ''sit0'' ''tun0'', ''imq0'', ''teql0'', .. are NOT actual physical network devices. They are software representations with similar properties to physical connections but with more flexibility. They are generally associated with a physical interface such as eth0.1 or eth1.1 etc but can also associated with virtual ones. One exception is the [[wp>Loopback#Virtual_network_interface|loopback interface]] ''lo''. | ||
| - | ==== Types of physical software interfaces ==== | + | A virtual network interface can be associated with a physical interface (eth1.1)or another virtual interface (eth1.1.1) or stand alone such as a [[wp>Loopback#Virtual_network_interface|loopback interface]] ''lo''. |
| - | One could distinguish between physical interfaces belonging to a NIC and ones belonging to a wireless NIC; due to diverging stacks, they behave slightly differently. | + | |
| - | ==== Types of virtual network interfaces ==== | ||
| - | A virtual network interface can be attached to a physical interface or to another virtual interface. | ||
| - | A virtual network interface can also: | + | A virtual network interface can also : |
| * have one or more <color maroon>**//aliases//**</color>: ''eth4.5'', ''eth4.6'', .. | * have one or more <color maroon>**//aliases//**</color>: ''eth4.5'', ''eth4.6'', .. | ||
| - | * be split into multiple (up to 4096) <color maroon>**//VLAN//**</color>s: ''eth4.0'', ''eth4.1'', ''eth4.3'', ''vlan0'', .. | + | * be split into multiple (up to 4096) <color maroon>**//VLAN//**</color>s: ''eth4.0'', ''eth4.1'', ''eth4.3'', ''vlan0'', |
| - | * be bridged with one another to form a <color maroon>**//bridged interface//**</color>: ''br0'', ''br-lan'', .. (the opposite of VLANs) | + | * be bridged with one another to form a <color maroon>**//bridged interface//**</color>: ''br0'', ''br-lan''(the opposite of VLANs), |
| - | * be a <color maroon>**//tunnel interface//**</color> and be used to send packets over a [[wp>tunneling protocol]]: ''pppoe-dsl'', ''tun0'', ''vpn1'', .. | + | * be a <color maroon>**//tunnel interface//**</color> and used to send packets over a [[wp>tunneling protocol]]: ''pppoe-dsl'', ''tun0'', ''vpn1'', |
| - | * be spawned by daemon to manipulate incoming packages: ''imq0'', ''teql4'', .. See [[http://www.linuximq.net/|imq]], [[http://lartc.org/howto/lartc.loadshare.html|teql]], .. | + | * be spawned by daemon to manipulate incoming packages: ''[[http://www.linuximq.net/|imq]]0, [[http://lartc.org/howto/lartc.loadshare.html|teq]]1'', |
| - | * be spawned dependent on the mode a WNICs is currently working in: ''ath0'', ''ath1'', ''ath_monitor'' | + | * be created automatically depending on the operating mode of a WNIC : ''ath0'', ''ath1'', ''ath_monitor''. |
| - | 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]]) | + | | {{:meta:icons:tango:dialog-information.png?nolink}} | The [[http://wireless.kernel.org/|Linux wireless subsystem]] works a little differently. There is always one //physical interface// for each WNIC called the //master interface//. Then, depending on the mode the master interface is configured to, //ad-hoc (IBSS), managed , AP , WDS, mesh point, monitor//, different //virtual interfaces// are created. This is done automatically by default. When wifi is activated, there always will be the master interface __and__ (at least) one virtual interface! | |
| - | | {{:meta:icons:tango:dialog-information.png?nolink}} | The [[http://wireless.kernel.org/|Linux wireless subsystem]] behaves different: Like for the wired devices, there is always one //physical software interface// for each WNIC and it is called the //master interface//. Then, dependent on the mode the master interface is configured to\\ <html><div align="center">ad-hoc (IBSS) • managed • AP • WDS • mesh point • monitor</div></html>\\ different //virtual software interfaces// are spawned. The difference is, that in contrary to the wired devices, this is done by default. If you enable your wifi and set it in AP mode, there always will be the master interface __and__ compulsory (at least) one virtual interface! | | + | |
| + | ===== Unified Configuration Interface (UCI) ===== | ||
| + | |||
| + | [[doc:techref:UCI]] is a small utility designed to centralize configuration in OpenWRT. | ||
| + | |||
| + | ''[[doc:uci:network|/etc/config/network]]'' is the network configuration file.\\ | ||
| + | ''[[doc:uci:wireless|/etc/config/wireless]]'' is the wireless configuration file. | ||
| + | |||
| + | | {{:meta:icons:tango:dialog-information.png?nolink}} |UCI creates an abstraction layer for configuring interfaces. In ''[[doc/uci/network|/etc/config/network]]'' you allocate a name like //lan// or //bob// or //alice// 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!| | ||
| - | ===== OpenWrt UCI specific ===== | ||
| - | Please note the UCI creates another, additional abstraction layer for the interfaces. In ''[[doc/uci/network|/etc/config/network]]'' you allocate a name like //lan// or //bob// or //alice// 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! | ||
| - | ===== Internal Layout ===== | ||
| - | -> [[doc:techref:internal.layout|Internal Layout]] provides some examples on how physical interfaces are connected to [[wp>Computer port (hardware)|Computer ports]]. | ||
| - | ===== Configuration ===== | ||
| - | -> ''[[doc:uci:network|/etc/config/network]]'' is the [[doc:techref:UCI]] configuration file responsible for all network related adjustments made in OpenWrt.\\ | ||
| - | -> ''[[doc:uci:wireless|/etc/config/wireless]]'' is responsible for all wireless related adjustments made in OpenWrt. | ||
| - | If, for whatever reasons, you want to do stuff manually, here you can read about the available packages: | ||
| + | ===== Interface Utilities ===== | ||
| - | ==== Switch Utilities ==== | ||
| - | A [[wp>Network switch]] may be included on a separate Chip soldered on the PCB or be integrated into the [[doc:hardware:SoC]]. In both cases OpenWrt needs drivers to manage that switch. Additionally there are userspace programs available to configure the switch: | ||
| - | <code> | ||
| - | swconfig | ||
| - | </code> | ||
| - | A switch has Ethernet ports, and sometimes some IC capable of tagging (hardware tagging) but a switch does not contain/incorporate a [[wp>Network interface controller|NIC]]. So Linux will show no physical or virtual software interfaces! Do not confuse a simple //Ethernet port// with a full-blown //NIC//! | ||
| ==== Wired Utilities ==== | ==== Wired Utilities ==== | ||
| Line 115: | Line 109: | ||
| - | ===== Understanding Network Interfaces ===== | ||
| - | {{page>meta:infobox:outdated&noheader&nofooter&noeditbtn}} | ||
| ===== VLAN and bridging concepts ===== | ===== VLAN and bridging concepts ===== | ||
| Line 156: | Line 148: | ||
| This knowledge of bridges is important below. | This knowledge of bridges is important below. | ||
| + | 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]]) | ||
| ===== Interfaces under OpenWrt ===== | ===== Interfaces under OpenWrt ===== | ||
| - | ==== Architecture ==== | + | ==== Internal Layout ==== |
| - | An OpenWrt box is actually three devices in one. It consists of a VLAN-configurable switch, a wireless port, and a Linux host. The switch and host are connected by one internal "wire" ([[wp>Gigabit Media Independent Interface]]), over which VLAN tagged packets are exchanged. All of the physical ethernet ports on the box are just ports on a single internal switch. VLANs are then used to separate the ports into groups. The diagram below shows the architecture. | + | -> [[doc:techref:internal.layout|Internal Layout]] provides some examples on how physical interfaces are connected to [[wp>Computer port (hardware)|Computer ports]]. |
| - | {{:oldwiki:openwrtdocs:asus-internals-default-sm.png}} | ||
| - | By default, the switch is partitioned into two VLANs. Port 0 is configured as VLAN1, and this is labeled on the case as WAN. Ports 1-4 are configured as VLAN0, labeled on the case as LAN1-4. If you wanted, you could actually configure the WAN port as a LAN port, and a LAN port as the WAN port - the label on the chassis simply shows the WAN port in the default configuration. \\ **See http://en.wikipedia.org/wiki/IEEE_802.1Q#Native_VLAN | ||
| - | The native vlan is not tagged. Only the second VLAN needs to be tagged to separate the two data streams.** | + | ==== Architecture ==== |
| + | This wireless router is actually three devices in one - a Linux host, VLAN-configurable switch, and a wireless radio. The Linux host(eth0) and switch (port 5) are connected internally with a [[wp>Gigabit Media Independent Interface]]. The external ethernet ports 0-4 also belong to the same switch. The diagram below shows the architecture. | ||
| + | |||
| + | {{:oldwiki:openwrtdocs:asus-internals-default-sm.png}} | ||
| - | There is an internal port, Port 5, which has a VLAN-tagged connection into the Linux internals. This port is linked to 'eth0' on the Asus WL-500gP. 'eth0' is not configured with an IP address - the kernel takes the raw | + | By default, the switch is configured as two VLANs - vlan0 and vlan1. |
| - | packets from eth0 and using the VLAN tags, it sorts the packets from VLAN0 and VLAN1. Packets to/from VLAN1 are then mapped to a logical interface called 'vlan1', and packets to/from VLAN0 are mapped to a logical interface called 'vlan0'. | + | * Ethernet ports 1-4 (labelled LAN 1-4) are configured to vlan0. |
| + | * Ethernet port 0 (labelled WAN) is configured to vlan1. | ||
| - | There is another channel that's not shown here, which is used to configure the switch itself. The link used to send this configuration is not shown, and is a separate logical device under Linux. | + | Any one of the individual external ports can actually be reassigned to either of the two pre-configured VLANs or even additional user-configured VLANs. The WAN port could be changed to a LAN port or vice-versa. The labels on the chassis simply reflect the default configuration. |
| - | Under OpenWrt, the vlan1 interface is then usually configured with the WAN IP address, and all configuration that applies to the WAN interface (e.g. iptables rules and routes) are applied to the vlan1 interface. | + | | {{:meta:icons:tango:dialog-information.png?nolink}} | The [[wp>IEEE_802.1Q#Native_VLAN|native VLAN]] - vlan1 does not need to be configured. Only the second VLAN - vlan0 needs to be configured to tag its packets to separate the two data streams. | |
| The vlan0 interface is done a bit differently. By default, the wifi interface (eth2) is bridged to the LAN ports, ie any host associated on the wireless port is automatically in the same VLAN/subnet as hosts on the LAN ports. This is done with bridging (see above). As described above, when a bridge is created, a new logical interface is created, called br0, and also as above, this br0 interface is the one that needs to have any IP address configured. So, by default, vlan0 does not have an IP address configured, instead, the LAN interface address is configured on the br0 interface. | The vlan0 interface is done a bit differently. By default, the wifi interface (eth2) is bridged to the LAN ports, ie any host associated on the wireless port is automatically in the same VLAN/subnet as hosts on the LAN ports. This is done with bridging (see above). As described above, when a bridge is created, a new logical interface is created, called br0, and also as above, this br0 interface is the one that needs to have any IP address configured. So, by default, vlan0 does not have an IP address configured, instead, the LAN interface address is configured on the br0 interface. | ||
doc/networking/network.interfaces.1353909668.txt.bz2 · Last modified: 2012/11/26 07:01 by grumbler_eburg
