ClearOS Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002088ClearOSapp-dhcp - DHCP Serverpublic2014-12-24 22:062018-10-24 17:58
Assigned Touser2 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version7.5.0 Updates 
Summary0002088: DHCP scope suggests invalid default gateway.
DescriptionWhen 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.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
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;
            $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.
dloper (administrator)
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.
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?
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!).
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;
                $subnet['gateway'] = '';
        } else {
            $subnet['gateway'] = $ip;

- Issue History
Date Modified Username Field Change
2014-12-24 22:06 dloper New Issue
2014-12-27 04:09 user2 Status new => confirmed
2015-01-30 02:16 user2 Note Added: 0001359
2015-03-26 17:12 user2 Assigned To => user2
2015-03-26 17:12 user2 Status confirmed => feedback
2015-04-03 09:24 dloper Note Added: 0001408
2015-04-03 09:24 dloper Status feedback => assigned
2015-04-05 08:54 user2 Note Added: 0001409
2015-05-08 14:18 user2 Product Version 7.0.0 Alpha 2 =>
2015-05-08 14:18 user2 Target Version 7.1.0 Beta 2 =>
2018-10-10 08:03 user2 Note Added: 0008181
2018-10-10 08:03 user2 Status assigned => resolved
2018-10-10 08:03 user2 Fixed in Version => 7.5.0 Updates
2018-10-10 08:03 user2 Resolution open => fixed
2018-10-10 08:27 user2 Note Added: 0008191
2018-10-24 17:58 user2 Status resolved => closed