Monday, June 27, 2016

Connect two ovs bridges

Following the following steps to connect two ovs-bridges:

1. Create two devices using veth type:

     ip link add dev "int-to-prov" type veth peer name "prov-to-int"

2. Add int-to-prov port to br-int , set the type to be patch and peer altogether using the following
    two different methods:


     ovs-vsctl add-port br-int int-to-prov
     ovs-vsctl set interface int-to-prov type=patch
     ovs-vsctl set interface int-to-prov options:peer=prov-to-int

    or

    ovs-vsctl add-port br-int int-to-prov -- set interface int-to-prov type=patch options:peer=prov-to-int


3. Add the other port to the second bridge:

    ovs-vsctl add-port br-provider prov-to-int -- set interface prov-to-int type=patch options:peer=int-to-prov

4. Now bring both ports up:

    ip link set dev prov-to-int up
    ip link set dev int-to-prov up

Saturday, June 25, 2016

OpenFlow Table Basics

OpenFlow Flow Table has following three things:

Header Field, Action, Counters

Header Field:
     Each flow table header entry is made up of six components, which define the matching rules and
     other basic rules for the corresponding flow.

     Match Fields:  Used to select packets that match the values in the fields
             Ingress Port, Ethernet Source, Ethernet Destionation, Ethernet Type, VLAN ID,
             VLAN Priority, IP Source, IP Destination, IP Protocol, IP ToS Bits,
             TCP/UDP Source Ports, TCP/UDP Designation Ports


     Priority: Relative priority of table entries.
     Counters: Updated for matching packets
     Instructions:  Actions to be taken if a match occurs
     Timeouts: Maximum amount of idle time before a flow is expired by the switch
     Cookie: Opague data value chosen by the controller


Action:
     Each flow entry is associated with zero or more actions that dictate how the device handles
     matching packets. Actions in OpenFlow specification are defined as required and optional.
     Optional actions are not required to be implemented by vendors as such.

     Forward:   required actions are ALL, Controller, Local, Table, In-Port
                       optional actions are Normal, Flood
     Drop: required
     Modify Field: optional


Counters:
     Counters are maintained per-table, per-flow, per-port and per queue. There are a set of required
     counters that all the implementations should support and there are additionally optional counters.
     Here are various counters:

     Table: Active entries, Packet Lookup, Packet Matches

     Flow: Received Packets, Received Bytes, Duration (seconds), Duration(nanoseconds)

     Port: Received Packets, Transimitted Packets, Received Bytes, Transimitted Bytes,
              Receive Drops, Transmit Drops, Receive Errors, Receive Frame Alignment Errors,
              Receive Overrun Errors, Receive CRC Errors, Collisions

     Queue: Transmit Packets, Transmit Bytes, Transmit Overrun Errors
   
Examples:

     match=(eth.src[40]), action=(drop;)

a broadcast/multicast source MAC, gets dropped

     match=(vlan.present), action=(drop;)

Anything with a logical VLAN tag.

Friday, June 24, 2016

Neutron metadata agent

The Neutron metadata agent runs at hard coded (more like a standard since Amazon also use that) 169.254.169.254 in the namespace of the tenant network. So if the metadata agent runs correctly, the address is pingable from the namespace. And VMs should also be able to ping that address.

Types of Linux Users

Linux has four types of accounts:
  • Root or Super user
  • System
  • Normal
  • Network
Use the following commands to check user types:

      #id
      #id nova

Add a user without home directory, Ubuntu adding a user by default won't create home directory:

     #useradd neutron

When happens when a OVN network and its subnet get created

  1. A logical switch will be created, using command "ovn-nbctl show" to verify. 
  2. A number of ports will be automatically added, these ports are for DHCP agent instances. They normally should occupy first few IPs in the subnet, for example, if the subnet is 172.16.31.0/24, then most likely 172.16.31.2 and 172.16.31.3 will be used for two DHCP agents if neutron is configured to have two dhcp agents per network. 172.16.31.1 will be most likely reserved for gateway if default is used. The neutron config parameter to control how many dhcp agents should be for a network is "dhcp_agents_per_network"
  3. A namespace will be created on all compute nodes, the server runs ovn-northd actually will not have the namespace unless that node is also a compute node.
  4. On the compute node where dhcp agent runs, there should be a new dnsmasq instance which allocate the IPs for the subnet. 
  5. There should be one Port_Binding entry on each chassis for the new network. Use "ovn-sbctl show" to verify, this is probably due to the dhcp agent port.
  6. Port_Binding table by using "ovsdb-client dump tcp:127.0.0.1:6642" (where the southbound database is located) should show that each port will use different tunnel key.
  7. br-int bridge should have a port/interface for the dhcp server. Use "ovs-vsctl show" command to verify, here is an example:
  8.     Bridge br-int
            fail_mode: secure
            Port "tap97ef22d4-c7"
                Interface "tap97ef22d4-c7"
                    type: internal
    
  9. Anything more? 

File permissions

To view the files owned by the group "test" and user "luser' use FIND command
 
1. Find all the groups available on your system:


    cat /etc/group |cut -d: -f1


2. For finding the groups that the current user belongs to:


    groups luser test adm cdrom sudo dip plugdev lpadmin sambashare


3. For finding groups user luser belongs to:


    groups luser 
    luser : test luser adm cdrom sudo dip plugdev lpadmin sambashare


4. Now to see the files owned by group "test" in particular path or folder. Try


    find /home -group test

    find /etc -group root

5. To see all the users in the system:

    compgen -u

6. To see all the groups in the system:

    compgen -g
 

Wednesday, June 22, 2016

Linux kernel related procedures

How to list all installed linux kernels:

    dpkg --list | grep linux-image

How to install linux kernel 3.19

   
    apt-get install linux-image-generic-lts-vivid linux-headers-generic-lts-vivid
 
How to remove older kernels
 
    dpkg -l | tail -n +6 | grep -E 'linux-image-[0-9]+' | grep -Fv $(uname -r)
 
    then use the output from the above command:
 
    sudo dpkg --purge <<linux-image-4.2.0-15-generic>>