Skip to main content

IPIP tunnel creator via bash

   1:  #!/bin/bash
   2:  #
   3:  # Tunnel ipip Automation
   4:  # Creator: Shiran Guez
   5:  #
   6:  TUN_ETH="eth0"
   7:  IP_DEST_EXT=""
   8:  TUNNEL_IP_SRC=""
   9:  TUNNEL_IP_DST=""
  10:  _CREATE_ () {
  11:  echo "Please enter the name of your local interface [eth0 is default]: "
  12:  echo "[ To Skip enter >>>skip<<< ]"
  13:  while :;
  14:  do
  15:      read COMM_ETH
  16:      if [ "$COMM_ETH" == "skip" ] ;then 
  17:          break
  18:      elif [ "$COMM_ETH" == "eth0" ] ;then
  19:          break
  20:      else
  21:          ifconfig "$COMM_ETH" >/dev/null
  22:          if [ $? -eq 0 ] ;then
  23:              TUN_ETH="$COMM_ETH"
  24:              break
  25:          else
  26:              echo "You have entered a wrong ethernet interface"
  27:              echo "Please try again: "
  28:          fi
  29:      fi
  30:   
  31:  done
  32:  localip=$(ifconfig $TUN_ETH | grep Bcast | awk '{print $2}' | awk -F: '{print $2}')
  33:  echo "Please enter the destination IP for the tunnel: "
  34:  while :;
  35:  do
  36:      read IP_DEST_EXT
  37:      echo "Are you sure $IP_DEST_EXT is a valid IP [Y]:"
  38:      read ANS_ME
  39:      ANS_ME=$(echo $ANS_ME | tr a-z A-Z)
  40:      if [ "$ANS_ME" == "Y" ] ;then
  41:          break
  42:      else
  43:          echo "Please enter destination again:"
  44:       fi
  45:  done       
  46:  echo "Please enter tunnel IP and Peer Address: "
  47:  while :;
  48:  do  
  49:      echo "IP : "    
  50:          read TUNNEL_IP_SRC
  51:      echo "Peer : "
  52:      read TUNNEL_IP_DST
  53:      echo "Peer subnet mask [ /16 , /24 ...]: "
  54:      read TUNNEL_IP_DST_MASK
  55:      echo "Tunnel IP will be $TUNNEL_IP_SRC and its peer address will be $TUNNEL_IP_DST using subnet mask $TUNNEL_IP_DST_MASK"
  56:      echo "Please confirm [Y]:"
  57:          read ANS_ME_NOW
  58:          ANS_ME_NOW=$(echo $ANS_ME_NOW | tr a-z A-Z)
  59:          if [ "$ANS_ME_NOW" == "Y" ] ;then
  60:                  break
  61:          else
  62:                  echo "Please enter again:"
  63:          fi
  64:   
  65:  done
  66:  ip tu ad ipiptun mode ipip local $localip remote $IP_DEST_EXT ttl 64 dev $TUN_ETH
  67:  ip ad ad dev ipiptun $TUNNEL_IP_SRC peer $TUNNEL_IP_DST/$TUNNEL_IP_DST_MASK
  68:  ifconfig ipiptun up
  69:  }
  70:   
  71:  _DESTROY_ () {
  72:  ip add | grep ipiptun > /dev/null
  73:  if [ $? -eq 0 ] ;then
  74:      ifconfig ipiptun down
  75:      echo "Tunnel was removed"
  76:  else
  77:      echo "No Tunnel to remove"
  78:  fi
  79:  }
  80:   
  81:  lsmod | grep ipip > /dev/null
  82:  if [ $? -eq 0 ] ;then
  83:      while :;
  84:      do
  85:          echo "Please enter 1 to create or 2 for removing a tunnel"
  86:          read SELECTION
  87:          if [ "$SELECTION" == "1" ] ; then
  88:              _CREATE_
  89:              break
  90:          elif [ "$SELECTION" == "2" ] ; then
  91:              _DESTROY_
  92:              break
  93:          fi
  94:      
  95:      done
  96:  else
  97:      echo "ipip module is not loaded try to first load the ipip module and then run the tool again, Thank you!"
  98:  fi
Post a Comment

Popular posts from this blog

Step By Step MPLS – Basic MPLS Setup

Initial configuration , very basic with no MPLS, connectivity only to directly connected interfaces.R1R2R3R4!
!
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 10.0.31.1 255.255.255.0
duplex auto
speed auto
!
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip address 10.0.42.2 255.255.255.0
duplex auto
speed auto
!
!
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
no clns route-cache
!
interface FastEthernet0/0
ip address 10.0.31.3 255.255.255.0
duplex auto
speed auto
  no clns route-cache
!
interface Serial1/0
ip address 10.0.43.3 255.255.255.0
  serial restart-delay 0
no clns route-cache
!
!
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
no clns route-cache
!
interface FastEthernet0/0
ip address 10.0.42.4 255.255.255.0
duplex auto
speed auto
!
interface Serial1/0
ip address 10.0.43.4 255.255.255.0
  serial restart-delay 0
no clns route-cache
!
adding to the following configuration MPLS labels we will start wi…

What is about to change in CISSP from Apr 2018

Change have arrived and like with other professional certification there is almost a standard time before certification gets its update, with most anywhere it is between 3 - 4 years, CISSP is no different and since last update was on 2015 the change is arriving here as well.

For the people that wish to see the official existing and new outline

I have decided to write this post as the new out line is more of a list of Domain and Sections within the domain without hint or indication to what was modified actually and I could not find anyone else that done that comparison, I had to take the task and do the comparison, please be advised that I have done it for my own "pleasure" so apologies if I missed something :-)
Lets start with the obvious change:
CISSP - Before Apr 2018CISSP - from Apr 20181. Security and Risk Management16%15%2. Asset Security10%10%3. Security Engineering12%13%4. Communications and Network Security12%14%5. Identity and Access Management13%13%6. …

VRF Maximum Routes

Maximum routes under customer vrf, if the service provider had unlimited resources he would not have needed that!
however normally resources are limited and expensive, and Service provider would like to make money from his available resources. maximum routes configured under VRF provide a mean of controlling PE local resource and abuse avoidance from the CE side.I have vrf called DC_EXTRANET, you can see that I have 16 routes, I have configured 10 maximum routes under that vrf however I did not want to be aggressive so I have set the warning only option. See that immediately I get a notice that I have more routes then the maximum, however no action is taken other then alerting and sending a syslog. ! PE_ashdod_otherisp.n(config-vrf)# maximum routes 10 warning-only % The current number of routes in the routing table is equal to, or exceeds the configured warning limit PE_ashdod_otherisp.n(config-vrf)# *Nov 26 20:39:41.175: %IPRT-3-ROUTELIMITWARNING: IP routing table limit warning - DC_…