Feeds:
Posts
Comments

Archive for the ‘Scripts’ Category

Here is a script to find the maximum MTU (the value before the packet is fragmented). I was not particularly satisfied with dlsreports guide. The command given for us linux might not work most of the time (doesn’t prohibit fragmentation at time) as well as it is not an automatic operation but relies on trial and error.

=================================================================================

#!/bin/bash

PKT_SIZE=1472
HOSTNAME="www.dslreports.com"

count=`ping -M do -c 1 -s $PKT_SIZE $HOSTNAME | grep -c "Frag needed"`

while [ $count -eq 1 ]; do
 ((PKT_SIZE--))
 count=$((`ping -M do -c 1 -s $PKT_SIZE $HOSTNAME | grep -c "Frag needed"`))
done

printf "Your Maximum MTU is [ $((PKT_SIZE + 28)) ] \n"

=============================================================================================

This script will neatly print out the maximum MTU at the end of the operation after finding the optimal value of the packet size.

Explaination:

-M do : Select Path MTU Discovery strategy do (pro‐hibit  fragmentation,  even local one)

-c : to stop ping when you are done sending information.

Advertisements

Read Full Post »

After so much procrastination, I finally spent some effort finishing up a script for easy installation and access to NUS SoC-VPN. 2 years of painful experience without much help (NOC documentation / helpdesk  is Fedora-centric and the linuxNUS wiki / manual isn’t that Debian/Ubuntu-friendly either) and frustration from frequent disconnection from SoC server, the suffering has finally ended. Self-help seems to be the best companion.

My SoC-VPN script provides a seamless installation and easy connect / disconnect to NUS SoC network as well as simplify the process to be as less obstructive as possible. It is a refined version of what I have been using for the past year.

Features include: dependencies checking, ready-to-run anywhere, easy to use, unobtrusive (no NOC netlogon screen), no additional packages required (like curl or lynx), root-usage checking, helpful usage, ubuntu-friendly

1 – Download my script in tar.gz format here

MediaFire | Mirror 1

md5sum: 02096667f7d3c85a6029a44414e49bea
crc32 : 4d73de35

2 – Untar it to Desktop by using Ubuntu Archive Manager or run the following command at the directory where you downloaded my script:

tar -xvzf socVPN_idyllic.tar.gz -C ~/Desktop/

3 – A folder name “socVPN_idyllic” will be created on your desktop. Run the following commands to proceed

cd ~/Desktop/socVPN_idyllic
chmod +x install_socvpn.sh
./install_socvpn.sh

4 – The script will prompt you for sudo password when it needed to copy configuration file to /etc/openvpn/ directory.

5 – Installation Completed 🙂 You can now delete the folder “socvpn_idyllic”

6 – Quick start : Remember to run at sudoer level!

To connect
sudo socvpn --start

To disconnect
sudo socvpn --stop

For a complete list of command, run “socvpn” or “sudo socvpn –help”.

I am open to suggestion 🙂 Feel free to contact me for constructive criticism. I am still a n00b. Cheers.

EDIT:
After download and extract files from the archive, edit socvpn.conf. Insert this line before the last line (route-up line) without the quote : ` mssfix 1460 `

Also change the last line to
route-up “sleep 5; wget https://noc.comp.nus.edu.sg/netlogon -O /tmp/netlogon 1>/dev/null 2>&1 &”

If there is still frequent disconnection, re-run the script the go to this page in your browser
https://noc.comp.nus.edu.sg/netlogon

Read Full Post »