#!/bin/bash #Notice : If you want to use this script , IP should be changed. > /etc/sysconfig/network-scripts/ifcfg-eth0 cat <<EOF >>/etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 TYPE=Ethernet ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=static IPADDR=192.168.122.1 NETMASK=255.255.255.0 EOF service network restart > /etc/dhcp/dhcpd.conf cat <<EOF >> /etc/fstab /dev/sr0 /mnt/cdrom iso9660 defaults 0 0 EOF yum install dhcp -y cat <<EOF >>/etc/dhcp/dhcpd.conf subnet 192.168.122.0 netmask 255.255.255.0 { range 192.168.122.60 192.168.122.100; option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org; } #host HOSTNAME { # hardware ethernet MAC; # fixed-address IP ; #} #HOSTNAME and IP should be changed #For exampel #host client{ #hardware ethernet 00:0C:29:A9:FA:F3 ; #fixed-address 172.16.5.80; #} EOF /etc/init.d/dhcpd restart echo Congratulations !Configuration is OK !
QQ小新 958676590
转载于:https://blog.51cto.com/oraclechina/1393127