iptables rules and lan network

Asked by Kise A.

Hello,

first please excuse my bad English writing skills!

I have a problem with iptables, i want to setup rules for my local server in a way that little weird please bear with me on it and any help will be appreciated

here is what i want to do but unfortunately i couldn't do myself

I want to allow access to my local server from LAN users only, and i also want to disable my server from making any communication to outside world and allow the server only to talk to the same LAN users, and i also want to allow the server to speak with one website

i treid to use these rules but no luck :(
# allow local access
iptables -A INPUT -s 127.0.0.1/32 -p tcp -j ACCEPT
iptables -A INPUT -s 192.168.1.0/25 -p tcp -j ACCEPT
iptables -A OUTPUT -s 192.168.1.0/25 -p tcp -j ACCEPT

# outside lan network server:
iptables -A OUTPUT -s 62.215.102.22 -p tcp -j ACCEPT

# deny everything else
iptables -A INPUT -p tcp -j DROP
iptables -A INPUT -p udp -j DROP
iptables -A OUTPUT -p tcp -j DROP
iptables -A OUTPUT -p udp -j DROP

any help will be appreciated

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Ryan Dwyer (ryandwyer) said :
#1

You could configure it to use a static IP with an incorrect gateway address if it didn't have to access ONE website. Maybe you could do that but use another machine in the LAN as a proxy?

Revision history for this message
Kise A. (wowkise) said :
#2

Dear Ryan Dwyer,

thank you for your reply, your help appreciated, i need to access the website to download backups of some sort, that's why i cant disable the internet as whole, I'm using your method right now, but I'll have to change it manually everyday to download backups, i prefer if its to do it with iptables or CSF

anyway your help is appreciated

Revision history for this message
Ryan Dwyer (ryandwyer) said :
#3

You could get another computer on the network to download the backups, then transfer them to the server.

Can you help with this problem?

Provide an answer of your own, or ask Kise A. for more information if necessary.

To post a message you must log in.