- 1、本文档共12页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
在ubuntu server配置iptables防火墙(在Ubuntu服务器配置iptables防火墙)
在ubuntu server配置iptables防火墙(在Ubuntu服务器配置iptables防火墙)
Iptables is a default firewall installed on Ubuntu Server. In the normal Ubuntu installation process, iptables is installed, but it defaults to allowing all traffic (regardless of whether the firewall is invalid)
Theres a lot of valuable information about iptables, but most of them are very complicated. If you want to do some basic configuration, the How To below fits you well.
The basic commands
Type:
# iptables -L
List the rules in your current iptables. If you have just created your server, then there may be no rules at this point, and you should see the following:
Chain INPUT (policy ACCEPT)
Target, prot, opt, source, destination
Chain FORWARD (policy ACCEPT)
Target, prot, opt, source, destination
Chain OUTPUT (policy ACCEPT)
Target, prot, opt, source, destination
Allow the establishment of a session
We can allow the establishment of sessions to accept traffic:
Iptables -A INPUT -m state # --state ESTABLISHED, RELATED -j ACCEPT
In the designated port to allow incoming traffic
By blocking all traffic, you can also start the system, but you may be working through SSH, all of which need to allow SSH traffic before you block other traffic.
To allow traffic on the 22 port number (the default SSH port), you can tell iptables to allow your network card to accept all of the TCP traffic at the destination port of 22.
-A INPUT -p TCP # iptables -i eth0 --dport SSH -j ACCEPT
In particular, this will append the (-A) INPUT rule to all the traffic in the table that allows the destination port number SSH to enter the interface (-i) eth0 so that the iptables completes the jump (-j) or action: ACCEPT
Lets check these rules: (there are only a few lines shown here, and you should see more)
# iptables -L
Chain INPUT (policy ACCEPT)
Target, prot, opt, source, destination
ACCEPT all - anywhere, anywhere, state, RELATED, ESTABLISHED
ACCEPT TCP - anywhere, anywhere, TCP, dpt:ssh
Now, lets allow all web traffic
Iptables -A INPUT -p TC
文档评论(0)