Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
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 created a gateway using iptables. My trusted LAN is eth1 (10.0.1.0/24) and DMZ is eth2 (10.4.0.0/24). My ip address is 10.0.1.156. I'm bypassing restriction and squid rules here. I can access the Internet. My question is how could I access those server on 10.4.0.0/24 network. The server can ping 10.4.0.0/24 but the client cannot ping nor access 10.4.0.0/24 network. I tried to command "iptables -I FORWARD -i eth1 -o eth2 -p tcp -s 10.0.1.0/24 -d 10.4.0.0/24 -j ACCEPT" but still I cannot access 10.4.0.0/24 network. I believe its only on FORWARD options its just that I think I'm just using a wrong options here.
NOTE: 1.2.3.4 is the public ip address provided by the ISP
Quote:
/sbin/iptables -F INPUT
/sbin/iptables -F OUTPUT
/sbin/iptables -P INPUT DROP
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -F FORWARD
/sbin/iptables -F -t nat
/sbin/iptables -P FORWARD DROP
/sbin/iptables -A FORWARD -i eth1 -j ACCEPT
/sbin/iptables -A INPUT -i eth1 -j ACCEPT
/sbin/iptables -A OUTPUT -o eth1 -j ACCEPT
/sbin/iptables -A FORWARD -i eth2 -j ACCEPT
/sbin/iptables -A INPUT -i eth2 -j ACCEPT
/sbin/iptables -A OUTPUT -o eth2 -j ACCEPT
/sbin/iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -t nat -A POSTROUTING -s 0.0.0.0/0 -o eth0 -j SNAT --to-source 1.2.3.4
/sbin/iptables -A INPUT -i lo -j ACCEPT
/sbin/iptables -A OUTPUT -o lo -j ACCEPT
/sbin/iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -I FORWARD -i eth1 -p tcp -m multiport --dport 0:79 -j REJECT
/sbin/iptables -I FORWARD -i eth1 -p tcp -m multiport --dport 81:65535 -j REJECT
/sbin/iptables -I FORWARD -p TCP -i eth1 -s 10.0.1.156 -j ACCEPT
/sbin/iptables -A OUTPUT -p icmp -m state --state NEW -j ACCEPT
/sbin/iptables -A INPUT -p icmp -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/iptables -A INPUT -p icmp --icmp-type echo-request -m limit --limit 1/s -i eth0 -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 8080
/sbin/iptables -t nat -I PREROUTING -i eth1 -p tcp -s 10.0.1.156 --dport 80 -j ACCEPT
/sbin/iptables -A INPUT -p tcp --dport 3500 -j ACCEPT
/sbin/iptables -A FORWARD -i eth0 -p tcp --dport 8080 -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -i eth0 -p tcp -d 1.2.3.4 --dport 80 -j DNAT --to-destination 10.0.1.122:8080
/sbin/iptables -A INPUT -i eth0 -p tcp -m limit --limit 1/s --dport 0:65535 -j LOG --log-prefix "tcp connection: "
/sbin/iptables -A INPUT -i eth0 -p udp -m limit --limit 1/s --dport 0:65535 -j LOG --log-prefix "udp connection: "
/sbin/iptables -A INPUT -i eth0 -p tcp --dport 0:65535 -j DROP
/sbin/iptables -A INPUT -i eth0 -p udp --dport 0:65535 -j DROP
I tried to command "iptables -I FORWARD -i eth1 -o eth2 -p tcp -s 10.0.1.0/24 -d 10.4.0.0/24 -j ACCEPT" but still I cannot access 10.4.0.0/24 network. I believe its only on FORWARD options its just that I think I'm just using a wrong options here.
Actually, that command seems okay (as in, it pretty much matches what you've said you want to do).
Did you create an appropriate POSTROUTING rule when you did this? Something like:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.