DHCP及中继器--RedHat5.9

DHCP服务器
服务器自身要有固定IP
网关指定中继器网卡IP
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0C:29:73:25:E4
ONBOOT=yes
IPADDR=192.168.1.1
NETMASK=255.255.255.0
GATEWAY=192.168.1.254               中继器与DHCP服务器相连网卡IP
配置服务网卡
[root@localhost ~]# vim /etc/sysconfig/dhcpd
DHCPDARGS="eth0"                         提供DHCP服务的网卡

配置文件
[root@localhost ~]# vim /etc/dhcpd.conf
ddns-update-style none;
subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers                  192.168.1.254;
        option subnet-mask              255.255.255.0;
        option domain-name              "tarena.com";
        option domain-name-servers      202.106.0.20;
        range dynamic-bootp 192.168.1.20 192.168.1.50;
        default-lease-time 21600;
        max-lease-time 43200;
        host ns {
                hardware ethernet 12:34:56:78:AB:CD;
                fixed-address 207.175.42.254;
        }
}
subnet 192.168.2.0 netmask 255.255.255.0 {
        option routers                  192.168.2.254;
        option subnet-mask              255.255.255.0;
        option domain-name              "tarena.com";
        option domain-name-servers      202.106.0.20;
        range dynamic-bootp 192.168.2.20 192.168.2.50;
        default-lease-time 21600;
        max-lease-time 43200;
}

[root@localhost ~]# service dhcpd start
[root@localhost ~]# chkconfig dhcpd on

 


中继服务器
eth0:192.168.1.254
eth1:192.168.2.1


开启路由转发功能
[root@localhost ~]# vim /etc/sysctl.conf 
net.ipv4.ip_forward = 1                                       此处为1开启路由转发功能

[root@localhost ~]# sysctl -p

 

指定服务网卡及DHCP服务器IP

[root@localhost ~]# vim /etc/sysconfig/dhcrelay
INTERFACES="eth0 eth1"
DHCPSERVERS="192.168.1.1"

 

启动服务并保证服务随系统启动

[root@localhost ~]# service dhcrelay start
[root@localhost ~]# dhkconfig dhcrelay on

 


 

你可能感兴趣的:(服务器,配置文件,中继器)