Hardhat Beetle

The Hardhat Beetle is a relative of the Octorok, and is sometimes also referred to as an Octogon. This enemy does not really attack in most games, instead, it acts as an obstacle.

In Link's Awakening, these could only be knocked into pits, eaten by Bow-Wow, or destroyed with a bomb

In A Link to the Past, the Hardhat Beetle is only found inside the many dungeons of Hyrule. These creatures' outer body is so thick that if Link were to slash them, he would be repelled back. Your best bet is to bounce them into a hole or to blast them away with a Bomb.

There is a minigame in Oracle of Ages that requires you to defeat a few of them in a few seconds.

The blue kind also appeared in Four Swords Adventures, where Link could either knock them into pits to kill them, stun them with the Boomerang and slash them several times, or use the Roc's Feather to jump over them and come down on them with his sword.

In Phantom Hourglass, they appeared again, this time they could not be harmed with a sword. Instead, you would have to smash them with the Hammer, then smash their yellow bellies to kill them.

Strategy
Hardhat Beetles are often immune to damage from the vast majority of Link's weapons. Weapons confirmed to be effective are bombs in Link's Awakening, the ball that can be pulled with the Magnetic Gloves in Oracle of Seasons and the hammer in Phantom Hourglass. Apart from this, the best way to dispose of these creatures is to knock them into a hole, or to use Gale Seeds, depending on the game being played.