# Forward DHCPOFFER Unicast



## cesjr (Apr 24, 2017)

Hi
I have 3 subnets below all of them on layer3 switch :
10.1.1.0 /24
10.1.2.0 /24
10.1.5.0 /24

And my dhcp server has 2 interfaces below:
em0: 10.1.2.254 /24
re0: 192.168.1.244 /24
The re0 was connect to layer 3 switch,while the em0 was connect to layer 2 switch,the em0 also provided DHCP services to the client on 10.1.2.0 /24.


Is this possible for forwarding dhcpoffer unicast message to different subnet within a single DHCP server ?
I tried to using this below in /etc/rc.conf , but not working .
dhcpd_ifaces="em0"
dhcpd_ifaces="re0"

Here is my dhcp config :

```
authoritative;
option domain-name "intra.net";
option domain-name-servers 192.168.1.254;
option netbios-name-servers 192.168.1.20;
option time-offset 28800;
default-lease-time 21600;
max-lease-time 864000;
ddns-update-style none;
log-facility local7;

#RD
subnet 10.1.2.0 netmask 255.255.255.0 {
        range dynamic-bootp 10.1.2.150 10.1.2.200;
        option routers 10.1.2.254;
}

#ACCOUNTING
subnet 10.1.1.0 netmask 255.255.255.0 {
        range dynamic-bootp 10.1.1.150 10.1.1.200;
        option routers 10.1.1.1;
}

#WIFI
subnet 10.1.5.0 netmask 255.255.255.0 {
        range dynamic-bootp 10.1.5.150 10.1.5.200;
        option routers 10.1.5.1;
}
```
Any suggestion will be appreciated.


----------



## Max212 (Apr 24, 2017)

On L3 switch you must enable dhcp-relay or bootp helper. Naming convention depends on the switch.


----------



## SirDice (Apr 24, 2017)

cesjr said:


> I tried to using this below in /etc/rc.conf , but not working .
> 
> ```
> dhcpd_ifaces="em0"
> ...


The values in rc.conf are variables, so this isn't going to work. The last setting will simply overrule the first. This however works as expected:

```
dhcpd_ifaces="em0 re0"
```

And I agree with Max212, on a L3 switch you need to enable DHCP "helper".


----------



## cesjr (Apr 25, 2017)

Thanks , I enable the IP helper address on L3 switch

```
Vlan15 is up, line protocol is up
  Internet address is 10.1.5.1/24
  Broadcast address is 255.255.255.255
  Address determined by setup command
  MTU is 1500 bytes
  Helper address is 10.1.2.254
```

Ping between 10.1.5.1 and 10.1.2.254 was successful.
If I set static IP on client  and ping again,it still successful.
The firewall rules for LAN was permit any to any.

```
CorSwitch1#ping
Protocol [ip]:
Target IP address: 10.1.2.254
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface: 10.1.5.1
Type of service [0]:
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.2.254, timeout is 2 seconds:
Packet sent with a source address of 10.1.5.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/8 ms
```

The DHCP services on FreeBSD was functional because client on 10.1.2.0/24 get their IP address with no problem.
But I still can't get DHCP response on 10.1.5.0/24.
I try to enable  dhcpd_ifaces="em0 re0" in /etc/rc.conf but it says "No subnet declaration for re0" , can I force enable the interface with no declaration ? I want to change helper address to 192.168.1.244 and observe result.

```
Apr 25 10:39:01 LANGW dhcpd:
Apr 25 10:39:01 LANGW dhcpd: No subnet declaration for re0 (192.168.1.244).
Apr 25 10:39:01 LANGW dhcpd: ** Ignoring requests on re0.  If this is not what
Apr 25 10:39:01 LANGW dhcpd:    you want, please write a subnet declaration
Apr 25 10:39:01 LANGW dhcpd:    in your dhcpd.conf file for the network segment
Apr 25 10:39:01 LANGW dhcpd:    to which interface re0 is attached. **
Apr 25 10:39:01 LANGW dhcpd:
```
Is there have a way to test DHCP connection from client to server ?
Forexample :`telnet 192.168.1.1 25` will test SMTP connection.


----------



## Max212 (Apr 25, 2017)

packet capture is your friend. This way you will see what packets if any gets to server.


----------



## SirDice (Apr 25, 2017)

You need a slight change in the configuration:

```
shared-network mynetwork {

  #RD
  subnet 10.1.2.0 netmask 255.255.255.0 {
        range dynamic-bootp 10.1.2.150 10.1.2.200;
        option routers 10.1.2.254;
  }

  #ACCOUNTING
  subnet 10.1.1.0 netmask 255.255.255.0 {
        range dynamic-bootp 10.1.1.150 10.1.1.200;
        option routers 10.1.1.1;
  }

  #WIFI
  subnet 10.1.5.0 netmask 255.255.255.0 {
        range dynamic-bootp 10.1.5.150 10.1.5.200;
        option routers 10.1.5.1;
  }
}
```


----------



## cesjr (May 8, 2017)

Thanks , I changed but still doesn't working
I will try to use wireshark to see what happen.


----------

