added command-line example
This commit is contained in:
parent
c9bb059a6c
commit
b753a9d4f8
1 changed files with 42 additions and 1 deletions
|
@ -8,7 +8,48 @@ Each namespace has its own loopback device and process space. Virtual or real de
|
|||
|
||||
You do not need to patch your kernel in order to use network namespaces. Modern distros such as Ubuntu 10.04 and Fedora 13 have netns support turned on in their default kernels.
|
||||
|
||||
= CORE Namespaces HOWTO =
|
||||
= Command-line Example =
|
||||
|
||||
Below is an example of building two virtual nodes from the command-line, and connecting them with a bridge (a wired network in CORE.) The `vnoded` and `vcmd` commands are provided by CORE. See the Python script examples for doing this at a higher level with Python scripting.
|
||||
|
||||
{{{
|
||||
#!/bin/sh
|
||||
# Below is a transcript of creating two emulated nodes and connecting them
|
||||
# together with a wired link. You can run the core-cleanup.sh script to clean
|
||||
# up after this script.
|
||||
|
||||
# create node 1 namespace container
|
||||
vnoded -c /tmp/n1.ctl -l /tmp/n1.log -p /tmp/n1.pid
|
||||
# create a virtual Ethernet (veth) pair, installing one end into node 1
|
||||
ip link add name n1.0.1 type veth peer name n1.0
|
||||
ip link set n1.0 netns `cat /tmp/n1.pid`
|
||||
vcmd -c /tmp/n1.ctl -- ip link set n1.0 name eth0
|
||||
vcmd -c /tmp/n1.ctl -- ifconfig eth0 10.0.0.1/24
|
||||
|
||||
# create node 2 namespace container
|
||||
vnoded -c /tmp/n2.ctl -l /tmp/n2.log -p /tmp/n2.pid
|
||||
# create a virtual Ethernet (veth) pair, installing one end into node 2
|
||||
ip link add name n2.0.1 type veth peer name n2.0
|
||||
ip link set n2.0 netns `cat /tmp/n2.pid`
|
||||
vcmd -c /tmp/n2.ctl -- ip link set n2.0 name eth0
|
||||
vcmd -c /tmp/n2.ctl -- ifconfig eth0 10.0.0.2/24
|
||||
|
||||
# bridge together nodes 1 and 2 using the other end of each veth pair
|
||||
brctl addbr b.1.1
|
||||
brctl setfd b.1.1 0
|
||||
brctl addif b.1.1 n1.0.1
|
||||
brctl addif b.1.1 n2.0.1
|
||||
ip link set n1.0.1 up
|
||||
ip link set n2.0.1 up
|
||||
ip link set b.1.1 up
|
||||
|
||||
# display connectivity and ping from node 1 to node 2
|
||||
brctl show
|
||||
vcmd -c /tmp/n1.ctl -- ping 10.0.0.2
|
||||
}}}
|
||||
|
||||
|
||||
= Old Instructions for Building from Source =
|
||||
CORE 4.0 supports network namespaces now. You can now follow the instructions in the manual or the [Quickstart] page. *Below are old instructions for using the development snapshot:*
|
||||
|
||||
# install Ubuntu 10.04 or 9.10, or Fedora 13 or 12 (namespace support is built-in!) If you already have Linux installed you can check [NamespaceKernels your kernel version] to see if it supports network namespace virtualization:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue