Prefer using ip instead of ifconfig.

Includes other minor improvements.
This commit is contained in:
tgoff0 2015-05-22 00:55:20 +00:00
parent 2f3ec89ef4
commit c68e05b4b5
5 changed files with 33 additions and 25 deletions

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -e
# Below is a transcript of creating two emulated nodes and connecting them
# together with a wired link. You can run the core-cleanup script to clean
# up after this script.
@ -8,16 +8,16 @@ 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
vcmd -c /tmp/n1.ctl -- /bin/sh -e -c \
"ip link set lo up && ip link set n1.0 name eth0 up && ip addr add 10.0.0.1/24 dev eth0"
# 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
vcmd -c /tmp/n2.ctl -- /bin/sh -e -c \
"ip link set lo up && ip link set n2.0 name eth0 up && ip addr add 10.0.0.2/24 dev eth0"
# bridge together nodes 1 and 2 using the other end of each veth pair
brctl addbr b.1.1