Skip to content

RFC introduction

[email protected] lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 106 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6Network namespace structureinclude/linux/init_task.h include/linux/net_ns.h include/linux/nsproxy.h +7 more+222 -180 replies
2/6Network device sharing by viewinclude/linux/net_ns.h include/linux/net_ns_dev.h init/version.c +3 more+250 -193 replies
3/6Network devices isolationnet/core/dev.c net/core/rtnetlink.c+126 -421 reply
4/6Network inet devices isolationinclude/linux/inetdevice.h net/ipv4/devinet.c+28 -10 replies
5/6ipv4 isolationinclude/linux/skbuff.h include/net/inet_hashtables.h include/net/inet_timewait_sock.h +10 more+72 -273 replies
6/6Network namespace debugfsfs/debugfs/Makefile fs/debugfs/net_ns.c net/Kconfig+146 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC] [patch 0/6] [Network namespace] introduction

The following patches create a private "network namespace" for use within containers. This is intended for use with system containers like vserver, but might also be useful for restricting individual applications' access to the network stack.

These patches isolate traffic inside the network namespace. The network ressources, the incoming and the outgoing packets are identified to be related to a namespace.

It hides network resource not contained in the current namespace, but still allows administration of the network with normal commands like ifconfig.

It applies to the kernel version 2.6.17-rc6-mm1

It provides the following:
-------------------------
- when an application unshares its network namespace, it looses its view of all network devices by default. The administrator can choose to make any devices to become visible again. The container then gains a view to the device but without the ip address configured on it. It is up to the container administrator to use ifconfig or ip command to setup a new ip address. This ip address is only visible inside the container.

- the loopback is isolated inside the container and it is not possible to communicate between containers via the loopback.

- several containers can have an application bind to the same address:port without conflicting.

What is for ?
-------------
- security : an application can be bounded inside a container without interacting with the network used by another container

- consolidation : several instance of the same application can be ran in different container because the network namespace allows to bind to the same addr:port

What could be done ?
--------------------
- because the network ressources are related to a namespace, it is easy to identify them. That facilitate the implementation of the network migration

How to use ?
------------
- do unshare with the CLONE_NEWNET flag as root
- do echo eth0 > /sys/kernel/debug/net_ns/dev
- use ifconfig or ip command to set a new ip address

What is missing ?
-----------------
The routes are not yet isolated, that implies:

- binding to another container's address is allowed

- an outgoing packet which has an unset source address can potentially get another container's address

- an incoming packet can be routed to the wrong container if there are several containers listening to the same addr:port

--