Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed Feb 27, 2013 4:14 pm 
Offline
Senior Member

Joined: Thu Nov 19, 2009 4:55 pm
Posts: 52
Have a staging server.

Want to disallow all connections to the server unless connecting from a specific ip(s).

Any example of how to do this? And would I just append it to the end of my iptables file or no? I have current rules in there now that were automatic and something with fail2ban as well.


Top
   
PostPosted: Wed Feb 27, 2013 4:21 pm 
Offline
Junior Member

Joined: Wed Mar 28, 2012 4:29 pm
Posts: 38
I googled your question verbatim and this was the 2nd result:

http://serverfault.com/questions/161401 ... h-iptables

The order of your rules depend strictly on which order you want them processed. Being an IP filter, it can go at the beginning.

Let me know if I can help you more.


Top
   
PostPosted: Wed Feb 27, 2013 4:27 pm 
Offline
Senior Member

Joined: Thu Nov 19, 2009 4:55 pm
Posts: 52
So at the beginning I have to do something like:

iptables -A INPUT -i eth1 -s 10.50.0.0/16 -j ACCEPT


Ok.

#1 how do I know what goes after -i (the eth1 part). How do I know if it's eth1 or eth0?

-s can be a straight ip without subnet?

That's all I need?


Top
   
PostPosted: Wed Feb 27, 2013 4:32 pm 
Offline
Junior Member

Joined: Wed Mar 28, 2012 4:29 pm
Posts: 38
arachn1d wrote:
So at the beginning I have to do something like:

iptables -A INPUT -i eth1 -s 10.50.0.0/16 -j ACCEPT


Ok.

#1 how do I know what goes after -i (the eth1 part). How do I know if it's eth1 or eth0?

-s can be a straight ip without subnet?

That's all I need?


If you look at the iptables manual you will find -i and -s in the PARAMETERS section. It should explain how these two options work in detail.

You can use "ip link" to list the interfaces on your server and find out which one should be added after -i.


Top
   
PostPosted: Wed Feb 27, 2013 7:49 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
If you're going to open up /16 ranges - why bother locking it down?

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
PostPosted: Mon Mar 04, 2013 7:05 pm 
Offline
Senior Member

Joined: Thu Nov 19, 2009 4:55 pm
Posts: 52
I only want to allow one ip but I can't seem to figure it out. :(


Top
   
PostPosted: Mon Mar 04, 2013 7:30 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
If you want step by step, it'd help if you told people what Distro you're using.

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group