Suggested iptables configuration for Ubuntu 14.04 LTS

- I want to allow incoming connections from my office IP to any port
- I want to allow port 80 access to the public
- I do not need any outbound filtering at this point
- My DNS is handled externally
- My incoming mail is handled externally

When I set this up (via webmin) .. I am unable to ping out and start having outgoing connection problems...

Can someone suggest a ruleset and also how to make the rules persistent? (it seems when I restart--the default policy changes back to accept leaving the server wide-opened.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The following is assuming you are starting with a blank rule set (if you need to flush all rules before you start you can do "iptables -F")

Allow incoming connections from your office on any port:

sudo ptables -I INPUT -p tcp -s <OFFICE IP> -j ACCEPT

Allow port 80 access from ALL:

sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT

Allow established/related connections (this is needed so you can surf the web, do dns queries, fetch mail, etc..)

sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

Allow loopback (this is a good idea)

sudo iptables -A INPUT -i lo -j ACCEPT

Set the default INPUT policy to DENY all other inbound traffic:

sudo iptables -P INPUT DROP

Save iptables:

sudo iptables-save > /etc/network/iptables.rules

or install iptables-persistant like so:

sudo apt-get install iptables-persistent

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MarkProgrammerAuthor Commented:
Thank you
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.