Well, first you want to purchase a router with an integrated 4 port switch. Something like the Linksys BEFSR41 (Newegg.com - LINKSYS BEFSR41 10/100Mbps EtherFast Cable/DSL Router with 4-Port Switch 1 x 10/100Mbps WAN Ports 4 x 10/100Mbps LAN Ports - Wired Routers
You will then plug your internet connection into the WAN port on the router, and you will plug your P4 system into 1 of the switch ports on the router.
You will also have to get a network card for the P2 system since it didn't mention having one. Something like this Intel 10/100 card would work just fine (Newegg.com - Intel PWLA8391GT 10/ 100/ 1000Mbps PCI PRO/1000 GT Desktop Adapter 1 x RJ45 - Network Interface Cards
). Then you will take a network cable and connect the P2 to an available switch port on the router.
From the P4 machine, you would share the printer. From the P2 machine, you would connect to the P4 machine and click on the printer to map it to your machine.
I went with a wired router rather than a wireless router because it saves a couple of bucks and keeps everything secure...and with this old hardware...it doesn't seem like wireless is necessary.
I went with the Intel card because Intel makes good cards with good driver support and compatibility.
Hope that helps.