aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/networking/ipvlan.txt
diff options
context:
space:
mode:
authorMahesh Bandewar <maheshb@google.com>2014-11-24 02:07:46 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-24 15:29:18 -0500
commit2ad7bf3638411cb547f2823df08166c13ab04269 (patch)
tree2d31c5a7f0278318d7f6aae805ca4c1296c50afb /Documentation/networking/ipvlan.txt
parent2bbea0a885079a095c252a927a174a0bfec9e3e9 (diff)
ipvlan: Initial check-in of the IPVLAN driver.
This driver is very similar to the macvlan driver except that it uses L3 on the frame to determine the logical interface while functioning as packet dispatcher. It inherits L2 of the master device hence the packets on wire will have the same L2 for all the packets originating from all virtual devices off of the same master device. This driver was developed keeping the namespace use-case in mind. Hence most of the examples given here take that as the base setup where main-device belongs to the default-ns and virtual devices are assigned to the additional namespaces. The device operates in two different modes and the difference in these two modes in primarily in the TX side. (a) L2 mode : In this mode, the device behaves as a L2 device. TX processing upto L2 happens on the stack of the virtual device associated with (namespace). Packets are switched after that into the main device (default-ns) and queued for xmit. RX processing is simple and all multicast, broadcast (if applicable), and unicast belonging to the address(es) are delivered to the virtual devices. (b) L3 mode : In this mode, the device behaves like a L3 device. TX processing upto L3 happens on the stack of the virtual device associated with (namespace). Packets are switched to the main-device (default-ns) for the L2 processing. Hence the routing table of the default-ns will be used in this mode. RX processins is somewhat similar to the L2 mode except that in this mode only Unicast packets are delivered to the virtual device while main-dev will handle all other packets. The devices can be added using the "ip" command from the iproute2 package - ip link add link <master> <virtual> type ipvlan mode [ l2 | l3 ] Signed-off-by: Mahesh Bandewar <maheshb@google.com> Cc: Eric Dumazet <edumazet@google.com> Cc: Maciej Żenczykowski <maze@google.com> Cc: Laurent Chavey <chavey@google.com> Cc: Tim Hockin <thockin@google.com> Cc: Brandon Philips <brandon.philips@coreos.com> Cc: Pavel Emelianov <xemul@parallels.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'Documentation/networking/ipvlan.txt')
-rw-r--r--Documentation/networking/ipvlan.txt107
1 files changed, 107 insertions, 0 deletions
diff --git a/Documentation/networking/ipvlan.txt b/Documentation/networking/ipvlan.txt
new file mode 100644
index 000000000000..cf996394e466
--- /dev/null
+++ b/Documentation/networking/ipvlan.txt
@@ -0,0 +1,107 @@
1
2 IPVLAN Driver HOWTO
3
4Initial Release:
5 Mahesh Bandewar <maheshb AT google.com>
6
71. Introduction:
8 This is conceptually very similar to the macvlan driver with one major
9exception of using L3 for mux-ing /demux-ing among slaves. This property makes
10the master device share the L2 with it's slave devices. I have developed this
11driver in conjuntion with network namespaces and not sure if there is use case
12outside of it.
13
14
152. Building and Installation:
16 In order to build the driver, please select the config item CONFIG_IPVLAN.
17The driver can be built into the kernel (CONFIG_IPVLAN=y) or as a module
18(CONFIG_IPVLAN=m).
19
20
213. Configuration:
22 There are no module parameters for this driver and it can be configured
23using IProute2/ip utility.
24
25 ip link add link <master-dev> <slave-dev> type ipvlan mode { l2 | L3 }
26
27 e.g. ip link add link ipvl0 eth0 type ipvlan mode l2
28
29
304. Operating modes:
31 IPvlan has two modes of operation - L2 and L3. For a given master device,
32you can select one of these two modes and all slaves on that master will
33operate in the same (selected) mode. The RX mode is almost identical except
34that in L3 mode the slaves wont receive any multicast / broadcast traffic.
35L3 mode is more restrictive since routing is controlled from the other (mostly)
36default namespace.
37
384.1 L2 mode:
39 In this mode TX processing happens on the stack instance attached to the
40slave device and packets are switched and queued to the master device to send
41out. In this mode the slaves will RX/TX multicast and broadcast (if applicable)
42as well.
43
444.2 L3 mode:
45 In this mode TX processing upto L3 happens on the stack instance attached
46to the slave device and packets are switched to the stack instance of the
47master device for the L2 processing and routing from that instance will be
48used before packets are queued on the outbound device. In this mode the slaves
49will not receive nor can send multicast / broadcast traffic.
50
51
525. What to choose (macvlan vs. ipvlan)?
53 These two devices are very similar in many regards and the specific use
54case could very well define which device to choose. if one of the following
55situations defines your use case then you can choose to use ipvlan -
56 (a) The Linux host that is connected to the external switch / router has
57policy configured that allows only one mac per port.
58 (b) No of virtual devices created on a master exceed the mac capacity and
59puts the NIC in promiscous mode and degraded performance is a concern.
60 (c) If the slave device is to be put into the hostile / untrusted network
61namespace where L2 on the slave could be changed / misused.
62
63
646. Example configuration:
65
66 +=============================================================+
67 | Host: host1 |
68 | |
69 | +----------------------+ +----------------------+ |
70 | | NS:ns0 | | NS:ns1 | |
71 | | | | | |
72 | | | | | |
73 | | ipvl0 | | ipvl1 | |
74 | +----------#-----------+ +-----------#----------+ |
75 | # # |
76 | ################################ |
77 | # eth0 |
78 +==============================#==============================+
79
80
81 (a) Create two network namespaces - ns0, ns1
82 ip netns add ns0
83 ip netns add ns1
84
85 (b) Create two ipvlan slaves on eth0 (master device)
86 ip link add link eth0 ipvl0 type ipvlan mode l2
87 ip link add link eth0 ipvl1 type ipvlan mode l2
88
89 (c) Assign slaves to the respective network namespaces
90 ip link set dev ipvl0 netns ns0
91 ip link set dev ipvl1 netns ns1
92
93 (d) Now switch to the namespace (ns0 or ns1) to configure the slave devices
94 - For ns0
95 (1) ip netns exec ns0 bash
96 (2) ip link set dev ipvl0 up
97 (3) ip link set dev lo up
98 (4) ip -4 addr add 127.0.0.1 dev lo
99 (5) ip -4 addr add $IPADDR dev ipvl0
100 (6) ip -4 route add default via $ROUTER dev ipvl0
101 - For ns1
102 (1) ip netns exec ns1 bash
103 (2) ip link set dev ipvl1 up
104 (3) ip link set dev lo up
105 (4) ip -4 addr add 127.0.0.1 dev lo
106 (5) ip -4 addr add $IPADDR dev ipvl1
107 (6) ip -4 route add default via $ROUTER dev ipvl1