Zend certified PHP/Magento developer

Network configuration with two computers directly connected with ethernet

I have to configure a network as the following:

PC1 <-----> AP <:::::> PC2 <-----> PC3

where: <---> is a ethernet cable and <:::> is a wireless connection. PC2 and PC3 are directly connected with an ethernet cable. PC1, PC2 and PC3 are computers running Ubuntu 20.04. AP is an access point connected to Internet. I want to connect PC3 to the internet through PC2, and to access PC3 from PC1. In particular I need that all PCs are in the same network and accessible each others. I’ve tried the option Shared to other computers on PC2 and PC3 so that PC3 can access internet through PC2 but this creates a subnet between the two PCs and PC1 can’t see PC3 (PC1 has a 192.x.x.x and PC2 and PC3 obtain a 10.x.x.x address on the ethernet interface). Also, after doing this, PC2 is unreachable from PC1 although the wireless IP address of PC2 is in the same subnet.

How could I configure the network to make all PCs visible each other, without modifying the topology?

Thank you in advance.