linux 安装dhcp中继,Linux 下 DHCP服务器 + DHCP 中继

1.检查DHCP安装情况

[root@lihua ~]# rpm -qa | grep dhcp

dhcp-3.0.1-12_EL

dhcpv6_client-0.10-8

[root@lihua ~]#

2.dhcpd.conf默认情况下是没有安装的,需要自行配置,不过有默认的文档

[root@lihua ~]# cd /usr/share/doc/dhcp-3.0.1/

[root@lihua dhcp-3.0.1]# ls

dhcpd.conf.sampleREADMERELNOTES

[root@lihua dhcp-3.0.1]#

3.作为网络管理者应该有自行编写的能力

[root@lihua dhcp-3.0.1]# vi /etc/dhcpd.conf

ddns-update-style none;

default-lease-time 21600;

max-lease-time 43200;

option domain-name"test.com";

option domain-name-servers 172.16.19.125;

subnet 172.16.0.0 netmask 255.255.0.0 {

range 172.16.19.126 172.16.19.254;

option routers 172.16.16.1;

option subnet-mask 255.255.0.0;

host windowsXP {

hardware ethernet 00:0c:29:56:b7:0f;

fixed-address 172.16.19.222;

}

}

4.重启dhcpd服务

[root@lihua dhcp-3.0.1]# service dhcpd restart

Internet Systems Consortium DHCP Server V3.0.1

Copyright 2004 Internet Systems Consortium.

All rights reserved.

For info, please visit

Shutting down dhcpd: [OK]

Starting dhcpd: [OK]

[root@lihua dhcp-3.0.1]#

5.测试客户端情况

Windows下ipconfig /release ipconfig /renew

Linux下dhclient

DHCP中继

1.检查DHCP安装情况

[root@benet02 ~]# rpm -qa | grep dhcp

dhcpv6_client-0.10-8

没有安装挂载光盘

[root@benet02 ~]# mount /dev/cdrom /mnt/

mount: block device /dev/cdrom is write-protected, mounting read-only

安装DHCP

[root@benet02 ~]# rpm -ivh /mnt/RedHat/RPMS/dhcp-3.0.1-12_EL.i386.rpm

warning: /mnt/RedHat/RPMS/dhcp-3.0.1-12_EL.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e

Preparing...########################################### [100%]

1:dhcp########################################### [100%]

[root@benet02 ~]#

编辑

[root@benet02 ~]# vi /etc/sysctl.conf

# Kernel sysctl configuration file for Red Hat Linux

#

# For binary values, 0 is disabled, 1 is enabled.See sysctl(8) and

# sysctl.conf(5) for more details.

# Controls IP packet forwarding

net.ipv4.ip_forward = 1///更改的内容

# Controls source route verification

net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing

net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel

kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.

# Useful for debugging multi-threaded applications.

kernel.core_uses_pid = 1

在DHCP服务器上添加网关

[root@lihua /]# route add default gw 172.16.18.248 ///也就是DHCP中继的和DHCP服务器相连的那块网卡的IP

编辑/etc/dhcpd.conf

ddns-update-style none;

default-lease-time 21600;

max-lease-time 43200;

option domain-name"test.com";

option domain-name-servers 172.16.19.125;

subnet 172.16.0.0 netmask 255.255.0.0 {

range 172.16.19.126 172.16.19.254;

option routers 172.16.16.1;

option subnet-mask 255.255.0.0;

host windowsXP {

hardware ethernet 00:0c:29:56:b7:0f;

fixed-address 172.16.19.222;

}

}

subnet 10.0.0.0 netmask 255.255.255.0 {

range 10.0.0.100 10.0.0.200;

option routers 10.0.0.1;

option subnet-mask 255.255.255.0;

}

重启服务[root@lihua /]# service dhcpd restart

DHCP中继上做中继转发

[root@benet02 ~]# dhcrelay 172.16.19.125///IP是DHCP服务器的IP

Internet Systems Consortium DHCP Relay Agent V3.0.1

Copyright 2004 Internet Systems Consortium.

All rights reserved.

For info, please visit

Listening on LPF/eth1/00:0c:29:b3:47:ed

Sending onLPF/eth1/00:0c:29:b3:47:ed

Listening on LPF/eth0/00:0c:29:b3:47:e3

Sending onLPF/eth0/00:0c:29:b3:47:e3

Sending onSocket/fallback

客户端验证是否获得10.0.0.0网段的IP地址

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值