Choose style:

Author Topic: How to block my computer to access some IP? [SOLVED]  (Read 437 times)

0 Members and 1 Guest are viewing this topic.

Offline neggard

  • nOOb
  • *
  • Posts: 24
  • Karma: 1
  • New Forum User
    • View Profile
  • Peppermint version(s): 9
How to block my computer to access some IP? [SOLVED]
« on: July 14, 2018, 06:11:25 am »
Hello.
I want to block access to some IP for my computers.

I don't want any computer on my LAN to be able to access this public IP-range.
146.66.156.0-146.66.156.255
146.66.157.0-146.66.157.255
185.25.180.0-185.25.180.255
185.25.181.0-185.25.181.255
How could this be made?

I have looked at the firewall GUI but dont thinnk it can be done from that.
« Last Edit: July 14, 2018, 01:19:27 pm by zebedeeboss »

Online PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 22493
  • Karma: 2511
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R and 9
Re: How to block my computer to access some IP?
« Reply #1 on: July 14, 2018, 10:51:48 am »
Hi neggard, and welcome to the forum.

You can use iptables rules to drop outbound packets to those 24bit (0-255) IP ranges
Code: [Select]
sudo iptables -A OUTPUT -d 146.66.156.0/24 -j DROP
sudo iptables -A OUTPUT -d 146.66.157.0/24 -j DROP
sudo iptables -A OUTPUT -d 185.25.180.0/24 -j DROP
sudo iptables -A OUTPUT -d 185.25.181.0/24 -j DROP
You can remove these with:
Code: [Select]
sudo iptables -D OUTPUT -d 146.66.156.0/24 -j DROP
sudo iptables -D OUTPUT -d 146.66.157.0/24 -j DROP
sudo iptables -D OUTPUT -d 185.25.180.0/24 -j DROP
sudo iptables -D OUTPUT -d 185.25.181.0/24 -j DROP
and you can list the iptables rules at any time with
Code: [Select]
sudo iptables -L
Are people playing Valve/Steam games when they shouldn't ?
« Last Edit: July 14, 2018, 11:40:28 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline neggard

  • nOOb
  • *
  • Posts: 24
  • Karma: 1
  • New Forum User
    • View Profile
  • Peppermint version(s): 9
Re: How to block my computer to access some IP?
« Reply #2 on: July 14, 2018, 12:52:52 pm »
Thanks, I gonna love this forum.
Just look at the  good answer.

I have just change to Peppermint after some other tries, linuxmint, manjaro, antergos.
As a Linux gamer finding Peppermint I am in heaven.
For the first time ever in a distro Nvida driver found out my screen was 144Hz.

This is a long term relationship.

Thanks for the answer and OS.

Online PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 22493
  • Karma: 2511
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R and 9
Re: How to block my computer to access some IP?
« Reply #3 on: July 14, 2018, 01:05:14 pm »
You're most welcome neggard, happy to have you as a member of our friendly little community :)
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline zebedeeboss

  • Global Moderator
  • Hero
  • *****
  • Posts: 2604
  • Karma: 506
  • Life first... Peppermint a close 2nd :)
    • View Profile
  • Peppermint version(s): Peppermint 9 x64
Re: How to block my computer to access some IP? [SOLVED]
« Reply #4 on: July 14, 2018, 01:21:29 pm »
Hello neggard,

Welcome to the Forums and glad you like Peppermint OS

I have done it for you this time but if you consider a Topic answered, please modify the original Question as [SOLVED] on the subject line

Regards Zeb...
Be Kind Whenever Possible...   It is Always Possible - Dalai Lama

Linux User #565092
P9 x64 Desktop - i7-6700K @ 4.00GHz - 32Gb RAM - NVIDIA GTX1070ti 8Gb - 2 x 27" 4k 3840x2160 - 1 x 34" 3440 x 1440
x64 Laptop - i7-7700HQ @ 2.80GHz - 8Gb RAM - Nvidia GTX1050 4Gb - 15.6" HD 1920x1080

Offline neggard

  • nOOb
  • *
  • Posts: 24
  • Karma: 1
  • New Forum User
    • View Profile
  • Peppermint version(s): 9
Re: How to block my computer to access some IP? [SOLVED]
« Reply #5 on: July 14, 2018, 05:59:18 pm »
zebedeeboss Yes I will do it in the future.
Helps peeople find a sulution faster.

Offline neggard

  • nOOb
  • *
  • Posts: 24
  • Karma: 1
  • New Forum User
    • View Profile
  • Peppermint version(s): 9
Re: How to block my computer to access some IP? [SOLVED]
« Reply #6 on: July 18, 2018, 08:58:58 am »
Code: [Select]
sudo iptables -A OUTPUT -d 103.28.54.0/24 -j DROP
sudo iptables -A OUTPUT -d 103.28.55.0/24 -j DROP
sudo iptables -A OUTPUT -d 146.66.152.0/24 -j DROP
sudo iptables -A OUTPUT -d 146.66.153.0/24 -j DROP
sudo iptables -A OUTPUT -d 146.66.158.0/24 -j DROP
sudo iptables -A OUTPUT -d 146.66.159.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.224.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.225.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.227.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.228.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.229.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.231.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.232.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.233.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.234.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.238.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.240.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.241.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.244.0/24 -j DROP
sudo iptables -A OUTPUT -d 155.133.247.0/24 -j DROP
sudo iptables -A OUTPUT -d 162.254.194.0/24 -j DROP
sudo iptables -A OUTPUT -d 190.216.121.0/24 -j DROP
sudo iptables -A OUTPUT -d 192.69.96.0/24 -j DROP
sudo iptables -A OUTPUT -d 192.69.97.0/24 -j DROP
sudo iptables -A OUTPUT -d 208.78.164.0/24 -j DROP
sudo iptables -A OUTPUT -d 208.78.165.0/24 -j DROP
sudo iptables -A OUTPUT -d 208.78.167.0/24 -j DROP
sudo iptables -A OUTPUT -d 45.121.184.0/24 -j DROP
sudo iptables -A OUTPUT -d 45.121.186.0/24 -j DROP
sudo iptables -A OUTPUT -d 45.121.187.0/24 -j DROP

This is all the IP i prevent.
Now just Swedish servers are left. Should try this tonight.

But when I see them with sudo iptables -L
are they active and working or do I need to start some service?

Online PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 22493
  • Karma: 2511
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R and 9
Re: How to block my computer to access some IP? [SOLVED]
« Reply #7 on: July 18, 2018, 04:20:55 pm »
iptables rules are always active.

Test them .. try pinging any IP in the range.
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec