Blogger Tricks - Once the network has worked perfectly, the next step is to create a firewall rule to allow us to monitor statistics or total internet bandwidth usage by the local network based on service
The first step in making a firewall rule is to create a new chain with the name "DOWNLOAD" and "UPLOAD" as follows:
# Iptables - N DOWNLOAD
# Iptables - N UPLOAD
# Iptables - nL
After defining the new chain, further defining the next rule FORWARD firewall to classify traffic into traffic UPLOAD and DOWNLOAD. Steps were as follows:
# Iptables-A FORWARD-s 192.168.0.0/24-o eth0-j UPLOAD
# Iptables-A FORWARD-d 192.168.0.0/24-i eth0-j DOWNLOAD
Next create a firewall rule-rule to match traffic UPLOAD and DOWNLOAD to service HTTP, SMTP, POP3, DNS, and SSH, as follows:
# Iptables-A UPLOAD-p tcp-s 192.168.0.0/24-dport 80
# Iptables-A UPLOAD-p tcp-s 192.168.0.0/24-dport 25
# Iptables-A UPLOAD-p tcp-s 192.168.0.0/24-dport 110
# Iptables-A UPLOAD-p tcp-s 192.168.0.0/24-dport 53
# Iptables-A UPLOAD-p udp-s 192.168.0.0/24-dport 53
# Iptables-A UPLOAD-p tcp-s 192.168.0.0/24-dport 22
# Iptables-A DOWNLOAD-p tcp-d 192.168.0.0/24-dport 80
# Iptables-A DOWNLOAD-p tcp-d 192.168.0.0/24-dport 25
# Iptables-A DOWNLOAD-p tcp-d 192.168.0.0/24-dport 110
# Iptables-A DOWNLOAD-p tcp-d 192.168.0.0/24-dport 53
# Iptables-A DOWNLOAD-p udp-d 192.168.0.0/24-dport 53
# Iptables-A DOWNLOAD-p tcp-d 192.168.0.0/24-dport 22
Having created the firewall rule rule do not forget to save the existing rule by running the following command:
# Service iptables save
For the Linux distribution Ubuntu the command as follows:
# Iptables-save> / etc / myiptables.cfg
See the upload and download bandwidth usage Finished configuration, then we can do bandwidth monitoring. To see the total upload and download bandwidth command as follows:
# Iptables - nL FORWARD - v
To view details of download bandwidth each service command as follows:
# Iptables - nL DOWNLOAD - v
To view the details of the upload bandwidth of each service command as follows:
# Iptables - nL UPLOAD - v
The first step in making a firewall rule is to create a new chain with the name "DOWNLOAD" and "UPLOAD" as follows:
# Iptables - N DOWNLOAD
# Iptables - N UPLOAD
# Iptables - nL
After defining the new chain, further defining the next rule FORWARD firewall to classify traffic into traffic UPLOAD and DOWNLOAD. Steps were as follows:
# Iptables-A FORWARD-s 192.168.0.0/24-o eth0-j UPLOAD
# Iptables-A FORWARD-d 192.168.0.0/24-i eth0-j DOWNLOAD
Next create a firewall rule-rule to match traffic UPLOAD and DOWNLOAD to service HTTP, SMTP, POP3, DNS, and SSH, as follows:
# Iptables-A UPLOAD-p tcp-s 192.168.0.0/24-dport 80
# Iptables-A UPLOAD-p tcp-s 192.168.0.0/24-dport 25
# Iptables-A UPLOAD-p tcp-s 192.168.0.0/24-dport 110
# Iptables-A UPLOAD-p tcp-s 192.168.0.0/24-dport 53
# Iptables-A UPLOAD-p udp-s 192.168.0.0/24-dport 53
# Iptables-A UPLOAD-p tcp-s 192.168.0.0/24-dport 22
# Iptables-A DOWNLOAD-p tcp-d 192.168.0.0/24-dport 80
# Iptables-A DOWNLOAD-p tcp-d 192.168.0.0/24-dport 25
# Iptables-A DOWNLOAD-p tcp-d 192.168.0.0/24-dport 110
# Iptables-A DOWNLOAD-p tcp-d 192.168.0.0/24-dport 53
# Iptables-A DOWNLOAD-p udp-d 192.168.0.0/24-dport 53
# Iptables-A DOWNLOAD-p tcp-d 192.168.0.0/24-dport 22
Having created the firewall rule rule do not forget to save the existing rule by running the following command:
# Service iptables save
For the Linux distribution Ubuntu the command as follows:
# Iptables-save> / etc / myiptables.cfg
See the upload and download bandwidth usage Finished configuration, then we can do bandwidth monitoring. To see the total upload and download bandwidth command as follows:
# Iptables - nL FORWARD - v
To view details of download bandwidth each service command as follows:
# Iptables - nL DOWNLOAD - v
To view the details of the upload bandwidth of each service command as follows:
# Iptables - nL UPLOAD - v
Publisher: http://overflow.web.id
0 komentar on How to create a firewall rule for bandwidth monitoring with iptables - Blogger Tricks :
Post a Comment and Don't Spam!