Showing posts with label IPTable. Show all posts
Showing posts with label IPTable. Show all posts

Sunday, October 5, 2014

easy learn linux command line-part 26

in this season, We will learn how to work with IP Table on the linux OS command line.
you can read more information about IP table here, if you cant know anythings about it.

IPTABLES (firewall)

Command Description
# iptables -t filter -L show all chains of filtering table   
# iptables -t nat -L show all chains of nat table   
# iptables -t filter -F clear all rules from filtering table   
# iptables -t nat -F clear all rules from table nat   
# iptables -t filter -X delete any chains created by user   
# iptables -t filter -A INPUT -p tcp --dport telnet -j ACCEPT allow telnet connections to input   
# iptables -t filter -A OUTPUT -p tcp --dport http -j DROP block HTTP connections to output   
# iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPT allow POP3 connections to forward chain   
# iptables -t filter -A INPUT -j LOG --log-prefix Logging on input chain   
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE configure a PAT (Port Address Traslation) on eth0 masking outbound packets   
# iptables -t nat -A PREROUTING -d 192.168.0.1 -p tcp -m tcp --dport 22 -j DNAT --to-destination 10.0.0.2:22 redirect packets addressed to a host to another host   

Friday, September 12, 2014

آموزش خط فرمان-قسمت بیست و ششم

آموزش خط فرمان در این جلسه به فرمان های مرتبط به IPTable می پردازه.
IPTable یا همون دیوار آتش در سیستم عامل لینوکسی است. کار IPTable مشخص کردن مجوز دسترسی به پورت خاصی از سیستم عامل است. خاموش بودن آی پی تیبل این امکان را به کاربران دیگر می دهد که بدون هیچ گونه کنترلی به سیستم متصل شوند. مبحث IPTable یکی از مباحث مهم در حوزه شبکه است. پیشنهاد می کنیم برای آشنایی با آن منابع ذیل را مطالعه نمایید.

 در این آموزش قصد نداریم شما را یک خبره شبکه نماییم، بلکه می خواهیم با اجرای دستورات عمومی و عمده کار با IPTable را به شما آموزش دهیم. در این آموزش در خصوص اتصال به HTTP، Telnet، POP3 و ... مطالبی آموزش داده می شود.

اگر از این قسمت از آموزش خط فرمان لینوکس لذت بردید، پیشنهاد می کنم قسمت های قبلی را در اینجا ، اینجا و ... مطالعه نمایید.

 














IPTABLES ( دیوار آتش )

دستور توضیح
# iptables -t filter -L تمام زنجیرهای جدول فیلتر شدن را نمایش می دهد   
# iptables -t nat -L تمام زنجیر های جدول nat را نمایش می دهد   
# iptables -t filter -F تمام قوانین و شروط را از جدول فیلتر شدن پاک می‌کند  
# iptables -t nat -F تمام قوانین و شروط را از جدول nat پاک می‌کند  
# iptables -t filter -X هر زنجیری را که توسط کاربر درست شده باشد را پاک می‌کند  
# iptables -t filter -A INPUT -p tcp --dport telnet -j ACCEPT اجازه‌ی اتصالات telnet را به ورودی می‌دهد   
# iptables -t filter -A OUTPUT -p tcp --dport http -j DROP اتصالات HTTP به خروجی را قطع می‌کنند  
# iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPT اجازه‌ی اتصالات POP3 را به زنجیر forward می‌دهد  
# iptables -t filter -A INPUT -j LOG --log-prefix ثبت اتفاقات بروی رشته ی ورودی   
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE پیکربندی PAT بروی بسته های خروجی از eth0   
# iptables -t nat -A PREROUTING -d 192.168.0.1 -p tcp -m tcp --dport 22 -j DNAT --to-destination 10.0.0.2:22 هدایت مجدد بسته های آدرس دهی شده به یک میزبان به میزبان دیگر