ClearFoundation Tracker - ClearOS
View Issue Details
0002088ClearOSapp-dhcp - DHCP Serverpublic2014-12-24 22:062018-10-24 17:58
dloper 
user2 
lowminoralways
closedfixed 
 
7.5.0 Updates 
0002088: DHCP scope suggests invalid default gateway.
When creating a DHCP scope, the app will suggest the default gateway of the External Internet interface as the gateway instead of the IP address of the LAN address of the ClearOS gateway.
No tags attached.
Issue History
2014-12-24 22:06dloperNew Issue
2014-12-27 04:09user2Statusnew => confirmed
2015-01-30 02:16user2Note Added: 0001359
2015-03-26 17:12user2Assigned To => user2
2015-03-26 17:12user2Statusconfirmed => feedback
2015-04-03 09:24dloperNote Added: 0001408
2015-04-03 09:24dloperStatusfeedback => assigned
2015-04-05 08:54user2Note Added: 0001409
2015-05-08 14:18user2Product Version7.0.0 Alpha 2 =>
2015-05-08 14:18user2Target Version7.1.0 Beta 2 =>
2018-10-10 08:03user2Note Added: 0008181
2018-10-10 08:03user2Statusassigned => resolved
2018-10-10 08:03user2Fixed in Version => 7.5.0 Updates
2018-10-10 08:03user2Resolutionopen => fixed
2018-10-10 08:27user2Note Added: 0008191
2018-10-24 17:58user2Statusresolved => closed

Notes
(0001359)
user2   
2015-01-30 02:16   
The system was in standalone mode. When a ClearOS system is configured as a standalone server on the LAN, it assumes that it is being configured as the LAN's DHCP server and suggests the default gateway:

        if (($mode === Network::MODE_STANDALONE) || ($mode === Network::MODE_TRUSTED_STANDALONE))
            $subnet['gateway'] = $defroute;
        else
            $subnet['gateway'] = $ip;

That's the correct default for an "External" network interface on a system in "Standalone" mode. In the case where a user has the following setup, it's difficult to suggest a default for eth1:

  Mode: standalone
  eth0 - External
  eth1 - LAN

Right now, DHCP suggests the default gateway on eth0 for the eth1 LAN. Perhaps leaving it blank is best? Or should it suggest the eth1 LAN IP and assume the "standalone" mode is just a temporary thing.
(0001408)
dloper   
2015-04-03 09:24   
The gateway that should be suggested is the IP address associated to the NIC that is bound to the subnet is for if the server is in gateway mode (trusted gateway and regular gateway). For example. enp0s8 should suggest the IP address for:

ifconfig enp0s8 | grep "inet " | awk '{ $print $2 }'

If a result is present, then it should be suggested. If a result is NOT present, it should be blank.

If it is a standalone server, the gateway that is suggested would be the gateway (and not the IP) that exists on the 'External' interface.

At present, the gateway of the NON-ASSOCIATED address is being returned.
(0001409)
user2   
2015-04-05 08:54   
Please send the code changes that detail what you are trying to accomplish. Your feedback states:

> If it is a standalone server, the gateway that is suggested would be the gateway
> (and not the IP) that exists on the 'External' interface.

That's what the code above does. In standalone mode, the default route is used. In gateway mode, the LAN IP is used. How would you like this changed?
(0008181)
user2   
2018-10-10 08:03   
The gateway will now be the local ClearOS IP even when in standalone mode (i.e. we're telling clients to route through ClearOS even though ClearOS is not routing!).
(0008191)
user2   
2018-10-10 08:27   
Scratch that. If the system is in standalone mode, the default gateway will be used if and only if that default gateway is on the interfaces local network.

        if (($mode === Network::MODE_STANDALONE) || ($mode === Network::MODE_TRUSTED_STANDALONE)) {
            $network_address = Network_Utils::get_network_address($ip, $netmask);
            $network_prefix = Network_Utils::get_prefix($netmask);
            if (Network_Utils::ip_on_network($defroute, "$network_address/$network_prefix"))
                $subnet['gateway'] = $defroute;
            else
                $subnet['gateway'] = '';
        } else {
            $subnet['gateway'] = $ip;
        }