iptables can use a range of IP address.
I have tested with iptables version 1.3.7 with Linux Kernel version 2.6.21-7.
Range specification depends on "iprange" module of iptables.
To specify a range of source IP address with iptables, use the following syntax,
# iptables -A INPUT -p tcp -m iprange --src-range 192.168.2.2-192.168.2.50 -j ACCEPT
To specify a range of destinationIP address with iptables, use the following syntax,
# iptables -A INPUT -p tcp -m iprange --dst-range 192.168.2.51-192.168.2.100 -j DROP
Tuesday, June 2, 2009
ip range with ipables | specify source ip range in iptables | specify destination ip range in iptables
Saturday, May 16, 2009
What is SELinux
History: SELinux was originally a development project from the National Security Agency (NSA) more..
Security-enhanced Linux (SELinux) is an implementation of a mandatory access control mechanism. This mechanism is in the Linux kernel, checking for allowed operations after standard Linux discretionary access controls are checked. more.....
SELinux Architecture: more....
Enable or Disable SELinux on Linux/Fedora
In Fedora Core and RedHat Enterprise Linux one can Permanently Disable of Enable SELinux.
Edit the file /etc/selinux/config
then set: SELINUX=disabled
and then reboot the system!!
Monday, April 20, 2009
Configure Linux/Fedora as a Router | Enable Packet Forwarding in Linux/Fedora
Configuring a Linux Box as a Router is a easy task.
Step1: Set net.ipv4.ip_forward = 1 in the file /etc/sysctl.conf
Step2: Restart Network Service, command: service network restart
Note: If you do not want to Restart Network Service, use the following command to enable
packet forwarding: echo "1" > /proc/sys/net/ipv4/ip_forward
Step3: Add the static routes to different subnets, hosts etc. using the command: route add .....
Note: This will work if, the firewall don't block the packets from one sub-net to another.
Enable NAT on Linux|Configure NAT on Linux
NAT enabling is suitable when a Linux Box works as a router.
Assuming that, the Linux box has two network interface with the following parameters.
eth0: IP Address 192.168.10.1/24, connected with Local LAN.
eth1: IP Address 203.200.160.226/29, connected with WAN, Gateway: 203.200.160.225/29
To enable NAT for the Local Private LAN, iptables can be used.
Command is: iptables -A POSTRUTING -t nat -s 192.168.10.0/24 -o eth1 -j MASQUERADE
Note: This will work if,
1) the Linux Box is already configured to work as router.
2) the firewall don't block the packets from Private LAN to WAN.
Monday, March 9, 2009
overflow in var file system | clean squid log files and squid cache
/var file system can overflow for the following reason:
# Are you using squid?
If so,
1. clean squid cache using the command : rm –rf /var/spool/squid/*
2. clean squid access log using the command : rm –rf /var/log/squid/*
Before cleaning, stop squid service using the command: service squid stop
OR killall -9 squid
Then start squid service using the command: service squid start
Tuesday, February 24, 2009
download rpm using yum, but do not install, --downloadonly doesn't download,
Yum can be used to download(only) suitable rpm and its dependencies.
Yum downloadonly plugin is required to download rpms without installing them.
First, install downloadonly plugins using the command:
# yum install yum-downloadonly
Now you can download any rpm without installing. For example to download tomcat5-webapps & its all dependencies in current directory ( . ), I have used the following command:
#yum install --downloadonly --downloaddir . tomcat5-admin-webapps tomcat5-webapps
Monday, February 23, 2009
connect yum using proxy, yum cannot connect through proxy
Yum can connect with external repository if http_proxy , ftp_proxy environment variables are set properly.
Set the environment variables (from command line):
# http_proxy="http://192.168.1.1:3128"
# ftp_proxy="http://192.168.1.1:3128"
/* if PROXY host is http://192.168.1.1/ & PROT is 3128 */
Export the variable (from command line):
# export http_proxyexport ftp_proxy
Test yum & reply me.
Thursday, January 29, 2009
speed up moodle, Apache performance with PHP memory limit, PHP accelerator, TMPFS filesystem
1. PHP performance is better when installed as an Apache module (rather than a CGI) in Fedora/Linux.
2. Check the memory_limit in php.ini,
For Moodle 1.7 or later, the value of memory_limit should be > 40M.
3. Use a PHP accelerator to ease CPU load, such as PHPA, Xcache or eAccelerator.
4. Read/Write performance can be improved by putting the cached PHP pages on a TMPFS filesystem.
Note: The cache contents will vanished when there is a power failure or if the server reboots.
speed up moodle performance with MySQL query cache
MySQL performance
The following are the MySQL settings which can be adjusted for better performance in my.cnf (my.ini in Windows). The file contains a list of settings and their values.
1. Enable the query cache with query_cache_type = 1
2. Set query cache size with query_cache_size = 36M
3. and query_cache_min_res_unit = 2K
4. Set table cache with table_cache = 512 (from moodle 1.7 or higher)
Note: Please make backups of your database before changing any MySQL server configuration.
After the changes to the my.cnf,restart mysql server using the command "service mysqld restart".
faster performance in apache, httpd, enable disk cache
To enable a disk cache, edit the following section in httpd.conf.
##########################
CacheEnable disk /
CacheRoot "/var/www/dir_name"
CacheDefaultExpire 3600
#########################
Where "dir_name" is the directory to be cached.
Friday, August 29, 2008
How to backup entire moodle site
Plz see the YouTube Video ---
MAC Address Filtering with iptables
Plz follow the post below----
http://adminwithlinux.blogspot.com/2008/08/packet-filtering-using-mac-address-in.html
Packet filtering using MAC address in Linux iptables
A host can be blocked by its MAC address.
Linux "iptables" with mac modules loaded.
A simple configuration is given below ----
iptables -A INPUT -m mac --mac-source 00:17:31:D0:76:9C -j DROP
This will block any request fro the MAC address 00:17:31:D0:76:9C.
Friday, August 1, 2008
Automatic timeout from Linux Shell after some second of inactivity
Yes this can be done using TMOUT variable in /etc/profile file.
Add the following lines at the end of the file.
TMOUT=600
export TMOUT
This will automatically logout the opened session after 10min (10*60=600sec).
Use SARG with Apache on Fedora to Analysis Squid access log from a remote location
SARG is a powerful tool to analyse and to generator report from Squid access log.
Report can be generated in HTML format and it can be viewed from an Apache Web server easily.
To install sarg use the command "yum install sarg"
To use sarg, the command is sarg. Configuration file is "/etc/sarg/sarg.conf".
See the man pages of sarg for varoius options.
Once the report has been generated, I can place the report file(s) on Apache DocumentRoot.
Then can view it from a remote location.
Can not connect to Vncserver on Fedora 7 from Windows
On Fedora Server check whether vnc-server has been installed or not, using the command: rpm -qagrep "vnc"
If not, install it. Installation command "yum install vnc-server".
Not start vncserver. Command: vncserver
Try to connect from windows. Command: vncviewer IP_ADDRESS:1
If fails, check your Firewall settings. The port 5901 must be unblocked.
Configure Firewall using iptables to unblock the port 5901.
This will solve the problem.
Friday, July 25, 2008
merge all CD ISO images into one DVD ISO image
1. Mount each cd in turn.
If you just have the iso image you can mount it as a loopback filesystem:
mount -o loop -t iso9660
2. Copy all of the files to your hard drive.
3. Use mkisofs to create a new ISO image
mkisofs -o dvd_iso_image.iso /path/to/files
Monday, June 30, 2008
Install Fedora Live Image to USB Flash Drive
Installing Fedora Live Image to USB Flash Drive is now easy.
Please follow the tutorials from the link below.
http://fedoraproject.org/wiki/FedoraLiveCD/USBHowTo
Monday, June 23, 2008
USB device identification using Linux/Fedora
USB device identification using Linux/Fedora.
A device has a Vendor ID (VID) & a Product ID (PID).
To check,
use the command "tail -f /var/log/messages"
This will show the last 10 lines of this file.
Now plug the USB device to any usb port.
Wait & see the changes on the conmmand screen.
Now press Ctrl+C
Then,use the command "lsusb" to get the BUS ID & Device ID (VID & PID)
.
My Pen Drive has the following info,
# lsusb
Bus 005 Device 008: ID 0457:0151 Silicon Integrated Systems Corp. Super Flash 1GB Flash Drive
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Which tells VID =0457 & PID = 0151
Visit http://www.linux-usb.org/usb.ids to get updated list of supported USB devices with IDs.