Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Sanity check... My machine is sitting behind a router that forwards all HTTP,HTTPS,and SSH requests to my server. I'm also running a MySQL database, CUPS, and SENDMAIL but those work locally on the server so there is no need for the router to forward those requests. Because these services are working locally I don't think it is necessary to define them in the "TCP rules" section below. I need a good pair of eyes to look at this one since I am an iptables newbie. Also what is the difference between iptables and ip6tables?
# IPTables Script
# (1) Policies (default)
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
# (2) User-Defined chain for ACCEPTed TCP packets
iptables -N okay
iptables -A okay -p TCP --syn -j ACCEPT
iptables -A okay -p TCP -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A okay -p TCP -j DROP
# (3) INPUT chain rules
# Rules for incoming packets from the LAN
iptables -A INPUT -p ALL -i eth0 -s 192.168.0.0/8 -j ACCEPT
# Packets for established connections
iptables -A INPUT -p ALL -d 192.168.0.100 -m state --state ESTABLISHED,RELATED -j ACCEPT
# (4) OUTPUT chain rules
# Only output packets with local addresses (no spoofing)
iptables -A OUTPUT -p ALL -s 127.0.0.1 -j ACCEPT
iptables -A OUTPUT -p ALL -s 192.168.0.100 -j ACCEPT
iptables -A OUTPUT -p ALL -s 68.46.153.117 -j ACCEPT
1) Your router is on the network 192.168.0.0/8, so by accepting all traffic from that network, you are accepting all traffic from the router also and hence, all traffic from the internet. This of course assumes your router is on eth0.
Well the routers public IP address is the one given to me by my ISP. Its something like 68.46.34.129 . From the LAN the routers IP is 192.168.0.1 . I see what you are saying. Isn't this how I want it setup though. It does allow everything from the router in but then it runs through the rest of the rules doesn't it check to make sure that they are valid requests to the server?
Okay I found a new problem with these iptables rules. For some reason I am unable to print while these rules are in effect. I have opened port 631 (IPP). I use CUPS for printing.
Does CUPS use UDP packets? I'm sure I'm missing something very simple here.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.