The Short Answer
Check the coding on the computer’s port first. A D-coded port needs a D-coded M12 to RJ45 cable, and an X-coded port needs an X-coded one; they are not interchangeable, and a D-coded cable cannot carry Gigabit Ethernet.
-
//
D-coded, 4 pins M12 pins 1 and 3 are one pair (RJ45 pins 1 and 2); M12 pins 2 and 4 the other (RJ45 pins 3 and 6).
-
//
X-coded, 8 pins Four twisted pairs to all eight RJ45 pins, for 1 Gbit/s and 10 Gbit/s.
-
//
PoE Power over Ethernet runs over M12 as well as RJ45, if the cable is rated for it.
Keep the Seal Where It Matters
Put the M12 end on the rugged device and run the RJ45 end back to a switch in a dry cabinet. That keeps the sealed, vibration-proof connection at the equipment and the standard connector where the environment is controlled. Our guide to M12 connectors explains D and X coding in more detail.