How to push routes to dhcp clients using ISC dhcp server

No Comments

In dhcpd.conf:

# defines the type of data used to send the routing informations
option classless-routes code 121 = array of unsigned integer 8;

# defines 2 gateways for 2 subnets:
# 192.168.100.0/24, gateway 192.168.1.2
# and 10.4.0.0/24, gateway 192.168.1.2
option classless-routes 24, 192,168,100, 192,168,1,2,
                        24, 10,4,0, 192,168,1,2;

dhclient on Debian/Ubuntu is able to handle the data out of the box.

To make the configuration work on Windows clients, duplicate the configuration with code 249:

option classless-routes code 121 = array of unsigned integer 8;
option classless-routes 24, 192,168,100, 192,168,1,2,
                        24, 10,4,0, 192,168,1,2;
option classless-routes-win code 249 = array of unsigned integer 8;
option classless-routes-win 24, 192,168,100, 192,168,1,2,
                            24, 10,4,0, 192,168,1,2;

How to remove executable bit recursively from files (not directories)

No Comments

When I plug-in an USB stick (FAT) into my Centos Linux machine, all files have the executable bits set. After having copied the directory structure to my hard disk I remove the executable bits recursively just from the files and keep those on the directories with following command:

chmod -R -x+X *

Explanation:

  • -R – operate recursively
  • -x – remove executable flags for all users
  • +X – set executable flags for all users if it is a directory

Find files modified in the last week.

No Comments

Change ./ to the root directory you wish to search in. Change -7 to +7 for files changed more than a week ago.

  1. find ./ -mtime -7 -print

-mtime n[smhdw]

             If no units are specified, this primary evaluates to true if the difference between the file last modification time and the time find was started, rounded up to the next full 24-hour period, is n 24-hour periods.

             If units are specified, this primary evaluates to true if the difference between the file last modification time and the time find was started is exactly n units.

             Please refer to the -atime primary description for information on supported time units.

   -atime n[smhdw]

             If no units are specified, this primary evaluates to true if the difference between the file last access time and the time find was started, rounded up to the nextfull 24-hour period, is n 24-hour periods.

             If units are specified, this primary evaluates to true if the difference between the file last access time and the time find was started is exactly n units.  Possible time units are as follows:

             s       second

             m       minute (60 seconds)

             h       hour (60 minutes)

             d       day (24 hours)

             w       week (7 days)

             Any number of units may be combined in one -atime argument, for example, “-atime -1h30m”.  Units are probably only useful when used in conjunction with the + or   modifier.

Older Entries