]>
Commit | Line | Data |
---|---|---|
2a9721f1 SH |
1 | .TH IP\-NETNS 8 "20 Dec 2011" "iproute2" "Linux" |
2 | .SH NAME | |
aab2702d | 3 | ip-netns \- process network namespace management |
2a9721f1 SH |
4 | .SH SYNOPSIS |
5 | .sp | |
6 | .ad l | |
7 | .in +8 | |
8 | .ti -8 | |
9 | .B ip | |
10 | .RI "[ " OPTIONS " ]" | |
11 | .B netns | |
12 | .RI " { " COMMAND " | " | |
13 | .BR help " }" | |
14 | .sp | |
15 | .ti -8 | |
16 | .BR "ip netns" " { " list " } " | |
17 | ||
18 | .ti -8 | |
19 | .BR "ip netns" " { " add " | " delete " } " | |
20 | .I NETNSNAME | |
21 | ||
22 | .ti -8 | |
23 | .BR "ip netns exec " | |
24 | .I NETNSNAME command ... | |
25 | ||
26 | .SH DESCRIPTION | |
27 | A network namespace is logically another copy of the network stack, | |
28 | with it's own routes, firewall rules, and network devices. | |
29 | ||
30 | By convention a named network namespace is an object at | |
31 | .BR "/var/run/netns/" NAME | |
32 | that can be opened. The file descriptor resulting from opening | |
33 | .BR "/var/run/netns/" NAME | |
34 | refers to the specified network namespace. Holding that file | |
35 | descriptor open keeps the network namespace alive. The file | |
36 | descriptor can be used with the | |
37 | .B setns(2) | |
38 | system call to change the network namespace associated with a task. | |
39 | ||
40 | The convention for network namespace aware applications is to look | |
41 | for global network configuration files first in | |
42 | .BR "/etc/netns/" NAME "/" | |
43 | then in | |
44 | .BR "/etc/". | |
45 | For example, if you want a different version of | |
46 | .BR /etc/resolv.conf | |
47 | for a network namespace used to isolate your vpn you would name it | |
48 | .BR /etc/netns/myvpn/resolv.conf. | |
49 | ||
50 | .B ip netns exec | |
51 | automates handling of this configuration, file convention for network | |
52 | namespace unaware applications, by creating a mount namespace and | |
53 | bind mounting all of the per network namespace configure files into | |
54 | their traditional location in /etc. | |
55 | ||
56 | .SS ip netns list - show all of the named network namespaces | |
57 | .SS ip netns add NAME - create a new named network namespace | |
58 | .SS ip netns delete NAME - delete the name of a network namespace | |
59 | .SS ip netns exec NAME cmd ... - Run cmd in the named network namespace | |
60 | ||
61 | .SH EXAMPLES | |
62 | ||
63 | .SH SEE ALSO | |
64 | .br | |
65 | .BR ip (8) | |
66 | ||
67 | .SH AUTHOR | |
68 | Original Manpage by Eric W. Biederman |