Federal health officials directed 21 websites Tuesday to stop selling what regulators say are illegal, "potentially dangerous, unapproved and misbranded" opioids online.

The Food and Drug Administration has taken action against more than 70 websites selling various versions of opioid drugs, including tramdol, so far this summer. Some of the drugs they're selling are actually a dangerous form of pressed fentanyl, the FDA said.

"As we see doctors prescribe fewer opioids, we're fearful that more and more of the new addiction is going to shift to illicit sources, and a lot of those illicit sales are taking place online," FDA Commissioner Scott Gottlieb told CNBC's "Squawk Box" on Tuesday.

The four businesses targeted Tuesday — CoinRX, MedInc.biz, PharmacyAffiliates.org and PharmaMedics — operate the 21 websites. This summer, the FDA has now cracked down on more than 70 websites illegally selling opioids, some of which aren't even the product they claim they are and are instead pressed fentanyl.

Prescription painkillers are thought to have contributed to the deadly opioid epidemic ripping across the nation. Some people transitioned to deadly illegal drugs like heroin and fentanyl. Others, who still need opioids to treat chronic pain, may struggle to have prescriptions filled because doctors are fearful to write them.

Earlier this summer, the FDA convened tech companies, including Facebook and Google to find ways to curb sales on their sites. Gottlieb said the agency wants to work with these "legitimate" sites to attack the problem.