Blocking internet

Last modified:

Going offline

Minimizing escapism is a bit of an obsession. My phone has barely any applications on it. I have almost no social media, and refuse to actively use it. Live in the now. Escapism is a constant battle, and what it is is a matter of perspective.

It can be nice to not use internet during the week unless I had a course to participate in. It is possible to download content you want to learn during the weekend. Tip, try yt-dlp.

Initial findings

I felt more relaxed, well-rested and have less need to use the computer. It seems like a huge improvement. Being bored is great for creativity too.

It is only ideas gained from walking that have any worth.

– Friedrich Nietzsche, Twilight of the Idols

I seem to get more ideas. Nietzsche's quote is good, but I want to expand on it. Good ideas come from engaging in physical activities and when spending time away from the internet or other forms of escapism. That's likely what he meant anyway.


This script is in bash, and should work on most Linux distributions, but I couldn't make it work on NixOS. Currently, I have internet access during weekdays, but I would prefer not to.

# Define day and time periods for blocking
OFFTIME="--weekdays Mon,Tue,Thu"
# Wed = 3D modeling
# Fri = Drawing

# Submit rules - it does not hurt to block input as well
sudo iptables -A INPUT -p all --match time $OFFTIME  -j DROP
sudo iptables -A OUTPUT -p all --match time $OFFTIME -j DROP

# Review the rules just added
# sudo iptables -L | grep -P -A2 '.+policy.+'

# Save rules (reboot is NOT required)
sudo iptables-save | sudo tee /etc/iptables.rules >/dev/null
echo 'iptables-restore < /etc/iptables.rules' | sudo tee -a /etc/rc.local >/dev/null

# Remove all rules
# sudo iptables -F
# sudo rm /etc/iptables.rules && sudo rm /etc/rc.local


I made a block internet script for Windows. You can find it here for the people who may be interested in using something similar.

# Network-Blocker.ps1
# Friday is drawing class, so not much time for internet anyways
$DaysToBlock = @("Monday", "Tuesday", "Wednesday", "Thursday")

If ((Get-Date | Select DayOfWeek).DayOfWeek -in $DaysToBlock) {
   Disable-NetAdapter -Name "*" -Confirm:$False
} Else {
   Enable-NetAdapter -Name "*" -Confirm:$False

It is possible to execute it on startup by running the following PowerShell code:

# $env:Temp gave me a shortened incorrect path, so I use the dotnet variant
$NetworkBlockerPath = "$env:UserProfile\Documents\PowerShell\Functions\Network-Blocker.ps1"
New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "Network-Blocker" -Value "$NetworkBlockerPath" -ExecutionPolicy Unrestricted -WindowStyle Hidden >> `"$([System.IO.Path]::GetTempPath())StartupLog.txt`""


Diaspora X Facebook LinkedIn