Keepalived & DHCP fail-over issues

OK, now I am back again :slight_smile: Maybe we have similar problems?

This is related to the issues I had here DHCP web interface shows wrong status and I have now realised why dhcpd.conf.local was not empty.

  • Yes, DHCP now starts when I deleted the content in dhcpd.conf.local
  • But DHCP via Keepalived no longer seem to work right without the content in dhcpd.conf.local, I can not set up same virtual IP 192.168.222.254 as router gateway for DHCP for both Keepalived servers.
  • How should I do to set up so I have same virtual IP 192.168.222.254 as router gateway for DHCP for both Keepalived servers?

When I use Keepalived, I want both servers to use the virtual IP 192.168.222.254 also as router gateway for DHCP. wiki.ipfire.org - Keepalived say that to 4/6 Make “same” DHCP work during failover

On both IPFires. Add the same “virtual” IPFire failover firewall IP to /var/ipfire/dhcp/dhcpd.conf.local (copy from /var/ipfire/dhcp/dhcpd.conf and edit)

E.g

subnet 192.168.0.0 netmask 255.255.255.0 #GREEN
{
      range 192.168.0.50 192.168.0.150;
      option subnet-mask 255.255.255.0;
      option domain-name "localdomain";
      option routers 192.168.0.254;
      option domain-name-servers 192.168.0.254, 8.8.8.8;
      option ntp-servers 192.168.0.254;
      default-lease-time 3600;
      max-lease-time 7200;
} #GREEN

That is why dhcpd.conf.local had contents. I have tried to add content again to dhcpd.conf.local again, but then DHCP service will not start. This is what I have now (/var/ipfire/dhcp/dhcpd.conf.local is now empty):

My Primary IPFire

[root@ipfire ~]# cat  /etc/keepalived/keepalived.conf
! Configuration File for keepalived

global_defs {
   notification_email {
     someemail@gmail.com
        }
   notification_email_from someemail@gmail.com
   smtp_server localhost
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}

vrrp_instance VI_1 {
    state MASTER
    interface green0
    virtual_router_id 22
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass secretforfailover
    }
    virtual_ipaddress {
        192.168.222.254
    }
}


[root@ipfire ~]# cat /var/ipfire/dhcp/dhcpd.conf
deny bootp;     #default
authoritative;
ddns-update-style none;

subnet 192.168.222.0 netmask 255.255.255.0 #GREEN
{
pool {
        range 192.168.222.50 192.168.222.150;
     }
        option subnet-mask 255.255.255.0;
        option domain-name "localdomain";
        option routers 192.168.222.251;
        option domain-name-servers 192.168.222.251, 8.8.8.8;
        option ntp-servers 192.168.222.254;
        default-lease-time 3600;
        max-lease-time 7200;
} #GREEN

include "/var/ipfire/dhcp/dhcpd.conf.local";


Backup IPFire (it also have a blue Wifi DHCP, not used by normal users)

[root@ipfire2 ~]# cat  /etc/keepalived/keepalived.conf
! Configuration File for keepalived

global_defs {
   notification_email {
     someemail@gmail.com
        }
   notification_email_from someemail@gmail.com
   smtp_server localhost
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}

vrrp_instance VI_1 {
    state BACKUP
    interface green0
    virtual_router_id 22
    priority 50
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass secretforfailover
    }
    virtual_ipaddress {
        192.168.222.254
    }
}


[root@ipfire2 ~]#  cat /var/ipfire/dhcp/dhcpd.conf
deny bootp;     #default
authoritative;
ddns-update-style none;

subnet 192.168.222.0 netmask 255.255.255.0 #GREEN
{
pool {
        range 192.168.222.50 192.168.222.150;
     }
        option subnet-mask 255.255.255.0;
        option domain-name "localdomain";
        option routers 192.168.222.252;
        option domain-name-servers 192.168.222.254, 8.8.8.8;
        option ntp-servers 192.168.222.254;
        default-lease-time 3600;
        max-lease-time 7200;
} #GREEN

subnet 192.168.234.0 netmask 255.255.255.0 #BLUE
{
pool {
        range 192.168.234.100 192.168.234.150;
     }
        option subnet-mask 255.255.255.0;
        option domain-name "localdomain";
        option routers 192.168.234.254;
        option domain-name-servers 192.168.222.252, 8.8.8.8;
        default-lease-time 3600;
        max-lease-time 7200;
} #BLUE

include "/var/ipfire/dhcp/dhcpd.conf.local";

Any ideas?