Linode Forum
https://forum.linode.com/

Will this block access to all but the specified IP address?
https://forum.linode.com/viewtopic.php?f=19&t=11429
Page 1 of 1

Author:  John Henry Eden [ Tue Nov 18, 2014 4:58 pm ]
Post subject:  Will this block access to all but the specified IP address?

I have a linode for running vulnerable websites and services for testing. I have set iptables to require use of a proxy linode to access the linode.

Will this restrict all access to the linode to the one IP address?

Code:
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -d 127.0.0.0/8 -j REJECT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -j ACCEPT

iptables -A INPUT -s 173.255.192.138 -j ACCEPT

iptables -A INPUT -j DROP
iptables -A FORWARD -j DROP

Author:  masonm [ Tue Nov 18, 2014 7:03 pm ]
Post subject:  Re: Will this block access to all but the specified IP addre

That depends on what rules existed in the INPUT chain before those commands are executed. The "iptables -A" command appends the rule to the given chain, so rules that existed earlier will be processed first. Remember that iptables rules are processed sequentially, so order matters.

Run "iptables -L -n" to get a complete dump of all chains and post the result here.

Oh, and you should always test using "nmap <ip_here>" from both 173.255.192.138 and an external IP to ensure it actually works.

Author:  John Henry Eden [ Tue Nov 18, 2014 11:23 pm ]
Post subject:  Re: Will this block access to all but the specified IP addre

I'm using nmap from another linode, and it seems to think it is down. Sounds like it's working.

Page 1 of 1 All times are UTC-04:00
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/