Thursday, 9 October 2014

DHCP3-Server Installation and Configuration in Ubuntu 12.04LTS..............

1:-Set a static IP address in Ubuntu 12.04

It is not intuitively obvious how to assign Ubuntu 12.04 LTS a a static IP address from the command line. However, much of Linux administration involves the editing of text files, and assigning a static IP address is no different. You’ll need to edit the following file:

/etc/network/interfaces


Initially, the file only contains information about your local loopback address:

auto lo
iface lo inet loopback



To assign a static IP address, you’ll need to make some changes to this file.
Let’s say you want to assign a static IP of 192.168.0.2 to your eth1 network connection (the first Ethernet adapter on your system; if you only have one, it will be eth0), with a subnet mask of 255.255.255.0 and a local gateway of 192.168.0.1. First, make a backup copy of the interfaces file:


sudo cp /etc/network/interfaces ~


This will make a backup copy in your home directory in case something goes amiss during the editing process. Next, fire up a text editor:

sudo vi /etc/network/interfaces






iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
gateway 192.168.0.1


You’ll then to need have your system load the new IP configuration. You can do that by rebooting, but if that takes too long, you can use this command to force Ubuntu to re-read the configuration files:


sudo ifup eth0


Your system will then have a static IP address.

 2:-Installation and Configuration of DHCP3-Server

First, go to a Terminal window and install the DHCP server software, dhcp3-server:
  apt-get install dhcp3-server

once we have your static IP, you’ll need to edit DHCP’s main configuration file, which is /etc/dhcp3/dhcpd.conf. First make a backup copy of the file to your home folder, in case something goes wrong:

 cp /etc/dhcp3/dhcpd.conf ~

Then begin editing dhcpd.conf:

gedit /etc/dhcp3/dhcpd.conf

Could not reliably determine the server's fully qualified domain name?


ubuntu 12.04 and older

This is just a friendly warning and not really a problem (as in that something does not work).
If you insert a
ServerName localhost   
in either httpd.conf or apache2.conf in /etc/apache2 and restart apache the notice will disappear.
If you have a name inside /etc/hostname you can also use that name instead of localhost.

And it uses 127.0.1.1 if it is inside your /etc/hosts:
127.0.0.1 localhost
127.0.1.1 myhostname
Preferred method
Troubleshooting Apache
If you get this error:
apache2: Could not determine the server's fully qualified domain name, 
using 127.0.0.1 for ServerName
then use a text editor such as "sudo nano" at the command line or "gksudo gedit" on the desktop to create a new file,
sudo nano /etc/apache2/conf.d/fqdn
or
gksu "gedit /etc/apache2/conf.d/fqdn"
then add
ServerName localhost
to the file and save. This can all be done in a single command with the following:
 echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn
But on Ubuntu 14.04:
 echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf
 sudo ln -s /etc/apache2/conf-available/fqdn.conf /etc/apache2/conf-enabled/fqdn.conf
Don't forget the ".conf" (without will not work).

Wednesday, 3 September 2014

Dual WAN PCC Load Balancing,DNS,Hotspot with failover in Mikrotik


Setup Squid Proxy Server Ubuntu 14.04 LTS + Mikrotik Router OS

Setup Squid Proxy Server + Mikrotik 


Download Ubuntu Server 14.04 LTS 32bit/64Bit
http://www.ubuntu.com/download/server

Connect to internet and download the squid application
sudo apt-get install squid3

Backup copy of the original squid configuration file.
sudo cp -p /etc/squid3/squid.conf /etc/squid3/squid.conf.ori

use vi to edit squid.conf
sudo vi /etc/squid3/squid.conf

To block websites

acl block_websites dstdomain .msn.com .yaho.com
http_access deny block_websites

View the log
sudo tail -f /var/log/squid3/access.log

After you've finished editing the configuration file, you can start Squid for the first time. First, you must create the swap directories. Do this by running Squid with the -z option:

sudo /etc/init.d/squid3 stop
sudo mkdir /squid_cache
sudo chown -R proxy:proxy /squid_cache


sudo squid3 -z

sudo /etc/init.d/squid3 start



Once that completes, you can start Squid and try it out. Probably the best thing to do is run it from your terminal and watch the debugging output. Use this command:

sudo squid3 -NCd1

If everything is working fine, then your console displays: "Ready to serve requests".
Squid service command
sudo service squid3 stop,status,start,restart
sudo pkill -9 squid
Mikrotik firewall rule

/ip firewall nat add action=dst-nat chain=dstnat disabled=no dst-port=80 in-interface=ether2-local-master protocol=tcp to-addresses=192.168.3.100 to-ports=3128


HTTPS Part 1


 https_port 3128 transparent key=/etc/squid3/ssl/squid3.key cert=/etc/squid3/ssl/squid3.crt

sudo mkdir /etc/squid3/ssl
cd /etc/squid3/ssl/
sudo openssl genrsa -des3 -out squid3.key 1024
sudo openssl req -new -key squid3.key -out squid3.csr
sudo cp -p squid3.key squid3.key.org
sudo openssl rsa -in squid3.key.org -out squid3.key
sudo openssl x509 -req -days 365 -in squid3.csr -signkey squid3.key -out squid3.crt

HTTPS Part 2


openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 -keyout myCA.pem  -out myCA.pem
openssl x509 -in myCA.pem -outform DER -out myCA.der

 To use the Malware Block List on a Squid proxy to block user access to URLs that contain Malware you need to perform the following simple steps:



 Download the block list:



      wget -O - http://malware.hiperlinks.com.br/cgi/submit?action=list_squid > malware_block_list.txt



Create an ACL in the main (squid.conf) pointing to a file which will have the list URLs:



      acl malware_block_list url_regex -i "/etc/squid/malware_block_list.txt"



Enable the ACL created previously:



      http_access deny malware_block_list
      deny_info http://malware.hiperlinks.com.br/denied.shtml malware_block_list



Force Squid reconfiguration:



      squid -k reconfigure
Thats It have a nice day

Sunday, 31 August 2014

Lusca, Squid web Proxy under Windows along-side Mikrotik with single LAN

بسم اللہ الرحمن الرحیم 

Salam to everyone,  
                   First I give Thanks to known people of I.T workers Like Adeel Kamal of (wifi-tech.com.pk) and Syed Jahanzaib who realy did a great contribution in I.T over Bloging.........Thanks Guys 
                  

                    Here is my first blog about Web-Caching a.k.a Proxy Server
mostly proxy servers designed in Linux environment based O.S like Ubuntu, Fedora Opensuse which are considered Best in Network Tech and Free. But it seem to be hard to understand them .But with little effort you can understand and learn them from various sources like Googling and bloging..But I feel some of our Friends are not similar to work with Linux. So I decided to do alternative like in Windows Environment but with the Help of  Adeel, Syed Jahanzaib and specialy ComStuff.Net for Lusca for windows Script and Program