Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
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.
I can only send mail but cannot receive mail when I enabled the firewall. If I disable the firewall, I can send and receive mail.
The mail server and the firewall are on the same machine.
Any problem with the rules?
The script for the firewall is as follows:
#!/bin/bash
############
# VAIABLES #
############
# UPLINK - interface connect to the internet
UPLINK="eth1"
INTERNALNET="10.0.0/16"
# all network interfaces
INTERFACES="lo eth0 eth1"
# Flood variables
# Overall limit for TCP-SYN-Flood detection
TCPSYNLIMIT="5/s"
# Burst limit for TCP-SYN-Flood detection
TCPSYNLIMITBURST="10"
# Overall limit for logging in logging-chain
LOGLIMIT="2/s"
# Burst limit for logging in logging-chain
LOGLIMITBURST="10"
# Overall limit for Ping-flood-detection
PINGLIMIT="5/s"
PINGLIMITBURST="10"
case "$1" in
stop)
echo "Shutting down firewall..."
# clear and reset all chains
iptables -F
iptables -F -t mangle
iptables -F -t nat
iptables -X
iptables -X -t mangle
iptables -X -t nat
# explicitly disable ECN
if [ -e /proc/sys/net/ipv4/tcp_ecn ]
then
echo 0 > /proc/sys/net/ipv4/tcp_ecn
fi
###############
# INPUT_CHAIN #
###############
# kill invalid packets (illegal combinations of flag)
iptables -A INPUT -j DROP -m state --state INVALID
# allow all connections on the internal interfaces
iptables -A INPUT -j ACCEPT -i ! ${UPLINK}
# block all connections except initiated from the protected network
iptables -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED
iptables -A INPUT -j ACCEPT -m state --state NEW -i ! ${UPLINK}
# kill all connection to the local interface from the outside world
#iptables -A INPUT -j REJECT -d 127.0.0.0/8
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.