How to kickstart from both directly and non-directly connected network

Jephe Wu - http://linuxtechres.blogspot.com

Objective: kickstart CentOS 6 installation from both direct and non-direct connected network
Environment: CentOS 6, LAN
keywords: dhcp, dhcrelay, kickstart.



Network diagram:

------PC0(DHCP and to be tickstarted)------[eth1:192.168.1.1]DHCP Server[eth0:192.168.0.1]----PC1(non-DHCP network, no need kickstart)---[eth0:192.168.0.2] Linux DHCP Relay agent server [eth1:192.168.2.1] ----PC2(need DHCP and to be kickstarted)

Steps:

1. configure DHCP server as follows:

# this global config is mainly for 192.168.1.1 dhcp network pcs
option time-offset    -18000; # Eastern Standard Time
option domain-name    "jephe";
option routers      192.168.1.1;
option subnet-mask    255.255.255.0;
option domain-name-servers  192.168.1.1;
default-lease-time    21600;
max-lease-time      43200;
allow booting;
allow bootp;


ddns-update-style none;
ignore client-updates;


subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.33 192.168.1.54;
next-server 192.168.1.1
filename "linux/pxelinux.0";


#if need to make dhcp server to listen on eth0 also even if pc1 is no need dhcp, it's for serving dhcp relay network 192.168.2.x# if listening on eth1 only(set it in /etc/default/dhcp3 for ubuntu)

subnet 192.168.0.0 netmask 255.255.255.0 {
}


subnet 192.168.2.0 netmask 255.255.255.0 {
 range 192.168.2.33 192.168.2.54;
 option domain-name-servers 192.168.0.1;
 option routers 192.168.2.1;   dhcrelay ip
 next-server 192.168.0.1; dhcp/tftp server
 filename "linux/pxelinux.0";
 }


2. dhcrelay server configuration


[root]# vi /etc/sysconfig/dhcrelay 
# Command line options here
DHCRELAYARGS=""
# DHCPv4 only
INTERFACES="eth0 eth1"  #must listen on both interfaces, otherwise, dhcp relay package is not able to forward back to client in non-directly connected network 192.168.2.X
# DHCPv4 only
DHCPSERVERS="192.168.0.1"
                     
3. start up services and monitoring
chkconfig dhcrelay on
service dhcrelay start

tcpdump -n port 67 or port 68  # on dhcp server
dhcrelay -d -i eth0 eth1 # to monitoring dhcrelay packages