Thursday, 13 March 2008

Adding routes automaticly when booting

If you add a static route for your network you have probably noticed that it disappears when you reboot. This can get annoying as you need to re-add it every time.

To have the route added by default every time you boot add the route to the file /etc/sysconfig/network/routes in the form:
Destination    Gateway    Netmask   Device
So if you want all traffic to the subnet 192.168.2.0 to go through gateway 192.168.1.1 you would use:
192.168.2.0    192.168.1.1   255.255.255.0
Note that device isn't required. If you omit it route will try and figure out the device by your Ethernet device’s settings.

If you want to set a default gateway use the destination of 0.0.0.0

Friday, 7 March 2008

Firefox wont open

After Firefox crashes or you don’t close your browser down properly it may refuse to open again claiming it is already open with a message along the lines of:
Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system
This can be frustrating after you reboot and still have the same message.

The problem is that as Firefox didn't close properly it didn't have chance to delete its lock files. Lock files are just basic text files that programs create when they are launched. When they are closed they delete these files. This is done as when you launch the application, in this case Firefox, it will check to see if that lock file exists. If it does it knows the program is already open and will give you a message like the one above.

To solve this problem all you need to manually delete the lock files. These are located in
~/.mozilla/firefox/
In this directory you will see a subdirectory starting with a made up series of letters and digits and ending in .default. Mine is called f1ps0jiv.default. Go into this directory and delete the files .parentlock and lock.

Note the period before parentlock. This means the file is hidden, so you might not be able to see it right away. If you are using your console to delete the file then just type:
rm .parentlock
If you are using a file browser such as Dolphin you will need to select View -> Show Hidden Files to see them

Wednesday, 5 March 2008

dhcpd error

Recently I had to set up a DHCP server. I installed dchp, configured it and ran it using the command:
dhcpd

This ran successfully and assigned IP addresses as expected. However, when I tried to start the service on boot up I got the error message:
root@computer:~>service dhcpd start
Starting DHCP server … cannot… DHCPD_INTERFACE in /etc/sysconfig/dskipped empty!
This was due to the computer having 2 network cards and dhcpd not knowing which interface to listen on for DHCP requests.

To solve this problem I had to edit /etc/sysconfig/dhcpd and modify the line:

DHCPD_INTERFACE=""

to point to the Ethernet device you want to use (generally eth0 or eth1). Once I set this to eth0 the DHCP server started on boot up and ran successfully
DHCPD_INTERFACE="eth0"