snow2k14
Posts: 1
Joined: Tue Mar 11, 2014 8:24 pm

Block complete internet access | Only use local area network

Tue Mar 11, 2014 8:27 pm

Hi guys,

what is the most elegant way to only use the raspberry pi in the local network.

For now i blocked all outgoing ports on my router but i don't think this is the best way to do it.

I am running NOOB's Rasbian OS.

Thanks in advance.

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Block complete internet access | Only use local area net

Tue Mar 11, 2014 11:36 pm

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

ripat
Posts: 191
Joined: Tue Jul 31, 2012 11:51 am
Location: Belgium

Re: Block complete internet access | Only use local area net

Wed Mar 12, 2014 7:16 am

snow2k14 wrote:what is the most elegant way to only use the raspberry pi in the local network.
Do you mean to completely isolate the Pi inside its own lan? With no access to the internet?
Using Linux command line usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Block complete internet access | Only use local area net

Wed Mar 12, 2014 9:21 am

It's not 'elegant', but removing the default route (gateway) from the RPi network configuration would surely fix it.
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

User avatar
iinnovations
Posts: 621
Joined: Thu Jun 06, 2013 5:17 pm

Re: Block complete internet access | Only use local area net

Wed Mar 12, 2014 2:45 pm

The op is a bit ambiguous. Do you mean the Pi has its own LAN as an access point , or that it is a member of the LAN that your home gateway administers? I am going to assume the latter.

In any case I echo the reco for iptables and/or ufw, but unless you route traffic TO your Pi intentionally from your router via DMZ or port forwarding, only other members of the LAN can see it, i.e. no WAN inbound traffic (except responses to your http requests, etc). Now if you want to block all outbound traffic (visibility to WAN FROM the Pi), follow the advice above and use ufw to restrict all traffic to your local subnet, e.g. 192.168.1.1/24 or whatever your subnet is. I personally don't see the need for this, and you won't get updates, etc., but you know your usage better than I.

Colin
CuPID Controls :: Open Source browser-based sensor and device control
interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com

Tarcas
Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Block complete internet access | Only use local area net

Wed Mar 12, 2014 5:43 pm

There are a number of ways to allow only access on your local network.
1) Remove the router as a gateway from the Pi. This is probably the easiest.The Pi can still talk to the router, it just won't know where to send traffic that needs to be routed.
2) Configure a firewall in your router to block all ports to and from the destination IP. Still easy.
3) Set up IPTables on the Pi and configure it to allow all traffic destined for the local network and drop all other traffic. Definitely the hardest, but most customizable later (block traffic to other specific hosts or ports on the LAN, allow certain ports and/or destinations on the global Internet, etc.)
As for which is the most elegant... well, I suppose that's in the eye of the beholder. If simple is important to you, go with option 1 or 2. If configurability is more important to you, work toward #3. It'll take some homework.

femindharamshi10
Posts: 102
Joined: Thu Jan 07, 2016 1:28 pm

Re: Block complete internet access | Only use local area net

Wed Apr 06, 2016 3:40 pm

this wont allow pi to use internet ?

femindharamshi10
Posts: 102
Joined: Thu Jan 07, 2016 1:28 pm

Re: Block complete internet access | Only use local area net

Wed Apr 06, 2016 3:40 pm

ripat wrote:
snow2k14 wrote:what is the most elegant way to only use the raspberry pi in the local network.
Do you mean to completely isolate the Pi inside its own lan? With no access to the internet?
yes i want to do this !

User avatar
B.Goode
Posts: 10191
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Block complete internet access | Only use local area net

Wed Apr 06, 2016 5:26 pm

Two people have suggested simply removing the 'default route' or 'gateway' from the network configuration.

Is there some reason why that solution is not acceptable?

femindharamshi10
Posts: 102
Joined: Thu Jan 07, 2016 1:28 pm

Re: Block complete internet access | Only use local area net

Thu Apr 07, 2016 5:19 pm

B.Goode wrote:Two people have suggested simply removing the 'default route' or 'gateway' from the network configuration.

Is there some reason why that solution is not acceptable?
i have set it dchp...so how ?

gman98
Posts: 29
Joined: Sat Jan 02, 2016 4:28 pm

Re: Block complete internet access | Only use local area net

Thu Apr 07, 2016 6:28 pm

femindharamshi10 wrote:
B.Goode wrote:Two people have suggested simply removing the 'default route' or 'gateway' from the network configuration.

Is there some reason why that solution is not acceptable?
i have set it dchp...so how ?
Choose an ip address outside of your routers DHCP scope range and change your PI network config to static but do not include the default gateway (the ip address of the router)

femindharamshi10
Posts: 102
Joined: Thu Jan 07, 2016 1:28 pm

Re: Block complete internet access | Only use local area net

Fri Apr 08, 2016 4:27 pm

gman98 wrote:
femindharamshi10 wrote:
B.Goode wrote:Two people have suggested simply removing the 'default route' or 'gateway' from the network configuration.

Is there some reason why that solution is not acceptable?
i have set it dchp...so how ?
Choose an ip address outside of your routers DHCP scope range and change your PI network config to static but do not include the default gateway (the ip address of the router)
i want it to be DHCP and not static

User avatar
B.Goode
Posts: 10191
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Block complete internet access | Only use local area net

Fri Apr 08, 2016 4:47 pm

Are you in control of the dhcp server for your network?

If not, it is difficult to see how to implement this in the way you hope.

If you have admin access to the dhcp server, modify the configuration data returned to your RPi to omit the gateway information.

gman98
Posts: 29
Joined: Sat Jan 02, 2016 4:28 pm

Re: Block complete internet access | Only use local area net

Fri Apr 08, 2016 6:44 pm

femindharamshi10 wrote:
i want it to be DHCP and not static
Why?

I doubt you'll be able to stop the DHCP server giving out a default gateway (which is what you want in your set-up)

What is wrong with static?

User avatar
DougieLawson
Posts: 38883
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Block complete internet access | Only use local area net

Sat Apr 09, 2016 2:39 pm

femindharamshi10 wrote:
this wont allow pi to use internet ?
If you use UFW to block inbound and outbound connections it is effectively disabled with iptables rules. It's also easy to get running again with sudo ufw disable to disable the firewall and remove all iptables rules. The interface can remain active.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Beginners”