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.
Monday, April 20, 2009
Configure Linux/Fedora as a Router | Enable Packet Forwarding in Linux/Fedora
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".