Step1: Type the C/C++ source code using any text editor of your choice,
and save it with the extension .c for C programs and .cpp for C++ programs.
[linux c/cpp compiler, gcc, uses the extension of the source file to recognize the coding language].
Step2:To compile , assuming the source file name to be input_filename, type in the following command at the command prompt;
[root@localhost ~]# gcc -o output_filename input_filename
Note:- there is no space between -o and output_filename
Step3: To run the output file, type in the following command at the command prompt:
[root@localhost ~]# ./output_filename
END of Steps
--------------------------------
For example, to compile a source file named mysource.c, to produce an outputfile named myout, and to execute it, we can use the following steps:
[root@localhost ~]# gcc -o myout mysource.c
[root@localhost ~]# ./myout
.........................................................
Wednesday, September 24, 2008
Monday, September 22, 2008
How to ckeck the squid logs in real time:-
[root@localhost ~]#tail -f /var/log/squid/access.log
Note:-
tail - output the last part of file
-f - follow (output appented as the file grows)
How to Block Web sites using Squid..
Step1:-Open the /etc/squid/squid.conf file in any text editor ,preferably vim as shown below.
[root@localhost ~]#vim /etc/squid/squid.conf
Step2:-Search for the following set of lines to the script:
#Recommended minimum configuration:
………
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl internet src 192.168.1.0/255.255.255.0
Step3:-Now, add the following end of these lines to block the sites using acl (acl aclmame dstdomain "filename.squid")
acl badurl dstdomain “/etc/squid/bad-sites.squid”
........
........
Step4:-Search again for the following set of lines to the script:
#Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager
Step4:- Now, add the following end of these lines to deny the particular aclname using http_access (http_access deny aclname)
http_access deny badurl
:wq!
Step5:- Then create a new file /etc/squid/bad-sites.squid. Then enter the block web sites using following format.
[root@localhost ~]#vim /etc/squid/bad-sites.squid
…
.orkut.com
.youtube.com
:wq!
Step3:-Restart the squid service
[root@localhost ~]#service squid restart
[root@localhost ~]#chkconfig squid on
[root@localhost ~]#vim /etc/squid/squid.conf
Step2:-Search for the following set of lines to the script:
#Recommended minimum configuration:
………
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
acl internet src 192.168.1.0/255.255.255.0
Step3:-Now, add the following end of these lines to block the sites using acl (acl aclmame dstdomain "filename.squid")
acl badurl dstdomain “/etc/squid/bad-sites.squid”
........
........
Step4:-Search again for the following set of lines to the script:
#Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager
Step4:- Now, add the following end of these lines to deny the particular aclname using http_access (http_access deny aclname)
http_access deny badurl
:wq!
Step5:- Then create a new file /etc/squid/bad-sites.squid. Then enter the block web sites using following format.
[root@localhost ~]#vim /etc/squid/bad-sites.squid
…
.orkut.com
.youtube.com
:wq!
Step3:-Restart the squid service
[root@localhost ~]#service squid restart
[root@localhost ~]#chkconfig squid on
Sunday, September 21, 2008
How to share internet using proxy Server
Step1: open the squid.conf file in any text editor ,preferably vim as shown below.
[root@localhost ~]#vim /etc/squid/squid.conf
Step2:Search for the following set of lines to the script:
.........
#Recommended minimum configuration:
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
Step3: Now, add the following end of these lines to share the internet using acl,(acl aclname src xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy).
acl internet src 192.168.1.0/255.255.255.0
…
…
# And finally deny all other access to this proxy
http_access allow localhost
step4: Now, add the following end of these lines to allow the acl name (httpd_access allow aclname)
http_access allow internet
http_access deny all
...
Notes: -
internet -> acl name
src -> to specify source address
192.168.1.0/255.255.255.0 -> network address (or use ip address)
[root@localhost ~]#service squid restart //restart the service
[root@localhost ~]# chkconfig squid on // permanently ON the service
To configure firefox (Mozilla) using proxy server:-
Step1: open the firefox(Mozilla)
Step2:Edit->Preferences->General->Connection Settings
[root@localhost ~]#vim /etc/squid/squid.conf
Step2:Search for the following set of lines to the script:
.........
#Recommended minimum configuration:
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl to_localhost dst 127.0.0.0/8
Step3: Now, add the following end of these lines to share the internet using acl,(acl aclname src xxx.xxx.xxx.xxx/yyy.yyy.yyy.yyy).
acl internet src 192.168.1.0/255.255.255.0
…
…
# And finally deny all other access to this proxy
http_access allow localhost
step4: Now, add the following end of these lines to allow the acl name (httpd_access allow aclname)
http_access allow internet
http_access deny all
...
Notes: -
internet -> acl name
src -> to specify source address
192.168.1.0/255.255.255.0 -> network address (or use ip address)
[root@localhost ~]#service squid restart //restart the service
[root@localhost ~]# chkconfig squid on // permanently ON the service
To configure firefox (Mozilla) using proxy server:-
Step1: open the firefox(Mozilla)
Step2:Edit->Preferences->General->Connection Settings
Step3: Ok.
Note:-
192.168.1.254 ->proxy server ip address
3128 -> default port no.
Step4: Restart the Service….
Saturday, September 20, 2008
Squid Proxy Server on Linux (RHEL5)..
Purpose : Web caching, bandwidth management, URL surf control etc..
Proxy Server :squid
Package name : squid-2.6.STABLE6-3.el5
Service : squid
Configuration file : /etc/squid/squid.conf
Port no : 3128 / 8080 Tcp
Log files : /var/log/squid/access.log
Service Type : Standalone
Dependency : Network Service
Subscribe to:
Posts (Atom)