The hardware for this is trivial. Just buy some development board which has
- an RJ45 connector with integrated magnetics (Hanrun is a big name)
- a PHY chip (e.g. LAN8742)
- a CPU which can talk to the PHY chip, and has some GPIO pins which can drive whatever...
But that is about 1% of the job. The other 99% is software to make it all work. You need a TCP/IP stack on the CPU; I use LWIP which, like most high-profile open source software, does work but needs a lot of, shall we say, "integration work"
and there is no support anywhere. Then you need an application running on the CPU which interfaces to the TCP/IP module (with LWIP you can use BSD sockets or Netconn APIs). Then you need to spend months or years googling for patches to make it all reliable. Then to get a properly finished product you need to write a user interface for configuration, via USB (VCP and/or MSC and a config file) or via an HTTP server running on your box. You can find HTTP server code all over the place, most of it horribly bloated; I started with one such and after some weeks binned it and wrote my own very simple HTTP server in a week or two.
I've done all this (with a colleague, over past 5 years) and really would not want to do it again, ever. I used a STM32F417 and one could not do it with much less by the time you have a "fully finished" product with the above mentioned user interface etc. If you read the many threads I have started here over the last few years you will get the idea
Now of course it is all "easy", but I am not going to post a useless statement like that here
Yes my box does all the above and much more. So if you had a commercial requirement I could easily knock up a daughter board for it (it has an SPI expansion port) with a bunch of MOSFETs or relays. It powers up, gets an IP via DHCP (or fixed IP) and then you could just send it packets. Or you could buy my box (under $200) and design your own expansion board. It also has four serial ports so you could squirt out strings via those.
STM have various "DISCO" boards and you can use CUBE IDE to generate most of the code, and it may even more or less work at a basic level. I think most micro vendors do a similar thing. But these are just to get you started - beyond flashing an LED they are hard work.
Another much simpler approach which was popular in the early 1990s was to forget TCP/IP and just make a box which receives UDP packets and extracts some bits from them and uses these to drive I/O signals. I used to sell such a thing back then (it was German made). The data was not routable of course, the box had no IP address, just a MAC address which was partly set up on dipswitches. That could probably be done with just the RJ45 and some PHY chip and a simple micro which can talk to the PHY chip using the standard "64 bit UART" interface etc. Or maybe there are PHY chips which are even simpler... This approach might work for you but you could not sell it generally because today everybody wants a TCP/IP product, with all the mod cons like DHCP... it would be a support nightmare because everybody thinks RJ45 = TCP/IP