- I came across the following poem in a networking book. I don't know whether it is serious or not.But I found it quite informative. :D
- *********************
- I think that I shall never see
- A graph more lovely than a tree.
- A tree whose crucial property
- Is loop-free connectivity.
- A tree which must be sure to span.
- So packets can reach every LAN.
- First the Root must be selected
- By ID it is elected.
- Least cost paths from Root are traced
- In the tree these paths are placed.
- A mesh is made by folks like me
- Then bridges find a spanning tree.
- *********************
Some of my experiences related to Opensources such as Linux, Python programming, Bash Shell Scripting.....
Wednesday, January 19, 2011
SPANNING TREE POEM
Sunday, September 19, 2010
Fixing yum's corrupted database...
Today, I need to update my CentOS servers. So I fire up
#yum -y update
It ends up with error that say "rpm database corrupted"
After googling, I get the way to fix it back.
To Fix The RPM's Corrupted Database
#rm -f /var/lib/rpm/__db*
#rpm --rebuilddb
#yum -y update
I hope that this tip may save someone out there. :)
Wednesday, September 1, 2010
Squid's Caching with Ramdisk on Freebsd
Updating the ports.
#portsnap fetch
#portsnap extract
#portsnap update
Installing Squid
#cd /usr/ports/www/squid31/ && make install clean
I uncheck SQUID_KERB_AUTH, SQUID_LDAP_AUTH, SQUID_NIS_AUTH and SQUID_IPV6 to shorten the compiling time. :)
I check SQUID_DELAY_POOLS. I may need this to limit bandwidth.
Press [ OK ]. It will download the source and start compiling. For other option boxes,just accept the default and hit ENTER. Compiling takes enough time for you to drink coffee, to chat with friends or to do whatever. For my case, I was making Instant Noodle and Coffee.
After installing squid,we need to create Ramdisk before we actually run the squid service.
To create ramdisk, add the following line in /etc/fstab.
"md /var/squid/cache mfs rw,noatime,-s512M 0 0"
Mount the ramdisk and verify it.
#mount -a && mount -l
Now ramdisk is ready and it is time for us set up squid.
I edit the following configuration parameter in /usr/local/etc/squid/squid.conf
"acl localnet src 192.168.0.0/16" to "acl localnet src 192.168.1.0/24"
"http_port 3128" to "http_port 192.168.1.5:3128" => 192.168.1.5 is ip address of my BSD box.
"#cache_dir ufs /var/squid/cache 100 16 256" to "cache_dir ufs /var/squid/cache 500 16 256"
We have created a ramdisk with 512MB. So I assign 500MB for squid cache.
I add the following lines to squid.conf
"visible_hostname freebsd.mydomain.net"
"cache_mem 128 MB"
Add squid to system startup
#echo "squid_enable=\"YES\"" >> /etc/rc.conf
Initialize squid cache
#squid -z
Start squid for the first time
#/usr/local/etc/rc.d/squid onestart
Verify whether it is listening on the right port
#netstat -a | grep 3128
Ok! Now our squid is running happily on FreeBSD. But it will not survive on reboot because cache is kept on ramdisk and will be destroyed upon reboot. So we need to find a way to reinitialize the squid cache before squid daemon starts. Other people may use different and brilliant method.
For me, I just add "/usr/local/sbin/squid -z" right below "unset files local_rc" in /etc/rc file. Finally Squid can survive through reboot.
P.S: I admit that my solution is very lame. If you get any better solutions, please share with me.
#portsnap fetch
#portsnap extract
#portsnap update
Installing Squid
#cd /usr/ports/www/squid31/ && make install clean
I uncheck SQUID_KERB_AUTH, SQUID_LDAP_AUTH, SQUID_NIS_AUTH and SQUID_IPV6 to shorten the compiling time. :)
I check SQUID_DELAY_POOLS. I may need this to limit bandwidth.
Press [ OK ]. It will download the source and start compiling. For other option boxes,just accept the default and hit ENTER. Compiling takes enough time for you to drink coffee, to chat with friends or to do whatever. For my case, I was making Instant Noodle and Coffee.
After installing squid,we need to create Ramdisk before we actually run the squid service.
To create ramdisk, add the following line in /etc/fstab.
"md /var/squid/cache mfs rw,noatime,-s512M 0 0"
Mount the ramdisk and verify it.
#mount -a && mount -l
Now ramdisk is ready and it is time for us set up squid.
I edit the following configuration parameter in /usr/local/etc/squid/squid.conf
"acl localnet src 192.168.0.0/16" to "acl localnet src 192.168.1.0/24"
"http_port 3128" to "http_port 192.168.1.5:3128" => 192.168.1.5 is ip address of my BSD box.
"#cache_dir ufs /var/squid/cache 100 16 256" to "cache_dir ufs /var/squid/cache 500 16 256"
We have created a ramdisk with 512MB. So I assign 500MB for squid cache.
I add the following lines to squid.conf
"visible_hostname freebsd.mydomain.net"
"cache_mem 128 MB"
Add squid to system startup
#echo "squid_enable=\"YES\"" >> /etc/rc.conf
Initialize squid cache
#squid -z
Start squid for the first time
#/usr/local/etc/rc.d/squid onestart
Verify whether it is listening on the right port
#netstat -a | grep 3128
Ok! Now our squid is running happily on FreeBSD. But it will not survive on reboot because cache is kept on ramdisk and will be destroyed upon reboot. So we need to find a way to reinitialize the squid cache before squid daemon starts. Other people may use different and brilliant method.
For me, I just add "/usr/local/sbin/squid -z" right below "unset files local_rc" in /etc/rc file. Finally Squid can survive through reboot.
P.S: I admit that my solution is very lame. If you get any better solutions, please share with me.
Subscribe to:
Posts (Atom)