The present work introduces the implementation of wave generation and wave absorption of nonlinear, long-crested regular and irregular waves in the WCSPH-based (Weakly Compressible Smoothed Particle Hydrodynamics) DualSPHysics solver. Open boundaries are applied here for both wave generation and absorption. These boundaries consist of buffer zones, on which physical quantities are imposed, or extrapolated from the fluid domain using ghost nodes. Several layers of buffer particles are used to create an inlet and an outlet, where the horizontal component of the orbital velocities, surface elevation and pressure can be imposed from any external source or extrapolated from the fluid domain. This allows the creation of a numerical wave flume with a length of one wavelength. Reflections within the fluid domain are successfully mitigated using a velocity correction term at both inlet and outlet. The implementation is validated with theoretical solutions, in terms of water surface elevation, wave orbital velocities, and dynamic pressure. The model proves to be capable of propagating waves with less than 5% reflection, and RMSE errors on physical quantities lower than 4.3%. The application of open boundaries proves to be an accurate method to generate and absorb non-linear waves within a restricted domain.