I've been a W2 contractor for years. The contract is really between the consulting firm and the client. I've had a 401k through the consulting firm for a number of years.
As of the beginning of the year, I switched over to 1099 consulting, primarily for the 401k advantage. My Fidelity solo 401k should be set up now, so I'll be able to contribute $15,500 plus 25% of my salary there. Of course, my firm still needs to pay me for January before I run my first payroll anyhow...
There isn't much you can do if you are a W-2 consultant, except try to convince whoever is writing your paychecks to start up a 401k plan.