Setting up a DHCP server on Ubuntu Hardy Heron July 1st, 2009
This is my really short installation log of how I installed and configured a DHCP server on Ubuntu Hardy Heron.
1: Make sure that the latest version is installed:
sudo apt-get install dhcp3-server
Note: Don’t be alarmed if the startup fails; that’s because you haven’t configured it yet.
2.1: Edit the DHCP server configuration:
sudo nano /etc/dhcp3/dhcpd.conf
2.2: The contents of my configuration file, for me the comments already in the file was what I needed to make the necessary changes:
# The ddns-updates-style parameter controls whether
# or not the server will
# attempt to do a DNS update when a lease is confirmed.
# We default to the
# behavior of the version 2 packages
# ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none;
# option definitions common to all supported networks...
option domain-name "home.lan";
option domain-name-servers ubuntu.home.lan;
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# This is a very basic subnet declaration.
subnet 10.10.10.0 netmask 255.255.255.0 {
range 10.10.10.100 10.10.10.200;
option routers router.home.lan;
}
3: Start the DHCP server (it should now start without problems):
sudo /etc/init.d/dhcp3-server start
Done ![]()
Thanks to Author, source http://lani78.wordpress.com/2008/08/10/
setting-up-a-dhcp-server-on-ubuntu-hardy-heron/
How To Set Up Linux As A Dial-In Server July 1st, 2009
Author: Sohail Riaz
1 Overview
This document describes how to attach modems to a Linux box and allow it to receive calls to connect users to the network. Its like being your own ISP (Internet Service Provider). If your Linux box is connected to the Internet, then the users will also be connected to the Internet. Your Linux box becomes a router. This is also known as RAS (Remote Access Services) in the Microsoft world. In the Linux world its called PPP (Point to Point Protocol).
2 Attach A Modem
Attach a modem to COM 1 or COM 2. If you have an internal modem, you need to know what COM port it is. You could just activate all the COM ports and see later which one works by viewing the /var/log/messages file. Then turn off the other 3.
3 Run kudzu
Kudzu is the Linux hardware auto detection that usually runs at boot time. You may reboot the computer or else just type:
kudzu
Hopefully, kudzu will detect your modem and configure it automatically.
4 Configure Modem For mgetty
Mgetty is the program that allows you to login after the modems connect. It is activated in the /etc/inittab file. Use vi to add a line after the mingetty lines (halfway into the file).
Physical Port Linux Port /etc/inittab line for turning on mgetty
COM 1 ttyS0
COM 2 ttyS1
COM 3 ttyS2
COM 4 ttyS3
vi /etc/inittab
S0:2345:respawn:/sbin/mgetty -D ttyS0
S1:2345:respawn:/sbin/mgetty -D ttyS1
S2:2345:respawn:/sbin/mgetty -D ttyS2
S3:2345:respawn:/sbin/mgetty -D ttyS3
The -D means data only, no fax machines are allowed to connect. The baud rate is automatic. I hope your modem can handle that.
5 Turn On PPP Dial In Service
Mgetty by default will not invoke PPP, it is commented out in the /etc/mgetty+sendfax/login.config file. We need this service so IP packets can flow across the dial-in connection.
vi /etc/mgetty+sendfax/login.config
Look for a line:
#/AutoPPP/ – a_ppp /usr/sbin/pppd auth -chap +pap login debug
Change to
/AutoPPP/ – a_ppp /usr/sbin/pppd auth -chap +pap login debug
and remove the first character, the # and save the file. Notice the “debug†option on that line. This logs useful information in /var/log/messages that we will look at later. Also, the “login†option means to authenticate with the /etc/passwd file after “pap†authentication (described below).
6 Setup PPP Options
When PPP starts up, it reads options from the command line from /etc/mgetty+sendfax/login.config. Then it read more options from the /etc/ppp directory. We will create a new file called options.server where we will put generic options for all modems that dial in. Then we will have an options file for each modem where we can put the IP address we will assign anyone on that modem. That file will be named options.ttyS0 or options.ttyS1.
vi /etc/ppp/options.server
-detach
asyncmap 0
modem
crtscts
lock
proxyarp
ms-dns 1.2.3.4Â Â Â Â Â Â Â Â Â Â #replace 1.2.3.4 with DNS address Primary
ms-dns 3.4.5.6Â Â Â Â Â Â Â Â Â Â #replace 3.4.5.6 with DNS address Slave
vi /etc/ppp/options.ttyS0
192.168.0.12:192.168.0.100Â Â Â Â Â Â Â Â Â Â Â Â #serverAddress:clientAdress
netmask 255.255.255.0Â Â Â Â #The netmask of the LAN the server is connected to
7 Add Users To pap-secrets
In order to allow dial in, you will have to define users and passwords to authenticate them with. PPP will authenticate them. First, we must add users and passwords to the /etc/ppp/pap-secrets file.
vi /etc/ppp/pap-secrets
Client (User)      Server      Secret (password)        IP
sohail              *              boby                              *
zain                *              zain123                          *
8 Create Linux Users
Now, create some regular linux users that correspond to the /etc/ppp/pap-secrets file. Use the same password that has been entered in that file. If you do not want to do this step then you must remove the “login†option from the command line of ppp kept in /etc/mgetty+sendfax/login.config.
9 Turn On Routing
We now want Linux to be a router and allow packets to flow through it. This is called packet forwarding.
vi /etc/sysctl.conf
net.ipv4.ip_forward  = 1
sysctl -e -p /etc/sysctl.conf
10 Start Mgetty
Tell the init to re-read its config file (/etc/inittab) and start up mgetty on the modems.
/sbin/telinit q
11 Test Dial In and View Logs
Have someone try dialing in on Phone number attached to modem and you can watch the logs live by typing this:
tail -f /var/log/messages
You will see the connection attempts and some useful debugging info.
Thanks to Author, source http://fastcreators.com/article/2007/01/10/how-to-set-up-linux-as-a-dial-in-server/
Posted in CentOS, debian, fedora, feebsd, linux, Networking, ubuntu | No Comments »
How To Configure Dynamic DNS (Fedora Core 4 Setup) July 1st, 2009
In this howto we will learn how to build a Dynamic DNS Server. Normally when we configure DNS, we use static entries to resolve any FQDN. If we are using DHCP in our network which gives dynamic IPs to every computer that turns on or requests one, then it is not possible to configure DNS statically. For that we should configure our DNS with DHCP in a manner that whenever a computer gets a new IP, its FQDN will be automatically updated with the new IP in DNS.
1 Installation of Packages
Fedora Core 4 contains a DNS (Bind) and DHCP (dhcp) packages in its CDs. You can install it from the Fedora Core 4 CDs or download it from the internet using following command.
yum –y install bind bind-chroot bind-utils bind-libs caching-nameserver dhcp
where
bind —– DNS Server Package
bind-chroot —– DNS runs in chroot (jail) environment.
bind-libs —– Libraries needed in using bind, bind-utils
bind-utils —– Contains utilities like nslookup, host, dig etc.
caching-nameserver —– give caching capabilities to store records in cache.
dhcp —– Dynamic Host Configuration Protocol Package.
2 Configuring BIND (DNS)
You need to tell BIND that it is okay to allow other applications to update it. I added the following to my BIND configuration, everything else was left as stock Fedora Core 4. Here is my local zone details, suitably modified. Here I let BIND know which domains it can update; in my case I only have one domain to deal with. I am also loading the shared secret key at this stage. My DHCP server and DNS server are on the same box, so here I am only allowing localhost to perform the update. The file rndckey is a file containing a shared secret, so that BIND knows that it is an approved application sending instructions.
vi /etc/named.conf
controls {
inet 127.0.0.1 allow {localhost; } keys { "rndckey"; };
};
// Add local zone definitions here.
zone "example.com" {
type master;
file "example.com.zone";
allow-update { key "rndckey"; };
notify yes;
};
zone "0.168.192.in-addr.arpa" {
type master;
file "0.168.192.in-addr.arpa.zone";
allow-update { key "rndckey"; };
notify yes;
};
include "/etc/bind/rndc.key";
The secret key is created at the installation time. No need to do anything here but….
Note: If your DHCP and DNS servers are on separate machines you need to copy the file between them. Both machines should use the same file i.e. /etc/rndc.key.
2.1 Zone Files
Set up your zone databases as normal. You do not need to do anything fancy. Because our DHCP server will update zone files as the new IP allocated to our workstation.
vi /var/named/chroot/var/named/example.com.zone
$TTL 86400
@Â Â Â Â Â Â INÂ Â Â Â Â Â SOAÂ Â Â Â @ root (
50 ; serial
28800 ; refresh (8 hours)
7200 ; retry (2 hours)
604800 ; retire (1 week)
86400 ; ttl (1 day)
)
INÂ Â Â Â Â Â NSÂ Â Â Â Â Â server
server    IN      A      192.168.0.1
vi /var/named/chroot/var/named/0.168.192.in-addr.arpa.zone
$TTL 86400
@Â Â Â Â Â Â INÂ Â Â Â Â Â SOAÂ Â Â Â @ root (
50 ; serial
28800 ; refresh (8 hours)
7200 ; retry (2 hours)
604800 ; retire (1 week)
86400 ; ttl (1 day)
)
INÂ Â Â Â Â Â NSÂ Â Â Â Â Â server
1Â Â Â Â Â Â INÂ Â PTRÂ Â Â Â server.example.com.
Now make shortcuts of these files in the /var/named directory with the same name.
cd /var/named
ln –s /var/named/chroot/var/named/example.com.zone example.com.zone
ln –s /var/named/chroot/var/named/0.168.192.in-addr.arpa.zone 0.168.192.in-addr.arpa.zone
3 Configuring DHCP Server
By default the DHCP server shipped in Fedora Core 4 does not do dynamic DNS update. You simply need to enable it. Below are the options I selected for my system. My dhcp configuration is as follows:
vi /etc/dhcpd.conf
authoritative;
include "/etc/rndc.key";
# Server configuration:
server-identifier    server;
ddns-domainname        "example.com.";
ddns-rev-domainname    "in-addr.arpa.";
ddns-update-style      interim;
ddns-updates            on;
ignore                  client-updates;
# This is the communication zone
zone example.com. {
primary 127.0.0.1;
key rndckey;
}
default-lease-time      21600;  # 6 hours
max-lease-time          43200;  # 12 hours
# Client configuration:
option domain-name      "example.com.";
option ip-forwarding    off;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.100 192.168.0.200;
option routers                  192.168.0.1;  # default gateway
option subnet-mask              255.255.255.0;
option broadcast-address        192.168.0.255;
option domain-name-servers      192.168.0.1;
zone  0.168.192.in-addr.arpa. {
primary 192.168.0.2;
key rndckey;
}
zone localdomain. {
primary 192.168.0.2;
key rndckey;
}
}
Now execute the following change permission commands to enable named user to write the zone files whenever an name with IP updating is required.
chmod 770 /var/named/chroot/var/named
chmod 770 /var/named
Now start the services of dns and dhcp with the following command:
service named start
service dhcp start
Go to your client computers and enable them to take an IP from a DHCP server. With the following command check if your client computer name is updated in DNS. It will resolve your name with the newly allocated IP.
nslookup yourcomputername.example.com
Good Luck with your newly created Dynamic DNS Server.
Thanks to – Sohail Riaz (sohail [at] gmail [dot] com )
source http://fastcreators.com/article/2007/01/16/
how-to-configure-dynamic-dns-fedora-core-4-setup/
How to regularly backup Windows XP to Ubuntu, using rsync July 1st, 2009
Back in September I revived my MiniITX box to serve as a backup server. I set up BackupPC, ran it once, it seemed to work, and then ignored it for weeks. When I checked back, it hadn’t run successfully since. Ugh, I want backups to just work!
A few nights ago I decided to try again, this time dropping the constraint of not installing software on my laptop. Turns out I already had the building block I needed: rsync, installed in the form of Cygwin.
I began with these Rsync for Windows instructions, and everything went smoothly until the very end—rsync on Windows wasn’t connecting to rsync on Ubuntu. My gut told me rsync’s port 873 isn’t open on Ubuntu, but I had no idea how to open ports anymore. Luckily I found How to start rsync daemon at boot in the Ubuntu forums which told me exactly what I needed to know.
Partly as an aide to my memory, and partly to help anyone out there who might be struggling with the same project (unless everyone except me is already backing up their computers) I decided to summarize the process without all the false starts and dead ends it took me to figure it all out. For more information, the rsync man page is useful, as well as the results in Google for windows rsync.
Set up rsync server on Ubuntu
- Run
<font style="background-color: #eeeecc" size="3">sudo apt-get install rsync</font>(it’s probably already installed) - Create a file named rsyncd.conf in /etc
-
sudo nano /etc/rsyncd.conf
- Add the following to rsynd.conf, replacing all instances of
<strong><font style="background-color: #eeeecc" size="3">username</font></strong>with your Ubuntu username:[<strong>username</strong>backup]
-
path = /home/<strong>username</strong>/backup
-
comment = Backup uid = <strong>username</strong>
-
gid = <strong>username</strong> read only = false
-
auth users = <strong>username</strong>
-
secrets file = /etc/rsyncd.secrets
-
sudo chmod 644 /etc/rsynd.conf
-
- Create a file named rsyncd.secrets in /etc
-
sudo nano /etc/rsyncd.secrets
- Add the following to rsyncd.secrets, replacing
<strong><font style="background-color: #eeeecc" size="3">username</font></strong>with your username and<strong><font style="background-color: #eeeecc" size="3">password</font></strong>with a password of your choosing:<strong>username</strong>:<strong>password</strong>
-
sudo chmod 600 /etc/rsyncd.secrets
-
- Open rsync port by editing /etc/default/rsync and setting
RSYNC_ENABLE=true
- Restart rsync
sudo /etc/init.d/rsync restart
Set up rsync client on Windows
- Install Cygwin, making sure Editors > nano and Net > rsync are selected
- Add
<font style="background-color: #eeeecc" size="3">C:\cygwin\bin;</font>to the Windows PATH statement- Right-click on My Computer and select Properties
- Switch to the Advanced tab and click the Environment Variables button at the bottom
- Find the “Path†or “PATH†variable in the System variables list at the bottom and click Edit
- Add
<font style="background-color: #eeeecc" size="3">C:\cygwin\bin;</font>to the beginning of the list
- Create secret file to store password in Cygwin
- Start Cygwin Bash Shell
- Create secret file in the filesystem root and enter only the password in rsyncd.secrets above, with no spaces or line breaks
nano /secret
-
chmod 600 /secret
-
chown Administrator:SYSTEM /secret
- Create bat file to run rsync
- Open Notepad and enter the following command, replacing User Name with your Windows User Name directory, username with your Ubuntu username, and ipaddress with the IP address of your Ubuntu server (e.g. 192.168.0.100):
Linux Directory Structure Overview July 1st, 2009
One of the most noticeable differences between Linux and Windows is the directory structure. Not only is the format different, but the logic of where to find things is different.
Introduction
In Windows, you use this format to access a directory
D:\Folder\subfolder\file.txt
In Linux, this is the basic format
/Folder/subfolder/file.txt
You’ll notice that the slashes are forward slashes in Linux versus backslashes in Windows. Also, there is no drive name (C:, D:, etc.) in Linux. At boot, the ‘root partition’ is mounted at /. All files, folders, devices and drives are mounted under /. Though it is not apparent from this example, it is important to note that files and folders in Linux are case sensitive.
/Folder/subfolder/file.txt is not the same as /folder/subfolder/file.txt.
Linux Directory Structure Overview
The Directory Structure in Unix & Linux are a unified Directory Structure where in all the directories are unified under the “/†Root file system. Irrespective of where the File System is physically mounted all the directories are arranged hierarchically under the Root file system.
The Linux Directory Structure follows the “Filesystem Hierarchy Structure (FHS)†maintained by the Free Standards Group although most of the distributions sometimes tend to deviate from the standards.
Lets have a quick stroll across the different directories under the Linux Filesystem Hierarchy
“/†Root
The Directory Structure starts with the Root file system “/†and is indeed the root directory for the whole structure.The partition where / (the root directory) will be located on a UNIX or UNIX-compatible system.
/boot
The /boot directory contains the Boot loader files including Grub or Lilo, the Kernel, initrd and system.map config files
/sys
This contains the Kernel, Firmware and system related files.
/sbin
Contains the essential System Binaries and System Administration tools essential for the system operation and performance
/bin
Contains the essential binaries for users and those utilities that are required in single user mode. Examples, include cat, ls, cp etc.
/lib
Contains the library files for all the binaries held in the /sbin & /bin directories
/dev
The /dev directory contains the essential system files and drivers.
/etc
The /etc/directory contain essential System configuration files including /etc/hosts, /etc/resolv.conf, nsswitch.conf, defaults and network configuration files. These are mostly host specific system and application configuration files.
/home
All the user home directories are held under this directory with the exception of the root home directory which is kept under /root directory. This directory holds users files, personal settings like .profile etc.
/media
A generic mount point for removable media like CD-ROM, USB, Floppies etc
/mnt
A generic mount point for temporary file systems. This comes handy particulary when troubleshooting from CDROM etc wherein you might have to mount the Root file system and edit configurations.
/opt
A rarely used directory in Linux for Optional Software Packages. This is extensively used in UNIX OS like Sun Solaris where the software packages are installed
/usr
A sub hierarchy to the root file system which is a User data directory. Contains user specific utilities and applications. You will again see a lot of important but not critical file systems are mounted. Here you would again find a bin, sbin & lib directory which contains non-critical user and system binaries and related libraries and a share directory. Also found here are the include directory with include files
/usr/sbin
Contains Non-essential Non-critical system binaries and network utilities
/usr/bin
Contains Non-Essential Non-critical command binaries for users.
/usr/lib
Library files for the binaries in /usr/bin & /usr/sbin directory.
/usr/share
A platform-independent shared data directory
/usr/local
A sub hierarchy under the /usr directory which has Local System specific data including user and system binaries and their libraries
/var
The /var directory is mostly mounted as a separate filesystem under the root where in all the variable content like logs, spool files for printers, crontab,at jobs, mail, running process, lock files etc. Care has to be taken in planning this file system and maintenance as this can fill up pretty quickly and when the FileSystem is full can cause system and application operational issues.
/tmp
A temporary file system which hold temporary files which are cleared at system reboot. There is also a /var/tmp directory which holds temporary files too. the only difference between the two is that /var/tmp directory holds files that are protected at system reboot. In other words, /var/tmp files are not flushed upon a reboot.
Then you have the virtual (psuedo) file system /proc which resides in the memory and is mounted under the Root holding kernel and process stats in text file formats.
Linux Directory Structure in Visual View

Note:-
This structure could vary from distro to distro and this is a very generic linux directory structure.The directory structure in Linux can be confusing for new users of Linux. Most distributions have the same general structure of the base directory system.
Thanks to Author, source http://www.debianadmin.com/linux-directory-structure-overview.html
Posted in CentOS, debian, fedora, feebsd, linux, Networking, ubuntu | No Comments »
