Ask To Apps
  • Home
  • WordPress
  • Elasticsearch
  • PHP
  • Linux
  • Website Peformance

Tag : vpn-on-linux

Connect VPN on centos linux using command line

12/04/2015 Article

We can setup script for connect cartier love bangle vpn from command line on centos linux. Following are couple of steps but before that, you need to install pptp and pptpsetup on linux.

Run following command with your credentials …

pptpsetup –create <vpn connection name> –server <vpn host> –username <login username> –password <login password> –encrypt

You need to implement cartier love necklace following service on linux. So we can able to stop and start vpn like …

service vpn-service start|stop|status

##!/bin/bash
CHANNEL=&amp;lt;vpn connection name&amp;gt;
NAME="Vpn client"
case "$1" in
start)
echo "Starting ${NAME}..."
check=$(ps -eo pid,ppid,user,comm,args | grep pptpgw | grep -v grep |awk '{print $1}')
if [ -f "/etc/ppp/peers/${CHANNEL}" ];then
echo "Channel ${CHANNEL} exist.."
else
echo "${CHANNEL} doesn't exist! Please use pptp documentation for more information"
fi
if [ -z "$check" ];then
pppd call <a href="http://www.uwst.org/bracelet-replica-car">bracelet replica cartier</a> ${CHANNEL} logfile ~/${CHANNEL}-vpn.log usepeerdns defaultroute
##
echo "$(route -n | tail -n1 | awk '{print $2}')" &amp;gt; /tmp/.${CHANNEL}-vpn.log
sleep 4 ;route del default
##
echo -e "log file is ~/${CHANNEL}-vpn.log"
echo "..."
echo "Done."
else
echo "${NAME} already running [pid = $check]"
fi
;;
stop)
echo "killing ${NAME}..."
kill -9 $(ps -eo pid,comm,args | grep "pppd call ${CHANNEL}" | grep -v grep |awk '{print $1}')
echo "..."
echo "Done."
echo "Please run this command if any issue - $0 net"
;;
net)
route add default gw $(cat /tmp/.${CHANNEL}-vpn.log)
;;
status)
pid_of_dailer=$(ps -eo pid,comm,args | grep "pppd call ${CHANNEL}" | grep -v grep |awk '{print $1}')
pid_of_pptp1=$(ps -eo pid,ppid,user,comm,args | grep pptpgw | grep -v grep |awk '{print $1}')
pid_of_pptp2=$(ps -eo pid,ppid,user,comm,args | grep pptpcm | grep -v grep |awk '{print $1}')
echo -e "${NAME} ~ $pid_of_dailer $pid_of_pptp1 $pid_of_pptp2"
;;
*)
echo "Usage: $0 {start|stop|status|net}"
exit 1
esac
exit 0
#DONE

You need add your vpn hosts IP into resolv.conf

# Generated by NetworkManager
nameserver <vpn host ip>
nameserver <vpn host ip>
nameserver 192.168.0.1

Categories: Linux

Tags: connect vpn, vpn on linux

About Author:

Appa

Recent Posts

  • Install and configure logstash-forwarder
  • Redirect request on php script through squid proxy
  • Alerting for Elasticsearch : Log watcher in elasticsearch using ES Watcher
  • Detect face from image using python script with OpenCV
  • Change mysql root password on centos
  • Search part of word in elasticsearch using nGram – auto-complete search
  • Connect VPN on centos linux using command line
  • Custom river plugin in elasticsearch
  • Backup elasticsearch with snapshot and restore api
  • PHP code to exact keywords from text.

Tags

apache Apache Lucene cache Distributed Elastic Index Elasticsearch elasticsearch performance Git Clone Git Hub Git Hub Configuration Git Hub Installation grep Import Install MySQL JSON over HTTP Linux Linux Command Linux Commands Linux search local file lsyncd md5sum Multile Domain Multisite MySQL Open Source optimization performance php performance real time search remote file Remote Git Hub remote sync RESTful Scale Schema Free Search Engine Search Index Search keyword static cache Sub Domain sync Very fast Wordpress Wordpress multisite

Copyright Ask To Apps 2022 | Proudly powered by WordPress

facebook twitter google linkedin Email Rss