Hi,
Process.
On the iPhone in Settings the Messages app is turned ON.
This allows it so send iMessages
If you also set the Allow SMS it does that as well and will send as SMS if the other end appears not to be registered with iMessages.
This means the iPhone is send and receiving only with the iPhone Number.
Next you would turn on the Mac version by adding An Apple ID to the iMessages account in the Messages app.
This can then Send and Receive using the Apple ID only.
Then you add the Apple ID to the iPhone.
It can then "sync" (really Display on all Devices) the iMessages sent to either the iPhone Number or the Apple ID from that point in time onwards.
A Pop up on the Mac appears telling you what the iPhone Is using and Accepting it adds the iPhone Number to the Alternatives list in iMessages account on the Mac.
These iMessages are "synced" through the iMessages Server (nothing to do with iCloud)
The next step, if your iPhone and Mac can do it, is to be on the Same LAN for Text Forwarding.
The iPhone needs the WiFi to be on and to join your LAN (the Mac can be WiFi or Ethernet to the LAN)
Then you can enable Text Forwarding and the Code number should appear on the Mac that then needs adding back to the iPhone.
Resetting this bit can need several goes before the two devices forget their original "pairing".
This works over your LAN connection.
Basically the iPhone is "Sharing" it's SMS connection over the carrier service the iPhone is getting.
Things to check
In Settings > Messages on the iPhone cech the Send and Receive section.
The Number needs to be ticked (Active) and greyed out (the User cannot change this although it sometimes fails)
if it is Unticked then the Number can be de-registered from the iMessages servers.
If this is the case then turn the App Off and wait fro a few minutes before turning it back on.
Now Wait until the Number has Verified.
Once it has done that you can reset all the other settings (Apple ID, Text Forwarding)
If the Number is effectively Off on the iPhone then many aspects of Messages do not work.

8:55 pm Tuesday; May 10, 2016
iMac 2.5Ghz i5 2011 (El Capitan)
G4/1GhzDual MDD (Leopard 10.5.8)
MacBookPro 2Gb (Snow Leopard 10.6.8)
Mac OS X (10.6.8),
iPhone and an iPad (2)