Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Sunday, July 6, 2014

Smokeping to Monitor Network Latency in UBUNTU

Smokeping to Monitor Network Latency in UBUNTU

ping
Recently I was troubleshooting a network where concerned Admin complained that they frequently lost connectivity with the Internet. Sometimes pings replies works okay but latency gets high or timeout / breaks occurs. So I decided to setup mrtg base ping graph to monitor ping latency. The custom made mrtg ping probe worked fine and can provide an overview on target ping / rtt and Downtime in a nice manner,
BUT . . . . . . . . . . . . . . . . . . .
I was thinking far ahead , I was thinking for much more advanced latency and pin point graphs which can show ping latency / rtt / loss in much more detailed way. I recalled my memory from old days when I used to monitor my old network with variety of tools and scripts and suddenly a name popped in my mind " SMOKEPING " , yes this was the tool I was looking for.
SmokePing generates graphs that can reveal the quality (packet loss and latency variability) & reach-ability of your IP address from several distributed locations. SmokePing is a network latency monitor. It measures network latency to a configurable set of destinations on the network, and displays its findings in easy-to-read Web pages. It uses RRDtool as its logging and graphing back-end, making the system very efficient. The presentation of the data on the Web is done through a CGI with some AJAX capabilities for interactive graph exploration.

  • In this article I will show you howto install smokeping on UBUNTU 10/12

First install required components along with smokeping and apache2 (you can remove Apache or any other component if its not required or already installed)
aptitude install smokeping curl libauthen-radius-perl libnet-ldap-perl libnet-dns-perl libio-socket-ssl-perl libnet-telnet-perl libsocket6-perl libio-socket-inet6-perl apache2
Once all is installed, we have to modify few configuration files.
Open following following ...
nano /etc/smokeping/config.d/pathnames
now remove sendmail entry by adding # sign to to comment the sendmail line, usually the first line.
Save and exit.
Now open following file
nano /etc/smokeping/config.d/Targets
Now REMOVE all previous lines , and copy paste following
*** Targets ***  probe = FPing    menu = Top  title = Network Latency Grapher  remark = Welcome to the SmokePing website of <b>ZAIB (Pvt) Ltd.</b> <br> Here you will learn all about the latency of our network.<br><br><br><br><br> This page is maintained by ZAIB. (Pvt) ltd . <br><br>Support Email: aacable@hotmail.com<br>Web: http://aacable.wordpress.com    ### YOU CAN CHANGE THE FOLLOWING ACCORDING TO YOUR NETWORK ###    + Ping    menu = WAN Connectivity  title = WAS Side Network    ++ yahoo    menu = yahoo  title = yahoo ping report  host = yahoo.com    ++ google    menu = google  title = Google ping report  host = google.com    ### YOU CAN CHANGE FOLLOWING ACCORDING TO YOUR NETWORK ###  + Ping2    menu = LAN Connectivity  title = LAN Side Network    ++ Mikrotik    menu = Mikrotik  title = Mikrotik PPP ping report  host = 10.10.0.1    ++ Billing    menu = Billing  title = Radius billing Server ping report  host = 10.0.0.2
save and exit.
now restart smokeping service by
service smokeping restart
and access it via browser.
Results should be something like below image...
lan
wan-report
More info on previous smokeping article based on FEDORA 10 , (Old version) Just for idea

Thursday, June 26, 2014

How to Easily Install Ubuntu

How to Easily Install Ubuntu


Steps to Install Ubuntu was written at the request of some of my best friends.
  • Download the first file ubuntu -desktop-i386.iso 10:10 at www. ubuntu .com/desktop/get- ubuntu / download and CD burning in advance if you want to easily borrow only at CD rental. Should install the 32 bit even though your 64-bit PC to facilitate the installation of the modem and some specific software.
  • Setinglah your computer to boot via CD (for toshiba laptop does not need to go into the bios, just press F12 shortly after power on and select boot from CD / DVD, laptop ASUS laptop press Shift Esc to other brands I've never tried, if difficulty please read the book guide.)
  • Suppose you've been using windows with the partition C, D and E. Clear Drive E to move all the data to drive D. It would be better if the important data stored on a CD or flash first to anticipate the event of data loss.
  • Insert the CD Ubuntu after a while the screen will appear as below, great VGA will be directly detected by Ubuntu
How to Install Ubuntu 10.10 - Ubuntu Loading
  • Not long after the Ubuntu Live CD is ready for use, but if you are going to mengintall click Install Ubuntu
How to Install Ubuntu 10.10 - Select Install Ubuntu
  • If you already have a modem or Wi-Fi is in the area click Download whiles installing updates. To be more faster installation process should the choice be emptied
How to Install Ubuntu 10.10 - Preaparing to Install Ubuntu
  • This is the most important step, if you are in the disk of important data and other OS such as Windows please select Specify partitions manually.
How to Install Ubuntu 10.10 - Allocate Drive Space
  • Then click on the E drive which has been emptied, The screen you may be detected as sda3. You can recognize it by checking first big drive E while still in Windows. then click Delete that will be available freespace as shown below.
How to Install Ubuntu 10.10 - Selecting a Drive Blank
  • The next step to make a swap partition. generally large swap large 2X RAM. Click Add and then type the size of the new partition.
How to Install Ubuntu 10.10 - Creating Swap Partition sda2
  • Creating the root partition by clicking Add and spend just all remaining freespace.
How to Install Ubuntu 10.10 - Create a Partition sda1 root
  • If at any time you feel comfortable using Ubuntu and will use it as the primary OS for various purposes should be separated into multiple drives. The settings on my laptop specially sda1 to / root (containing the system files), sda2 / home (containing user data) and sda3 / opt (containing data mysql) to facilitate the consideration of backups using Ghost.
How to Install Ubuntu 10.10 - Create a Partition sda3 grace
  • Determining the location
How to Install Ubuntu 10.10 - Determining Location
  • Specifies the keyboard layout
How to Install Ubuntu 10.10 - Ubuntu Keyboart Layout
  • Specify a username and password, you should click Log in automatically
How to Install Ubuntu 10.10 - Setting Username, Password and Computer Name
  • After installation is complete you should install wvdial for internet connection in order to install the drivers and other software MP3 but if no modem wifi take it to the area.

Monday, June 23, 2014

Creating Proxy Server Ubuntu

Creating Proxy Server Ubuntu


about proxy servers? Want to create a proxy server? Need not ask the professionals make it, just follow these references as needed later improvasi proxy sure you can walk properly. I do not discuss in-depth about the proxy server, please use other references for better understanding. I suggest you read the introduction squid diwebsite official. In theory, the proxy has the main function caching, filtering and authentication (pembasan leads to this function)

I wrote this documentation when creating a proxy server using Squid in Ubuntu 8.04-based gateway machine with 2 ethernet card is eth0 and eth1 for the internet connection to the local network. Here's how I do.
Making Ubuntu 8.04 Server Proxy with squid
1. Install ubuntu proxy package
root @ geek: ~ # apt-get install squid
Make sure there is no error during the installation process. If not connected to the Internet should use ubuntu cd repository. But remember to test the proxy goes well will still need an internet connection.

2. Configuring squid proxy
- Do not forget to backup orginal proxy configuration file
root @ geek: ~ # cp / etc / squid / squid.conf / etc / squid / squid.conf.orig
- Create a directory proxy swap
root @ geek: ~ # mkdir / data / proxy
- Set Directory Permissions
root @ geek: ~ # chown proxy.proxy-R / data / proxy
chmod 750-R / data / proxy
- The configuration file squid.conf
root @ geek: ~ # vim / etc / squid / squid.conf
http_port 8080
hierarchy_stoplist cgi-bin?
cache_effective_user proxy
cache_effective_group proxy
cache_dir ufs / data / proxy 1000 16 256
access_log / var / log / squid / access.log squid
cache_mgr gue@wevils.com
visible_hostname www.wevils.com
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY
acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
to_localhost acl dst 127.0.0.0 / 8
acl intranet src 192.168.10.0/24
acl blokporno dstdomain "/ etc / squid / block-url.txt"
url_regex blokkeyword acl-i "/ etc / squid / block-keyword.txt"
SSL_ports acl port 443 # https
SSL_ports acl port 563 # sNews
SSL_ports acl port 873 # rsync
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # GSS-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # http multiling
acl Safe_ports port 631 # cups
acl Safe_ports port 873 # rsync
acl Safe_ports port 901 # SWAT
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny! Safe_ports
http_access deny CONNECT! SSL_ports
http_access allow localhost
http_access deny blokporno
http_access deny blokkeyword
http_access allow intranet
http_access deny all
icp_access deny all
refresh_pattern ^ ftp:1440 20% 10080
refresh_pattern ^ gopher: 1440 0% 1440
refresh_pattern-i (/ cgi-bin / | \?) 0 0% 0
refresh_pattern. 0 20% 4320
acl apache rep_header Server ^ Apache
broken_vary_encoding allow apache
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
hosts_file / etc / hosts
coredump_dir / var / spool / squid

Save and exit

- Create a list of sites that are blocked
root @ geek: ~ # vim / etc / squid / block-url.txt
www.yahoo.com
- Create a list of keywords that are blocked
root @ geek: ~ # vim / etc / squid / block-keyword.txt
porn
sex
- Create swap directories
root @ geek: ~ # squid-z
Attention:
- Setting up a proxy on port 8080 where the default proxy port 3128

3. Restarting service squid
root @ geek: ~ # / etc / init.d / squid restart

4. Testing in client
- Change the settings of the browser to use a proxy
Tools ~ Options ~ ~ Tab Advance Network
- Enter the proxy IP address and port to remember 8080
- Testing Browsing
www.yahoo.com
If Appears Error messeges like this means that the proxy is running well.
ERROR
The requested URL could not be retrieved
If you want more convincing check squid proxy logs while browsing on client
root @ geek: ~ # tail-f / var / log / squid / access.log
Note the running processes.

5. Transparent Proxy
Technique is to use a proxy server without the need to setup a proxy server ip and port in every browser on the client, this is because the essence of the word transparent proxy ip address and port are not visible in the browser client. This technique is very easy because the ip forwarding quite a redirect request that leads to the port 80 as the default port currently browsing process occurs. Port 80 is quite redirected to proxy port 8080 then we use that all the connections in the forced past the proxy server machine we make.
- Add transparent settings in squid.conf
http_port 8080 transparent
- Redirect port 80 (webserver) to 8080 (proxy server)
Redirect all requests that lead to port 80 to the proxy port that we created is 8080. We use iptables
root @ geek: ~ # iptables-t nat-A PREROUTING-p tcp - dport 80-j REDIRECT - to-port 8080
Make sure the ip forward on your proxy machine is already active. Make sure the value 1 in the file / proc/sys/net/ipv4/ip_forward. If not should be enabled as it will be useless ..
root @ geek: ~ # echo 1> / proc/sys/net/ipv4/ip_forward

Here are the results of a new rule that I enter
root @ geek: ~ # iptables-t nat-nL
Chain PREROUTING (policy ACCEPT)
the target prot opt source destination
REDIRECT tcp - 0.0.0.0 / 0 0.0.0.0 / 0 tcp dpt: 80 redir ports 8080
- Restart Squid
root @ geek: ~ # / etc / init.d / squid restart
- Testing
If previously in a browser client we still manual setup ipaddress and port it is now with the active proxy transparent proxy need not be bothered to setup one-on-one. Let the network settings in the browser without a proxy or select auto-detect should go well.

Up here a simple proxy functionality that is already well underway caching and filtering functions. So enjoy it ..
May be useful!