I had to do a find and replace a string on all of the wordpress post. This can only be done via a MySQL query and won’t take more than a minute.

This is how it’s done. In the following example, I will be finding X and replacing it with Y

The string will find X in every single post and replace it with Y. This also works with phrases, URLs etc..

update wp_posts set post_content = replace(post_content, 'X', 'Y')

{ 0 comments }

There are many free TFTP server sortware out there, just install one.

First of all, make sure you have IP reachablity to the TFTP Server. You can do that via Ping…

Then check whether TCP port 69 is open. Usually it is not the case, but when it comes to troubleshooting, it is the first thing to check after a succesful Ping test.

Jump onto the router you are going to do the IOS upgrade.

Make sure the IOS you are going to replace it with is compatible with your router & also you have the necessary Flash / RAM.

If your Flash is big enough to have more than two IOS images, then you can straight away go and download it from the TFTP Server.

If you are going to have two IOS images in flash, you need to specify the router which image to load on boot. It can be done via the following command…

[click to continue…]

{ 0 comments }

If I ask that question to a number of people, I have a feeling I would get all sorts of answers. I think, Hard Disk reliability doesn’t necessarily depends on the manufacturer but it also depends on how it has been treated in a machine. In my opinion, a HDD in a machine with multiple power cuts would most likely have a short lifespan than one run with proper care.

Lets talk about the Manufacturer…

People have preference when it comes to HDD Manufacturer. When it comes to the manufacturer, I tend to go for Western Digital (WD) and solely because I had less bad experience with it compared to Maxtor…

I am not saying WD drives never fails, in fact I do have an old WD 80GB IDE drive here which died this morning; but it does have low percentage of failure.

Why does it die?

One person actually asked me this question and the answer is very simple. Any electronic equipment, or any functioning part will die at one point, its the same as human body, it all depends on how its been treated the background of it. When it comes to HDD, its the manufacturer.

How to stop a HDD from dying?

You can’t and you never know when it’s going to die, same as a human being… You never know when you are going to die. It all comes down to to proper care and how its been treated. For example, do not shut your machine down by pulling the plug, it WILL kill the HDD at one point! If you want to shut it down without doing it via the Operating System, press and hold the Power Button for 10 seconds and it should shut the machine down.

Conclusion

Treat a HDD like it is going to die the next minute and back it up on a regular basis. If you don’t have any important information on the disk, then it not a problem. You could either manually back it up on another drive, setup RAID on machine or even back it up to a remote server.

{ 1 comment }

This is how to add a DNS Server to Solaris Box…

First of all, Open up your favourite text editor and add the name servers into /etc/resolv.conf

nameserver 192.168.1.1

If you need to add more, just add another one in the next line…

Following the instructions below will walk you through the process…

bash-3.00# ping www.google.com
ping: unknown host www.google.com
bash-3.00# cat /etc/resolv.conf
nameserver 192.168.1.1
bash-3.00# cd /etc/
bash-3.00# cp -p nsswitch.conf nsswitch.conf.org
bash-3.00# cp -p nsswitch.dns nsswitch.conf
bash-3.00# /etc/init.d/nscd stop; /etc/init.d/nscd start
bash-3.00# ping www.google.com
www.google.com is alive
bash-3.00#

As you can see, the Name Server is working!

{ 0 comments }

Adding IP address and default gateway is rather straight forward as long as the interface is loaded. To see whether the interface is loaded, issue the command ifconfig –a

You should see something like the following…

bash-3.00# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
rtls0: flags=1000842<BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
inet 0.0.0.0 netmask 0
ether 0:6:4f:47:76:1e

In this case, we will be adding the IP address and subnet mask to rtls0 along with the default gateway.

IP Address: 192.168.1.60
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.1

Here is how its done…

bash-3.00# ifconfig rtls0 192.168.1.60 netmask 255.255.255.0 up
bash-3.00# route add default 192.168.1.1
add net default: gateway 192.168.1.1
bash-3.00# ping 4.2.2.2
4.2.2.2 is alive

Success! We can now ping a WAN IP! and here is the new output of ifconfig -a

bash-3.00# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv 4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
rtls0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
inet 192.168.1.60 netmask ffffff00 broadcast 192.168.1.255
ether 0:6:4f:47:76:1e

{ 0 comments }

When a Name Server looks up a domain for the IP address, it stores the information into the cache so it doesn’t have to look it up every single time a request is made. For example, if someone looks for www.nishv.com the DNS server will look up the domain and stores the IP address 72.52.178.35 into the cache for a given time so it doesn’t have to look up that domain again for a given period of time.

DNS cache poisoning (also known as DNS cache pollution) is a maliciously created or unintended situation that provides data to a DNS Server that did not originate from authoritative DNS sources.

It happens when an attacker sends malicious data in response to a DNS query. For example, DNS query for www.nishv.com can be redirected to another website.

This method is taking the phishing scam to another level, you might be visiting your bank’s website but without you realising it, you will actually be putting in all the login information into some hackers servers which made it look exactly like the bank’s website. Yes, this is very serious!

How do you patch it?

On the client side (we are talking about Microsoft Windows here), your machines should have been patches automatically if you set the Auto-Update option. If not, I recommend you check the available updates and patch it as soon as possible.

If you use a DNS Server, my recommendation is to use the following command to figure out whether it has been patched or not. If it is not, STOP using it and have a look at this post on OpenDNS for more info.

Use the following DIG command on UNIX

dig +short @{name-server-ip} porttest.dns-oarc.net txt
dig +short @ns1.example.com porttest.dns-oarc.net txt
dig +short @208.67.222.222 porttest.dns-oarc.net txt

and you should get a result similar to this…

nishv@nishv.com [~]# dig +short @208.67.222.222 porttest.dns-oarc.net txt
porttest.y.x.w.v.u.t.s.r.q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a.pt.dns-oarc.net.
"208.67.217.8 is GREAT: 26 queries in 2.1 seconds from 26 ports with std dev 20119"

Or something like this…

nishv@nishv.com [~]# dig +short @4.2.2.2 porttest.dns-oarc.net txt
porttest.y.x.w.v.u.t.s.r.q.p.o.n.m.l.k.j.i.h.g.f.e.d.c.b.a.pt.dns-oarc.net.
"209.244.4.25 is GOOD: 26 queries in 1.9 seconds from 26 ports with std dev 3880"

If you don’t get GREAT or GOOD and gets something like POOR, you should immediately stop using it.

If you manage that DNS server, patch it or decommission it!

This is how to check on Windows

Open up command prompt by going Start –> Run –> CMD or on Vista typing CMD on the Start Search box

nslookup -type=txt -timeout=30 porttest.dns-oarc.net
nslookup -type=txt -timeout=30 porttest.dns-oarc.net ns1.your-isp.com
nslookup -type=txt -timeout=30 porttest.dns-oarc.net NS-SERVER-IP

You must see the GREAT or GOOD, if not your DNS Server is compromised.

 

{ 0 comments }