一、DHCP中继代理(1)在服务器上建立多个网段的作用域
- [root@localhost ~]# cat /etc/dhcpd.conf
- ddns-update-style interim;
- ignore client-updates;
- option subnet-mask 255.255.255.0;
- option domain-name-servers 202.106.0.20,202.106.148.1;
- option time-offset -18000; # Eastern Standard Time
- default-lease-time 21600;
- max-lease-time 43200;
- subnet 192.168.2.0 netmask 255.255.255.0 {
- option routers 192.168.2.1;
- range dynamic-bootp 192.168.2.128 192.168.2.254;
- }
- subnet 192.168.3.0 netmask 255.255.255.0 {
- option routers 192.168.3.1;
- range dynamic-bootp 192.168.3.128 192.168.3.254;
- }
- subnet 192.168.4.0 netmask 255.255.255.0 {
- option routers 192.168.4.1;
- range dynamic-bootp 192.168.4.128 192.168.4.254;
- }
- [root@localhost ~]# cat /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
- # Controls the use of TCP syncookies
- net.ipv4.tcp_syncookies = 1
- # Controls the maximum size of a message, in bytes
- kernel.msgmnb = 65536
- # Controls the default maxmimum size of a mesage queue
- kernel.msgmax = 65536
- # Controls the maximum shared segment size, in bytes
- kernel.shmmax = 4294967295
- # Controls the maximum number of shared memory segments, in pages
- kernel.shmall = 268435456
- [root@localhost ~]# sysctl -p
- net.ipv4.ip_forward = 1
- net.ipv4.conf.default.rp_filter = 1
- net.ipv4.conf.default.accept_source_route = 0
- kernel.sysrq = 0
- kernel.core_uses_pid = 1
- net.ipv4.tcp_syncookies = 1
- kernel.msgmnb = 65536
- kernel.msgmax = 65536
- kernel.shmmax = 4294967295
- kernel.shmall = 268435456
- [root@localhost ~]# cat /etc/sysconfig/dhcrelay
- # Command line options here
- INTERFACES="eth0 eth1 eth2"
- DHCPSERVERS="192.168.2.2"
(4)启动服务
service dhcrelay start (5)设置下次开机自动启动 chkconfig dhcrelay on ps:对于使用虚拟机来做DHCP中继代理实验,最后需要一条指令“dhcrelay DHCP服务器的IP地址”,真实环境此步骤可以省略。