快速配置DHCP中继(shell脚本)
2010-07-24 14:30
417 查看
在DHCP服务器上执行以下脚本
#!/bin/sh
INSTALL_DIR=`pwd`
rpm -ivh dhcp-3.0.5-3.el5.i386.rpm &>/dev/null
echo 'ddns-update-style none;
default-lease-time 36000000;
max-lease-time 43200000;
option domain-name "xxx.com";
option domain-name-servers 61.134.1.4;
subnet 172.16.100.0 netmask 255.255.255.0 {
range dynamic-bootp 172.16.100.10 172.16.100.254;
option routers 172.16.100.1;
option subnet-mask 255.255.0.0;
host manager {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 172.16.100.88;
}
}
subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.111 192.168.1.191;
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
host manager1 {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 172.16.100.88;
}
}
subnet 10.1.10.0 netmask 255.255.255.0 {
range dynamic-bootp 10.1.10.200 10.1.10.250;
option routers 10.1.10.1;
option subnet-mask 255.0.0.0;
host manager2 {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 172.16.100.88;
}
}' > /etc/dhcpd.conf
echo '# Command line options here
DHCPDARGS="eth0" ' >/etc/sysconfig/dhcpd
service dhcpd restart &>/dev/null
rm -rf $INSTALL_DIR/*
在dhcp中继服务器上执行下面的脚本
#!/bin/sh
INSTALL_DIR=`pwd`
rpm -ivh dhcp-3.0.5-3.el5.i386.rpm &>/dev/null
vi /etc/sysctl.conf << EOF &>/dev/null
/net.ipv4.ip_forward = 0
:s/0/1/
:wq
EOF
sysctl -p &>/dev/null
echo '# Command line options here
INTERFACES="eth0 eth1 eth2"
DHCPSERVERS="172.16.100.10" ' > /etc/sysconfig/dhcrelay
service dhcrelay start &>/dev/null
chkconfig --level 35 dhcrelay on
rm -rf INSTALL_DIR/dhcrelay.sh
注意:在做之前需要准备DHCP软件包(RPM包),可以下载最新版本的,也可以通过挂载Red Hat 5的光盘,然后找到DHCP软件包,进行安装。脚本里面的配置你只需根据实际情况进行修改即可使用。
#!/bin/sh
INSTALL_DIR=`pwd`
rpm -ivh dhcp-3.0.5-3.el5.i386.rpm &>/dev/null
echo 'ddns-update-style none;
default-lease-time 36000000;
max-lease-time 43200000;
option domain-name "xxx.com";
option domain-name-servers 61.134.1.4;
subnet 172.16.100.0 netmask 255.255.255.0 {
range dynamic-bootp 172.16.100.10 172.16.100.254;
option routers 172.16.100.1;
option subnet-mask 255.255.0.0;
host manager {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 172.16.100.88;
}
}
subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.111 192.168.1.191;
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
host manager1 {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 172.16.100.88;
}
}
subnet 10.1.10.0 netmask 255.255.255.0 {
range dynamic-bootp 10.1.10.200 10.1.10.250;
option routers 10.1.10.1;
option subnet-mask 255.0.0.0;
host manager2 {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 172.16.100.88;
}
}' > /etc/dhcpd.conf
echo '# Command line options here
DHCPDARGS="eth0" ' >/etc/sysconfig/dhcpd
service dhcpd restart &>/dev/null
rm -rf $INSTALL_DIR/*
在dhcp中继服务器上执行下面的脚本
#!/bin/sh
INSTALL_DIR=`pwd`
rpm -ivh dhcp-3.0.5-3.el5.i386.rpm &>/dev/null
vi /etc/sysctl.conf << EOF &>/dev/null
/net.ipv4.ip_forward = 0
:s/0/1/
:wq
EOF
sysctl -p &>/dev/null
echo '# Command line options here
INTERFACES="eth0 eth1 eth2"
DHCPSERVERS="172.16.100.10" ' > /etc/sysconfig/dhcrelay
service dhcrelay start &>/dev/null
chkconfig --level 35 dhcrelay on
rm -rf INSTALL_DIR/dhcrelay.sh
注意:在做之前需要准备DHCP软件包(RPM包),可以下载最新版本的,也可以通过挂载Red Hat 5的光盘,然后找到DHCP软件包,进行安装。脚本里面的配置你只需根据实际情况进行修改即可使用。
相关文章推荐
- 用shell脚本快速安装、配置bind
- 配置DHCP的shell脚本
- shell脚本-快速配置网卡参数
- shell 脚本快速部署dhcp服务器!
- shell脚本之dhcp的配置
- Shell脚本——中继DHCP服务器自动部署
- shell脚本生成dhcp配置文件
- Cisco三层交换机DHCP中继简单配置
- 快速部署Tomcat项目的Shell脚本
- Cisco配置DHCP中继代理工程实例
- 在shell脚本中调用sftp免密码的配置
- 快速入门shell脚本编写(二)
- shell编程防火墙快速配置脚本
- 快速入门shell脚本编写(一)
- 通过Shell脚本快速搭建高效Rsync服务
- 独立编译单个C文件快速shell脚本
- 快速入门shell脚本编写(四)
- 3550配置DHCP中继代理工程实例
- rails+unicorn+nginx配置、shell启动脚本