您的位置:首页 > 其它

dhcp配置案例

2012-12-05 09:14 197 查看
server2的配置

ifconfig eth0 172.17.17.2 netmask 255.255.255.0 #设置ip地址

route add default gw 172.17.17.1 #设置默认网关

yum install dhcp-* #安装dhcp服务

cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf 拷贝模板文件到etc下

vim /etc/dhcpd.conf 编辑配置文件

ddns-update-style interim;

ignore client-updates;

option time-offset -18000; 服务器时间与格林威治标准时间的差值

default-lease-time 21600; 默认的租约时间

max-lease-time 43200; 最大租约时间

subnet 172.17.17.0 netmask 255.255.255.0 { #172.17.17.0的作用域

option routers 172.17.17.1;#默认路由

option subnet-mask 255.255.255.0;#子网掩码

range dynamic-bootp 172.17.17.100 172.17.17.200;#地址池

host print { #绑定地址

hardware ethernet 12:34:56:78:AB:CD;

fixed-address 172.17.17.101;

}

}

subnet 192.168.1.0 netmask 255.255.255.0 { #192.168.1.0的作用域

option routers 192.168.1.1;

option subnet-mask 255.255.255.0;

range dynamic-bootp 192.168.1.100 192.168.1.200;

}

subnet 192.168.2.0 netmask 255.255.255.0 { #192.168.2.0的作用域

option routers 192.168.2.1;

option subnet-mask 255.255.255.0;

range dynamic-bootp 192.168.2.100 192.168.2.200;

}

/etc/init.d/dhcpd start 启动dhcp服务

dhcp中继代理server1的配置

yum install dhcp-* #安装dhcp服务

vim /etc/sysconfig/dhcrelay 配置中继配置文件

INTERFACES="eth0 eth1 eth2" 指定通过那个网络接口将客户端请求传递给服务器

DHCPSERVERS="172.17.17.2" 指定dhcp服务器到ip地址

echo 1 >/proc/sys/net/ipv4/ip_forward 开启网卡转发功能

service dhcrelay start 启动中继服务

客户端测试

linux的主机利用dhclient 设备名称 获取IP地址

dhclient -r 释放IP地址

windows的主机设网卡为自动获取
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: