For this you will actually need a program that listens on these ports, whatever it might do with incoming data (probably either echo it back or discard it).
You could use netcat as a very simple "server" to listen on any ports you specified, however you would need one netcat instance per port, which might be quite costly if you want to cover all 2^16 possible ports:
netcat -lp <port> </dev/null >/dev/null 2>&1
This would start a netcat to listen on the specified
<port>, which would discard all incoming traffic - but never terminates the connection by itself. Add the
-z flag to the command to instantly terminate any connections. Take a look at
netcat --help or
info netcat for more options.
A possible alternative would be a simple C program which would iterate over all ports that you want covered, open a listening socket on it and do whatever you want with them once a connection comes in; however as I'm not into socket programming right now, I can't give you a more specific example or source code. If you are interested in this solution, look at the man pages
accept etc. in section 2, they already have some examples which you could use.