diff options
Diffstat (limited to 'docs/usecases')
-rw-r--r-- | docs/usecases/Routing.rst | 30 | ||||
-rw-r--r-- | docs/usecases/containerCreation.rst | 38 | ||||
-rw-r--r-- | docs/usecases/containerSetup.rst | 8 |
3 files changed, 39 insertions, 37 deletions
diff --git a/docs/usecases/Routing.rst b/docs/usecases/Routing.rst index cecc2637108..0c5908fd57e 100644 --- a/docs/usecases/Routing.rst +++ b/docs/usecases/Routing.rst @@ -9,7 +9,7 @@ Now for connecting these two linux containers to VPP and pinging between them. Enter container *cone*, and check the current network configuration: -.. code-block:: shell +.. code-block:: console root@cone:/# ip -o a 1: lo inet 127.0.0.1/8 scope host lo\ valid_lft forever preferred_lft forever @@ -24,7 +24,7 @@ Notice that *veth_link1* has no assigned IP. Check if the interfaces are down or up: -.. code-block:: shell +.. code-block:: console root@cone:/# ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1 @@ -42,7 +42,7 @@ Check if the interfaces are down or up: Make sure your loopback interface is up, and assign an IP and gateway to veth_link1. -.. code-block:: shell +.. code-block:: console root@cone:/# ip link set dev lo up root@cone:/# ip addr add 172.16.1.2/24 dev veth_link1 @@ -54,7 +54,7 @@ Here, the IP is 172.16.1.2/24 and the gateway is 172.16.1.1. Run some commands to verify the changes: -.. code-block:: shell +.. code-block:: console root@cone:/# ip -o a 1: lo inet 127.0.0.1/8 scope host lo\ valid_lft forever preferred_lft forever @@ -77,7 +77,7 @@ Now exit this container and repeat this process with container *ctwo*, except wi After thats done for *both* containers, exit from the container if you're in one: -.. code-block:: shell +.. code-block:: console root@ctwo:/# exit exit @@ -85,7 +85,7 @@ After thats done for *both* containers, exit from the container if you're in one In the machine running the containers, run **ip link** to see the host *veth* network interfaces, and their link with their respective *container veth's*. -.. code-block:: shell +.. code-block:: console root@localhost:~# ip link 1: lo: <LOOPBACK> mtu 65536 qdisc noqueue state DOWN mode DEFAULT group default qlen 1 @@ -112,7 +112,7 @@ Remember our network interface index 32 in *cone* from this :ref:`note <networkN With VPP in the host machine, show current VPP interfaces: -.. code-block:: shell +.. code-block:: console root@localhost:~# vppctl show inter Name Idx State MTU (L3/IP4/IP6/MPLS) Counter Count @@ -122,14 +122,14 @@ Which should only output local0. Based on the names of the network interfaces discussed previously, which are specific to my systems, we can create VPP host-interfaces: -.. code-block:: shell +.. code-block:: console root@localhost:~# vppctl create host-interface name vethQL7K0C root@localhost:~# vppctl create host-interface name veth8NA72P Verify they have been set up properly: -.. code-block:: shell +.. code-block:: console root@localhost:~# vppctl show inter Name Idx State MTU (L3/IP4/IP6/MPLS) Counter Count @@ -142,14 +142,14 @@ Which should output *three network interfaces*, local0, and the other two host n Set their state to up: -.. code-block:: shell +.. code-block:: console root@localhost:~# vppctl set interface state host-vethQL7K0C up root@localhost:~# vppctl set interface state host-veth8NA72P up Verify they are now up: -.. code-block:: shell +.. code-block:: console root@localhost:~# vppctl show inter Name Idx State MTU (L3/IP4/IP6/MPLS) Counter Count @@ -160,7 +160,7 @@ Verify they are now up: Add IP addresses for the other end of each veth link: -.. code-block:: shell +.. code-block:: console root@localhost:~# vppctl set interface ip address host-vethQL7K0C 172.16.1.1/24 root@localhost:~# vppctl set interface ip address host-veth8NA72P 172.16.2.1/24 @@ -168,7 +168,7 @@ Add IP addresses for the other end of each veth link: Verify the addresses are set properly by looking at the L3 table: -.. code-block:: shell +.. code-block:: console root@localhost:~# vppctl show inter addr host-vethQL7K0C (up): @@ -179,7 +179,7 @@ Verify the addresses are set properly by looking at the L3 table: Or looking at the FIB by doing: -.. code-block:: shell +.. code-block:: console root@localhost:~# vppctl show ip fib ipv4-VRF:0, fib_index:0, flow hash:[src dst sport dport proto ] locks:[src:plugin-hi:2, src:default-route:1, ] @@ -238,7 +238,7 @@ Or looking at the FIB by doing: At long last you probably want to see some pings: -.. code-block:: shell +.. code-block:: console root@localhost:~# lxc-attach -n cone -- ping -c3 172.16.2.2 PING 172.16.2.2 (172.16.2.2) 56(84) bytes of data. diff --git a/docs/usecases/containerCreation.rst b/docs/usecases/containerCreation.rst index fb38b3ed135..9b2cc126133 100644 --- a/docs/usecases/containerCreation.rst +++ b/docs/usecases/containerCreation.rst @@ -5,15 +5,17 @@ Creating Containers ___________________ -First you should have root privileges: +Make sure you have gone through :ref:`installingVPP` on the system you want to create containers on. -.. code-block:: shell +After VPP is installed, get root privileges with: - ~$ sudo bash +.. code-block:: console + + $ sudo bash Then install packages for containers such as lxc: -.. code-block:: shell +.. code-block:: console # apt-get install bridge-utils lxc @@ -26,7 +28,7 @@ Since we want to ping between two containers, we'll need to **add to this file** Look at the contents of *default.conf*, which should initially look like this: -.. code-block:: shell +.. code-block:: console # cat /etc/lxc/default.conf lxc.network.type = veth @@ -40,13 +42,13 @@ Now you will *append to this file* so that each container you create will have a You can do this by piping *echo* output into *tee*, where each line is separated with a newline character *\\n* as shown below. Alternatively, you can manually add to this file with a text editor such as **vi**, but make sure you have root privileges. -.. code-block:: shell +.. code-block:: console # echo -e "lxc.network.name = veth0\nlxc.network.type = veth\nlxc.network.name = veth_link1" | sudo tee -a /etc/lxc/default.conf Inspect the contents again to verify the file was indeed modified: -.. code-block:: shell +.. code-block:: console # cat /etc/lxc/default.conf lxc.network.type = veth @@ -62,7 +64,7 @@ After this, we're ready to create the containers. Creates an Ubuntu Xenial container named "cone". -.. code-block:: shell +.. code-block:: console # lxc-create -t download -n cone -- --dist ubuntu --release xenial --arch amd64 --keyserver hkp://p80.pool.sks-keyservers.net:80 @@ -79,7 +81,7 @@ If successful, you'll get an output similar to this: Make another container "ctwo". -.. code-block:: shell +.. code-block:: console # lxc-create -t download -n ctwo -- --dist ubuntu --release xenial --arch amd64 --keyserver hkp://p80.pool.sks-keyservers.net:80 @@ -87,7 +89,7 @@ Make another container "ctwo". List your containers to verify they exist: -.. code-block:: shell +.. code-block:: console # lxc-ls cone ctwo @@ -95,13 +97,13 @@ List your containers to verify they exist: Start the first container: -.. code-block:: shell +.. code-block:: console # lxc-start --name cone And verify its running: -.. code-block:: shell +.. code-block:: console # lxc-ls --fancy NAME STATE AUTOSTART GROUPS IPV4 IPV6 @@ -114,10 +116,10 @@ And verify its running: Here are some `lxc container commands <https://help.ubuntu.com/lts/serverguide/lxc.html.en-GB#lxc-basic-usage>`_ you may find useful: - .. code-block:: shell + .. code-block:: console - sudo lxc-ls --fancy - sudo lxc-start --name u1 --daemon - sudo lxc-info --name u1 - sudo lxc-stop --name u1 - sudo lxc-destroy --name u1 + $ sudo lxc-ls --fancy + $ sudo lxc-start --name u1 --daemon + $ sudo lxc-info --name u1 + $ sudo lxc-stop --name u1 + $ sudo lxc-destroy --name u1 diff --git a/docs/usecases/containerSetup.rst b/docs/usecases/containerSetup.rst index d1c230daf24..e0fd81eebc3 100644 --- a/docs/usecases/containerSetup.rst +++ b/docs/usecases/containerSetup.rst @@ -9,14 +9,14 @@ Now we can go into container *cone* and install prerequisites such as VPP, and p To enter our container via the shell, type: -.. code-block:: shell +.. code-block:: console # lxc-attach -n cone root@cone:/# Run the linux DHCP setup and install VPP: -.. code-block:: shell +.. code-block:: console root@cone:/# resolvconf -d eth0 root@cone:/# dhclient @@ -28,13 +28,13 @@ Run the linux DHCP setup and install VPP: After this is done, start VPP in this container: -.. code-block:: shell +.. code-block:: console root@cone:/# service vpp start Exit this container with the **exit** command (you *may* need to run **exit** twice): -.. code-block:: shell +.. code-block:: console root@cone:/# exit exit |