Tips

How to Access Your Web Server within Your Local Network

If you are hosting a web server at home and using your router’s port forwarding to redirect requests from WAN port to WebServerHost:80, there’s an annoying problem in some routers: you cannot access the web server from inside the network. There are multiple reasons why this might happen.

  1. The router assumes that all traffic from internal hosts to port 80 are for the router admin interface. This is annoying, as you just get to the router’s web admin page. Solution: you can port forward from another port (say 8000) to your WebServer’s port 80. Now, you can access the website with http://my.site.net:8000. You are out of luck, if your router does’t allow port forwarding to a different port (say WAN:8000->WebServerHost80 instead of WAN:80->WebServerHost80).
  2. You have two or more routers with different subnets and the routing is messed up. This is a difficult problem to diagnose and often the router’s admin interfaces are not that amenable to debugging routing problems. I suggest changing your firmware to DD-WRT, if you can.
  3. Port forwarding doesn’t work for incoming traffic from local ports on the router. I think this is probably the most common reason. Without DD-WRT, there’s no easy way to fix this. Solution: One simple way to solve this is to set a hard-coded DNS entry in /etc/hosts (Linux) or c:\WINDOWS\system32\drivers\etc (Windows) as follows.
    192.168.x.x        my.site.net
    

    192.168.x.x is the internal IP address of the WebServerHost

Share

Best Resources to Learn about Linux Kernel Internals

The Source

The best resource is the kernel source.

Books

Obviously, it’s not that easy to dive into thousands of lines of code. I suggest starting with reading the books explaining Linux kernel in general.

  • Understanding Linux Kernel. This is one of the first books to provide in-depth explanations. Vastly improved over multiple editions, the current one is a very good read.
  • Robert Loves’ book. Love is a core developer, who implemented pre-emptive kernel and other features. I haven’t personally read this, but I have seen good reviews of this.
  • If you are specifically looking for networking aspects, this is an excellent book on understanding linux networking internals.
  • For device drivers, similarly, this book is very useful.

Other resources

  • LWN’s kernel page has lots of great articles explaining kernel internals
  • TLDP’s TLK. Somewhat outdated, but useful.
  • Linux Journal’s KernelKorner has some excellent articles, most of which are freely available online.
  • The Linux Kernel Hackers’ Guide, compiled by Michael K. Johnson of Red Hat fame. Includes among other
    documents selected Q/A’s from the linux-kernel mailing list.

HOWTOs

Lists of links

Share
img5

How to Convert PowerPoint Images to PDF

I am doing this a lot more often these days, want to convert the pretty images I created with PowerPoint into PDF, so that they are more amenable to Latex/PdfLatex. For fun, I prepared an illustrated HOWTO. Here you go, should be easy to follow.

Let’s say you have a slide with following picture.

Presentation slide with an image

First, you want to save the slide as PDF.

Don’t save it yet. Choose options to make sure that you are selecting only one slide.

As soon as you save it, Adobe Acrobat will open it. You may want to remove all the extra white space around it. To crop the image, you will need the Acrobat Writer (Reader is not enough to do the following task). Choose the crop tool, as shown below.

Choose the region you want to crop, and double click inside the region. You will see a dialog similar to the one shown below.

Press ok, and you are done.

Have fun!

P.S. On Mac, you don’t have any hassle. Just select the region you want to put in image. Right click and save as picture (choose PDF as the file format).

Share

Linux tips: mounting a disk image with multiple partitions

It’s been a while since I found a neat trick that I really wasn’t aware of :-) Usually, I am aware of the trick, but just don’t remember the exact details. But, this one is a gem.

How do you mount a disk image with multiple partitions? If an image contains a single partition, we can simply use a command like the following.

mount -o loop image_file /mnt

This will not work if the image_file is a complete disk image containing multiple partitions. I found a neat trick here that explains how to do it. The idea is to get the partition offset and then mount it as follows.

mount -o loop,offset=some_number image_file /mnt

The offset can be found by running fdisk -ul image_file. Detailed information is available here. Enjoy!

Share