LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-03-2008, 02:51 PM   #1
glenn69
Member
 
Registered: Jul 2003
Location: Chicagoland
Distribution: ArchLinux
Posts: 261

Rep: Reputation: 32
How to block ALL websites except 2


I would like to allow access to only 2 webites on my computer.

What is the simplest way to accomplish this?

Thanks
 
Old 09-03-2008, 03:05 PM   #2
w3bd3vil
Senior Member
 
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,189

Rep: Reputation: 49
I think if you play around with OpenDNS you will manage to achieve that in no time.
opendns.com

Just block all networks and then set the two domains you want to always allow on your opendns account.
 
Old 09-03-2008, 03:11 PM   #3
DotHQ
Member
 
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 545

Rep: Reputation: 33
modify /etc/sysconfig/iptables
The following entries allow traffic from the two domains listed.

-A INPUT -s 172.35.111.239 -j ACCEPT
-A INPUT -s 172.35.111.233 -j ACCEPT

Also, use the /etc/hosts.allow and /etc/hosts.deny.
In the hosts.deny file you want to deny all by saying
all:all
The host.allow file migh tlook something like the one below. You need to add your IP's for each of the service you will be runnning. Add the netmask also.
#
# hosts.allow file for App Servers
#
ALL: localhost
in.rshd: 172.35.111.233/255.255.255.224 etc.... for each line.
bpcd:
bpbkar:
portmap:
lockd:
mountd:
rquotad:
statd:
snmpd:
 
Old 09-03-2008, 03:31 PM   #4
glenn69
Member
 
Registered: Jul 2003
Location: Chicagoland
Distribution: ArchLinux
Posts: 261

Original Poster
Rep: Reputation: 32
Quote:
modify /etc/sysconfig/iptables
I do not have a directory named sysconfig. I am using Mepis Antix. Should I make the file?
 
Old 09-03-2008, 03:58 PM   #5
jkzfixme
Member
 
Registered: Sep 2006
Location: Orange County, NY
Distribution: Ubuntu, Solaris, Android
Posts: 329
Blog Entries: 21

Rep: Reputation: 52
I would use a proxy server like squid, wich is also easily administered with webmin

Regards
JKZfixme
 
Old 09-03-2008, 04:13 PM   #6
DotHQ
Member
 
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 545

Rep: Reputation: 33
Quote:
Originally Posted by glenn69 View Post
I do not have a directory named sysconfig. I am using Mepis Antix. Should I make the file?
No, I doubt that would work. The files I mentioned are on the distros I work with. I 'thought' they were pretty universal. I was wrong.

Setting up a proxy sounds like another way to accomplish the task.
 
Old 09-03-2008, 05:24 PM   #7
voger
Member
 
Registered: Oct 2005
Distribution: Arch
Posts: 68

Rep: Reputation: 15
Maybe a stupid idea but how about playing with /etc/hosts.allow and /etc/hosts.deny?
http://www.itc.virginia.edu/unixsys/sec/hosts.html
 
Old 09-21-2015, 07:25 AM   #8
secretlydead
Member
 
Registered: Sep 2003
Location: Qingdao, China
Distribution: mandriva, slack, red flag
Posts: 249

Rep: Reputation: 31
Use dnsmasq. This is a really neat service.

On Debian/Ubuntu/Mint:

Code:
sudo apt-get install dnsmasq
edit /etc/dnsmasq.conf

add this line to make all sites redirect to localhost:

Code:
address=/#/127.0.0.1
add these lines to make specific sites use the DNS server at 8.8.8.8:

Code:
server=/allowed.com/8.8.8.8
then restart the dnsmasq service:

Code:
sudo service dnsmasq restart
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
block ports or websites sujitkale Linux - Server 1 09-23-2007 07:23 AM
Allow only certain websites with squidgaurd and block alll other. karelvdm Linux - Networking 1 08-17-2007 10:26 AM
block certain websites in konqueror rcrummett Linux - Networking 3 12-31-2006 05:29 AM
How to block specific Websites? alfredh SUSE / openSUSE 3 06-24-2006 06:17 AM
how to block websites .. huno Linux - Software 5 04-22-2004 09:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration