Chinaunix首页 | 论坛 | 博客
  • 博客访问: 26172
  • 博文数量: 6
  • 博客积分: 165
  • 博客等级: 入伍新兵
  • 技术积分: 60
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-26 12:03
个人简介

Network Engieer Linux Administrator

文章分类
文章存档

2013年(2)

2012年(1)

2009年(3)

我的朋友

分类: 系统运维

2009-08-26 16:04:09

install CentOS4.7 from DVD on DELL1950
[root@DHCPv6 ~]# less anaconda-ks.cfg
# Kickstart file automatically generated by anaconda.
install
cdrom
lang en_US.UTF-8
langsupport --default=en_US.UTF-8 zh_HK.UTF-8 zh_CN.UTF-8 zh_SG.UTF-8 zh_TW.UTF-8 en_US.UTF-8
keyboard us
xconfig --card "ATI ES1000" --videoram 16384 --hsync 31-80 --vsync 56-75 --resolution 800x600 --depth 16 --startxonboot  --defaultde
sktop gnome
network --device eth0 --bootproto static --ip 172.30.50.22 --netmask 255.255.255.0 --gateway 172.30.50.1 --nameserver 172.30.50.21 -
-hostname DHCPv6.QaCC.net
network --device eth1 --onboot no --bootproto dhcp --hostname DHCPv6.QaCC.net
rootpw --iscrypted $1$NNn.xYc5$VPV2LHaZDSwX4.mAjfytA1
firewall --disabled
selinux --disabled
authconfig --enableshadow --passalgo=md5
timezone Asia/Shanghai
bootloader --location=mbr --append="rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --all --drives=sda
#part /boot --fstype ext3 --size=100 --ondisk=sda
#part pv.6 --size=0 --grow --ondisk=sda
#volgroup VolGroup00 --pesize=32768 pv.6
#logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=1000 --grow --maxsize=2000
#logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
%packages
@ engineering-and-scientific
@ mysql
@ admin-tools
@ editors
@ emacs
@ system-tools
@ gnome-software-development
@ text-internet
@ x-software-development
@ legacy-network-server
@ dns-server
@ gnome-desktop
@ dialup
@ ftp-server
@ network-server
@ legacy-software-development
@ smb-server
@ base-x
@ chinese-support
@ graphics
@ web-server
@ printing
@ server-cfg
@ sound-and-video
@ development-tools
@ graphical-internet
system-config-printer-gui
mod_auth_mysql
-rwho
system-config-samba
tftp-server
system-config-printer
qt-ODBC
php-mysql
system-config-boot
system-config-httpd
freeradius
php-odbc
krb5-server
mod_authz_ldap
httpd-suexec
wireshark-gnome
net-snmp-utils
kernel-devel
lvm2
mod_auth_kerb
-rusers
qt-MySQL
e2fsprogs
mysql-bench
mysql-server
vnc-server
netdump-server
grub
openldap-servers
kernel-smp
kernel-smp-devel
%post
[root@DHCPv6 ~]#

#### do not install DHCP service at first, we will install latest DHCP server.
#### download latest dhcp-4.1.0.tar.gz from www.isc.org, upload it to \root.
tar zxvf dhcp-4.1.0.tar.gz

cd dhcp-4.1.0
./configure
make
make install
cd ..
[root@DHCPv6 ~]# less /etc/dhcpv6d.conf
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
option dhcp6.name-servers 2001:0db8:00ac:1e32::0015;
option dhcp6.domain-search "qacc.net";

##### DATA SERVER vlan 3050
#subnet6 2001:db8:00ac:1e32::/64 {
        # Range for clients
#        range6 2001:db8:00ac:1e32:1::1 2001:db8:00ac:1e32:1::ffff;
        # Additional options
#        option dhcp6.name-servers fec0:0:0:1::1;
#        option dhcp6.domain-search "domain.example";
        # Prefix range for delegation to sub-routers
#        prefix6 2001:db8:00ac:1e32:: 2001:db8:00ac:1e32:: /64;
        # Example for a fixed host address
#        host specialclient {
#               host-identifier option dhcp6.client-id 00:01:00:01:4a:1f:ba:e3:60:b9:1f:01:23:45;
#               fixed-address6 2001:db8:0:1::127;
#       }
#}

####  Video server Vlan 3060
#subnet6 2001:db8:00ac:1e3c::/64 {
#        range6 2001:db8:00ac:1e3c:1::1 2001:db8:00ac:1e3c:1::ffff;
#        prefix6 2001:db8:00ac:1e3c:: 2001:db8:00ac:1e3c:: /64;
#}
####  Vlan 200
subnet6 2001:db8:00ac:18c8::/64 {
        range6 2001:db8:00ac:18c8:1::1 2001:db8:00ac:18c8:1::ffff;
        prefix6 2001:db8:00ac:18c8:: 2001:db8:00ac:18c8:: /64;
}
[root@DHCPv6 ~]#
 
#### lease record for IPv6
touch /var/db/dhcpd6.leases
#### lease record for IPv4
touch /var/db/dhcpd.leases
 

[root@DHCPv6 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BROADCAST=172.30.50.255
HWADDR=00:15:C5:E6:22:C4
IPADDR=172.30.50.22
IPV6ADDR=2001:0DB8:00ac:1e32::16/64
IPV6INIT=yes
IPV6_AUTOCONF=no
NETMASK=255.255.255.0
NETWORK=172.30.50.0
GATEWAY=172.30.50.1
IPV6_DEFAULTGW=2001:0DB8:00ac:1e32::1
ONBOOT=yes
TYPE=Ethernet

[root@DHCPv6 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0.200
# Please read /usr/share/doc/initscripts-*/sysconfig.txt
# for the documentation of these parameters.
TYPE=Ethernet
DEVICE=eth0.200
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=yes
PEERDNS=yes
IPV6ADDR=2001:0DB8:00ac:18c8::6/64
[root@DHCPv6 etc]# less /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=DHCPv6.qacc.net
[root@DHCPv6 etc]#

[root@DHCPv6 ~]# vi /etc/resolv.conf
search qacc.net
nameserver 2001:0db8:00ac:1e32::15
nameserver 172.30.50.21

[root@DHCPv6 init.d]# vi /etc/init.d/dhcpv6d
#!/bin/sh
#
# dhcpv6d         This shell script takes care of starting and stopping
#               dhcpv6d.
#
# chkconfig: - 65 35
# description: dhcpv6d provide access to Dynamic Host Control Protocol for IPv6.
# Source function library.
. /etc/rc.d/init.d/functions
[ -f /usr/local/sbin/dhcpv6d ] || exit 0
[ -x /sbin/restorecon ] && [ -d /selinux ] && /sbin/restorecon /var/db/dhcpd6.leases >/dev/null 2>&1
RETVAL=0
prog="dhcpv6d"
configtest()
{       
        /usr/local/sbin/dhcpv6d -q -6 -t -cf /etc/dhcpv6d.conf
        return $?
}
start() {
        # Start daemons.
        echo -n $"Starting $prog: "
        daemon /usr/local/sbin/dhcpv6d -6 -cf /etc/dhcpv6d.conf
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ]; then
            touch /var/lock/subsys/dhcpv6d
            if [ -x /usr/bin/logger ]; then
                /usr/bin/logger -t dhcpd 'dhcpv6d startup succeeded'
            fi;
        else
            if [ -x /usr/bin/logger ]; then
                /usr/bin/logger -t dhcpd 'dhcpv6d startup failed'
            fi;
        fi
        return $RETVAL
}
stop() {
        # Stop daemons.
        echo -n $"Shutting down $prog: "
        killproc dhcpv6d
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ]; then
           rm -f /var/lock/subsys/dhcpd
           if [ -x /usr/bin/logger ]; then
                /usr/bin/logger -t dhcpd 'dhcpv6d shutdown succeeded'
           fi;
        else
           if [ -x /usr/bin/logger ]; then
                /usr/bin/logger -t dhcpd 'dhcpv6d shutdown failed'
           fi;
        fi
        return $RETVAL
}
# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        configtest || exit $?
        stop
        start
        RETVAL=$?
        ;;
  condrestart)
        if [ -f /var/lock/subsys/dhcpd ]; then
            stop
            start
            RETVAL=$?
        fi
        ;;
  configtest|check|testconfig|test)
        configtest
        RETVAL=$?
        ;;
  status)
        status dhcpv6d
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|condrestart|configtest|status}"
        exit 1
esac
exit $RETVAL
[root@DHCPv6 init.d]#

chmod 755 /etc/init.d/dhcpv6d
chkconfig --add dhcpv6d

[root@DHCPv6 ~]# vconfig add eth0 200
[root@DHCPv6 ~]# vi /etc/rc.local
#### insert at the end
vconfig add eth0 200
/etc/init.d/network restart
/etc/init.d/dhcpd start
/etc/init.d/dhcpv6d start
 

#############################################################################
##### create dhcp server for IPv4
#############################################################################
##### copy dhcpd.conf from 172.30.50.21, only for backup
vi /etc/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
ddns-update-style interim;
ignore client-updates;
#option contrived-001 code 201 = { boolean, integer 32, text };
#option contrived-001 on 1772 "contrivance";
# the sip server option can reply a dns name or a ip address, it is based on the boolean.
option sip-servers code 120 = {boolean, ip-address };
option sip-servers on 172.30.0.116;

#option sip-servers code 120 = {boolean, string };
#option sip-servers off 03:73:69:70:06:66:72:61:6e:63:65:02:66:72:00;
#####  03:73:69:70:04:71:61:63:63:03:6e:65:74:00 = sip.qacc.net
#####  03 = length of sip
#####  73 = s
#####  69 = i
#####  70 = p
#####  04 = length of qacc
#####  71 = q
#####  61 = a
#####  63 = c
#####  63 = c
#####  03 = length of net
#####  6e = n
#####  65 = e
#####  74 = t
#####  00 = end

        option classless-routes code 121 = array of integer 8;
#       option classless-routes 32, 1,1,1,1, 5,5,5,1,
#                               24, 2,2,2, 5,5,5,1,
#                               24, 3,3,3, 5,5,5,1;
 
 
 
#       option classless-route code 121 = {string };
#       option static-routes 192.168.30.0 192.168.1.1,
#                     22.0.0.0 192.168.1.1,
#                     192.168.100.0 192.168.5.254;
        option www-server 172.30.0.169;
        option nis-domain               "qacc.net";
        option domain-name              "qacc.net";
        option domain-name-servers      172.30.50.21,172.30.50.22;
        option ntp-servers              172.30.50.21;
        option netbios-name-servers     172.30.50.21;
        default-lease-time 21600;
        max-lease-time 43200;
#### Manage all equipment
subnet 172.31.255.0 netmask 255.255.255.0 {
        option routers                  172.31.255.1;
        option subnet-mask              255.255.255.0;
        range dynamic-bootp 172.31.255.151 172.31.255.250;
}

#### DATA server
subnet 172.30.50.0 netmask 255.255.255.0 {
        option routers                  172.30.50.1;
        option subnet-mask              255.255.255.0;
        range dynamic-bootp 172.30.50.151 172.30.50.250;
}
#### Video server
subnet 172.30.60.0 netmask 255.255.255.0 {
        option routers                  172.30.60.1;
        option subnet-mask              255.255.255.0;
        range dynamic-bootp 172.30.60.151 172.30.60.250;
}
#### VoIP server
subnet 172.30.70.0 netmask 255.255.255.0 {
        option routers                  172.30.70.1;
        option subnet-mask              255.255.255.0;
        range dynamic-bootp 172.30.70.151 172.30.70.250;
}
#### IP DATA client
subnet 172.24.5.0 netmask 255.255.255.0 {
        option classless-routes 24, 172,30,50, 172,24,5,1,
                                24, 172,30,0, 172,24,5,1,
                                32, 172,30,50,21, 172,24,5,1,
                                32, 172,30,50,22, 172,24,5,1;
#####  24,              = 255.255.255.0, length of 172.30.50
#####  172,30,50,       = 172.30.50.0
#####  172,24,5,1       = 172.24.5.1
#####
        option subnet-mask              255.255.255.0;
        range dynamic-bootp 172.24.5.151 172.24.5.250;
}
 
#### IP VIDEO client
subnet 172.24.6.0 netmask 255.255.255.0 {
        option classless-routes 24, 172,30,60, 172,24,6,1,
                                32, 172,30,50,21, 172,24,6,1,
                                32, 172,30,50,22, 172,24,6,1;
#####  24,              = 255.255.255.0, length of 172.30.60
#####  172,30,60,       = 172.30.60.0
#####  172,24,6,1       = 172.24.6.1
#####
        option subnet-mask              255.255.255.0;
        range dynamic-bootp 172.24.6.151 172.24.6.250;
}
 
 
 
[root@dns ~]# less /etc/sysconfig/dhcpd
# Command line options here
DHCPDARGS=
vi /etc/init.d/dhcpd
#!/bin/sh
#
# dhcpd         This shell script takes care of starting and stopping
#               dhcpd.
#
# chkconfig: - 65 35
# description: dhcpd provide access to Dynamic Host Control Protocol.
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
. /etc/sysconfig/dhcpd
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -f /usr/sbin/dhcpd ] || exit 0
cfOption()
{ let i=0;
  for a in $*;
  do ((++i));
     if [ $a = -cf ]; then
         ((++i));
         eval 'echo $'$i;
     elif [[ $a = -cf* ]]; then
         echo ${a#-cf};
     fi;
  done;
}
CF=`cfOption $DHCPDARGS`
if [ -z "$CF" ]; then
   CF='/etc/dhcpd.conf';
fi
[ -f "$CF" ] || exit 0
#if [ ! -f /var/lib/dhcpd/dhcpd.leases ] ; then
#   mkdir -p /var/lib/dhcpd
#   touch /var/lib/dhcpd/dhcpd.leases
if [ ! -f /var/db/dhcpd.leases ] ; then
   mkdir -p /var/db
   touch /var/db/dhcpd.leases
   [ -x /sbin/restorecon ] && [ -d /selinux ] && /sbin/restorecon /var/lib/dhcp/dhcpd.leases >/dev/null 2>&1
fi
RETVAL=0
prog="dhcpd"
configtest()
{       
        /usr/sbin/dhcpd -q -t -cf $CF
        return $?
}
start() {
        # Start daemons.
        echo -n $"Starting $prog: "
        daemon /usr/sbin/dhcpd ${DHCPDARGS} 2>/dev/null
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ]; then
            touch /var/lock/subsys/dhcpd
            if [ -x /usr/bin/logger ]; then
                /usr/bin/logger -t dhcpd 'dhcpd startup succeeded'
            fi;
        else
            if [ -x /usr/bin/logger ]; then
                /usr/bin/logger -t dhcpd 'dhcpd startup failed'
            fi;
        fi
        return $RETVAL
}
stop() {
        # Stop daemons.
        echo -n $"Shutting down $prog: "
        killproc dhcpd
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ]; then
           rm -f /var/lock/subsys/dhcpd
           if [ -x /usr/bin/logger ]; then
                /usr/bin/logger -t dhcpd 'dhcpd shutdown succeeded'
           fi;
        else
           if [ -x /usr/bin/logger ]; then
                /usr/bin/logger -t dhcpd 'dhcpd shutdown failed'
           fi;
        fi
        return $RETVAL
}
# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        configtest || exit $?
        stop
        start
        RETVAL=$?
        ;;
  condrestart)
        if [ -f /var/lock/subsys/dhcpd ]; then
            stop
            start
            RETVAL=$?
        fi
        ;;
  configtest|check|testconfig|test)
        configtest
        RETVAL=$?
        ;;
  status)
        status dhcpd
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|condrestart|configtest|status}"
        exit 1
esac
exit $RETVAL
 
chmod 755 /etc/init.d/dhcpd
ln -s /usr/local/sbin/dhcpd /usr/sbin/dhcpd
chkconfig --add dhcpd
###### we have DHCP server for IPv4 network on 172.30.50.21, this dhcpd server is only for backup

##################################################
## IPv6 configuration on OMNI9700 router
##################################################
 
in the switch, the prot to the DHCP server is trunk mode, because this layer3 switch cannot support DHCPv6 relay, so I only can create multi vlans on linux server, and
 
CORE_SW-> show configuration snapshot ipv6                                                           
! IPv6 :
ipv6 interface "ISAM-2-VLAN21" vlan 21 ra-managed-config-flag true
ipv6 address 2001::ac18:1501/120 "ISAM-2-VLAN21"
ipv6 address 2001:db8:ac:1815::1/64 "ISAM-2-VLAN21"
ipv6 interface "VLAN200" vlan 200 ra-managed-config-flag true
ipv6 address 2001::ac18:c801/120 "VLAN200"
ipv6 address 2001:db8:ac:18c8::1/64 "VLAN200"
ipv6 interface "JIAZHENCHAO-1010" vlan 1010
ipv6 interface "DATA_SERVER_3050" vlan 3050 ra-managed-config-flag true
ipv6 address 2001::ac1e:3201/120 "DATA_SERVER_3050"
ipv6 address 2001:db8:ac:1e32::1/64 "DATA_SERVER_3050"
ipv6 interface "VoIP_SERVER_3070_v6" vlan 3070
ipv6 address 2001::ac1e:4601/120 "VoIP_SERVER_3070_v6"
ipv6 address 2001:db8:ac:1e46::1/64 "VoIP_SERVER_3070_v6"
ipv6 prefix 2001:db8:ac:18c8::/64 VLAN200
ipv6 prefix 2001:db8:ac:1e32::/64 DATA_SERVER_3050
CORE_SW->
阅读(6243) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-12-16 16:18:03

终于找到了,哈哈~