Monday, November 28, 2016

crontab gotches

when you use crontab -e to add new tasks, the chances are that you found that for some reason that your scripts or command did not seem to run, the reason most likely is because that path was not set up right. Since cron job does not actually have any environment variables setup, so these command which normally resides in /bin, /sbin probably can not be found, the easy solution is to add that at the top of the crontab file when you start the following command:

    crontab -e

MAILTO=""
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin

The MAILTO will make sure that the script won't try to send out an email on the command output.

Wednesday, November 16, 2016

Useful networking commands

  
1. Add a default gateway:
 
route add default gw {IP-ADDRESS} {INTERFACE-NAME}
 
for example:
  route add default gw 9.30.217.1 br-ex
 
 
2. Find the default gateway:
 
route -n
 
The destination with 0.0.0.0 should indicate the default gateway and its interface
 
3. How to assign ip, broadcast and netmask to an interface:
 
ifconfig eth0 172.16.25.125 netmask 255.255.255.224 broadcast 172.16.25.63
 
4. Assign ip, broadcast and netmask using ip command:
 
ip address add {IP_CIDR} brd + dev {INTERFACE-NAME} 
 
for example: 
 
    ip addr add 192.168.1.50/24 brd + dev eth0 
 
5. Add a default gateway using IP command:
 
ip route add default via {GATEWAY_IP_ADDRESS} dev {INTERFACE-NAME

for example:

   ip route add default via 9.30.217.1 dev br-ex
 

Thursday, November 10, 2016

Excellent OVN related information

Dustin Spinhirne has these excellent OVN blogs, having the link below to be referenced often.

http://blog.spinhirne.com/p/blog-series.html#introToOVN

Few network related commands

To see how many bridges exist in your system:

      ovs-vsctl list-br

To verify the connectivities amongs hosts:

     netstat -antp | grep destination-IP
   
     For example, to see a host and the connectivity at ip 10.0.2.25, use this command:
  
  netstat -antp | grep 10.0.2.25
 
  Here is the results:
 
tcp        0      0 10.0.2.26:60536         10.0.2.25:5672          ESTABLISHED 6977/python
tcp        0      0 10.0.2.26:60526         10.0.2.25:5672          ESTABLISHED 31103/python
tcp        0      0 10.0.2.26:34444         10.0.2.25:6642          ESTABLISHED 6717/ovn-controller
tcp        0      0 10.0.2.26:60542         10.0.2.25:5672          ESTABLISHED 6977/python
tcp        0      0 10.0.2.26:60538         10.0.2.25:5672          ESTABLISHED 6977/python
tcp        0      0 10.0.2.26:39282         10.0.2.25:3306          ESTABLISHED 31103/python
tcp        0      0 10.0.2.26:60528         10.0.2.25:5672          ESTABLISHED 31103/python
 
5672 is the default port for rabbitmq
6642 is the port for ovn south bound db
3306 is the default port for mysql