{"id":5435,"date":"2020-08-18T16:06:47","date_gmt":"2020-08-18T08:06:47","guid":{"rendered":"http:\/\/39.97.231.10\/?p=5435"},"modified":"2020-08-18T16:06:47","modified_gmt":"2020-08-18T08:06:47","slug":"iptables%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"http:\/\/www.weijing.co\/?p=5435","title":{"rendered":"Iptables\u8be6\u89e3"},"content":{"rendered":"<header class=\\\"entry-header\\\"><\/header>\n<div class=\\\"entry-content\\\">\n<div class=\\\"begin-single-meta\\\"><span style=\\\"color: #1e73be; font-size: 1.38462rem;\\\">1.1 \u4f01\u4e1a\u4e2d\u5b89\u5168\u4f18\u5316\u914d\u7f6e\u539f\u5219<\/span><\/div>\n<div class=\\\"single-content\\\">\n\u5c3d\u53ef\u80fd\u4e0d\u7ed9\u670d\u52a1\u5668\u914d\u7f6e\u5916\u7f51ip ,\u53ef\u4ee5\u901a\u8fc7\u4ee3\u7406\u8f6c\u53d1\u6216\u8005\u901a\u8fc7\u9632\u706b\u5899\u6620\u5c04.\u5e76\u53d1\u4e0d\u662f\u7279\u522b\u5927\u60c5\u51b5\u6709\u5916\u7f51ip,\u53ef\u4ee5\u5f00\u542f\u9632\u706b\u5899\u670d\u52a1.<br \/>\n\u5927\u5e76\u53d1\u7684\u60c5\u51b5\uff0c\u4e0d\u80fd\u5f00iptables,\u5f71\u54cd\u6027\u80fd\uff0c\u5229\u7528\u786c\u4ef6\u9632\u706b\u5899\u63d0\u5347\u67b6\u6784\u5b89\u5168<\/p>\n<h3><span id=\\\"111_iptables\\\">1.1.1\u00a0\u751f\u4ea7\u4e2diptables\u7684\u5b9e\u9645\u5e94\u7528<\/span><\/h3>\n<p>\u4e3b\u8981\u5e94\u7528\u65b9\u5411<br \/>\n1\u3001\u4e3b\u673a\u9632\u706b\u5899\uff08filter\u8868\u7684INPUT\u94fe\uff09\u3002<br \/>\n2\u3001\u5c40\u57df\u7f51\u5171\u4eab\u4e0a\u7f51(nat\u8868\u7684POSTROUTING\u94fe)\u3002\u534a\u4e2a\u8def\u7531\u5668\uff0cNAT\u529f\u80fd\u3002<br \/>\n3\u3001\u7aef\u53e3\u53caIP\u6620\u5c04(nat\u8868\u7684PREROUTING\u94fe)\uff0c\u786c\u9632\u7684NAT\u529f\u80fd\u3002<br \/>\n4\u3001IP\u4e00\u5bf9\u4e00\u6620\u5c04\u3002<br \/>\n<strong><em>\u5176\u4ed6\u8bf4\u660e\uff1a<\/em><\/strong><\/p>\n<blockquote><p>\u00a0\u2460iptables\u662f\u57fa\u4e8e\u5185\u6838\u7684\u9632\u706b\u5899\uff0c\u529f\u80fd\u975e\u5e38\u5f3a\u5927\uff0c\u57fa\u4e8e\u6570\u636e\u5305\u7684\u8fc7\u6ee4\uff01\u7279\u522b\u662f\u53ef\u4ee5\u5728\u4e00\u53f0\u975e\u5e38\u4f4e\u7684\u786c\u4ef6\u914d\u7f6e\u4e0b\u8dd1\u7684\u975e\u5e38\u597d\u3002<br \/>\n<strong><em>\u3000\u3000\u6ce8\uff1a<\/em><\/strong>iptables\u4e3b\u8981\u5de5\u4f5c\u5728OSI\u4e03\u5c42\u76842.3.4\u5c42\u3002\u4e03\u5c42\u7684\u63a7\u5236\u53ef\u4ee5\u4f7f\u7528squid\u4ee3\u7406+iptables\u3002<br \/>\n\u2461iptabes\uff1a\u751f\u4ea7\u4e2d\u6839\u636e\u5177\u4f53\u60c5\u51b5\uff0c\u4e00\u822c\uff0c\u5185\u7f51\u5173\u95ed\uff0c\u5916\u7f51\u6253\u5f00\u3002\u5927\u5e76\u53d1\u7684\u60c5\u51b5\u4e0d\u80fd\u5f00iptables\uff0c\u5f71\u54cd\u6027\u80fd\uff0ciptables\u662f\u8981\u6d88\u8017CPU\u7684\uff0c\u6240\u4ee5\u5927\u5e76\u53d1\u7684\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u4f7f\u7528\u786c\u4ef6\u9632\u706b\u5899\u7684\u5404\u65b9\u9762\u505a\u7684\u5f88\u4ed4\u7ec6\u3002selinux\uff1a\u751f\u4ea7\u4e2d\u4e5f\u662f\u5173\u95ed\u7684\u3002\u53ef\u4ee5\u505aids\u7684\u5165\u4fb5\u68c0\u6d4b\u3002<br \/>\n\u2462\u5b9e\u9645\u751f\u4ea7\u4e2d\u5c3d\u53ef\u80fd\u4e0d\u7ed9\u670d\u52a1\u5668\u914d\u7f6e\u5916\u7f51IP\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee3\u7406\u8f6c\u53d1\u3002\u6bd4\u5982\uff0cnagios\u5c31\u4e0d\u9700\u8981\u5916\u7f51\u3002<br \/>\n\u2463\u5e76\u53d1\u4e0d\u662f\u5f88\u5927\u7684\u60c5\u51b5\u4e0b\uff0c\u518d\u5916\u7f51\u7684IP\u73af\u5883\uff0c\u5f00\u9632\u706b\u5899\u3002<br \/>\n\u2464\u7b2c\u4e00\u6b21\u76f4\u63a5\u9ed8\u8ba4\u89c4\u5219\u751f\u6210\u914d\u7f6e\u6587\u4ef6\uff0c\u4ee5\u540e\u5c31\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u8fdb\u884c\u4fee\u6539\uff08\u7f16\u8f91\u6dfb\u52a0\u5220\u9664\uff09\u3002<br \/>\n\u2465\u5c01\u6389IP\uff1a\u6839\u636eIP\u5730\u5740\u548c\u7f51\u7edc\u8fde\u63a5\u6570\u8fdb\u884c\u5c01\u6740\u3002\uff08\u5b9a\u65f6\u4efb\u52a1\uff0c\u5b9a\u65f6\u5c01\u6389\uff0c\u5224\u65ad\uff0c\u5b58\u5728\u5c31\u4e0d\u518d\u8fdb\u884c\u4e8c\u6b21\u5c01\u6740\uff09<\/p><\/blockquote>\n<h3><span id=\\\"112\\\">1.1.2\u00a0\u4f01\u4e1a\u5e38\u7528\u6848\u4f8b\u529f\u80fd\u5c0f\u7ed3\uff1a<\/span><\/h3>\n<p>1\uff09linux\u4e3b\u673a\u9632\u706b\u5899\uff0c\u5355\u673a\u4f5c\u4e3a\u9632\u706b\u5899\uff08\u8868filter\uff09\u3002<br \/>\n2\uff09\u5c40\u57df\u7f51\u5171\u4eab\u4e0a\u7f51\uff08\u8868nat postrouting\uff09\u3002<br \/>\n3\uff09\u5916\u90e8\u5730\u5740\u6620\u5c04\u4e3a\u5185\u90e8\u5730\u5740\u548c\u7aef\u53e3\uff08\u8868nat prerouting\uff09<\/p>\n<h2><span id=\\\"12_iptables\\\">1.2 iptables\u9632\u706b\u5899\u7b80\u4ecb<\/span><\/h2>\n<p>Netfilter\/Iptables(\u4ee5\u4e0b\u7b80\u79f0Iptables)\u662funix\/linux\u81ea\u5e26\u7684\u4e00\u6b3e\u4f18\u79c0\u4e14\u5f00\u653e\u6e90\u4ee3\u7801\u7684\u5b8c\u5168\u81ea\u7531\u7684\u57fa\u4e8e\u5305\u8fc7\u6ee4\u7684\u9632\u706b\u5899\u5de5\u5177\uff0c\u5b83\u7684\u529f\u80fd\u5341\u5206\u5f3a\u5927\uff0c\u4f7f\u7528\u975e\u5e38\u7075\u6d3b\uff0c\u53ef\u4ee5\u5bf9\u6d41\u5165\u548c\u6d41\u51fa\u670d\u52a1\u5668\u7684\u6570\u636e\u5305\u8fdb\u884c\u5f88\u7cbe\u7ec6\u7684\u63a7\u5236.\u7279\u522b\u662f\u5b83\u53ef\u4ee5\u5728\u4e00\u53f0\u975e\u5e38\u4f4e\u7684\u786c\u4ef6\u914d\u7f6e\u670d\u52a1\u5668\u4e0a\u8dd1\u7684\u975e\u5e38\u597d\uff08\u8d5b\u626c500HZ cpu 64M\u00a0\u5185\u5b58\u7684\u60f2\u51b5\u4e0b\u90e8\u7f72\u7f51\u5173\u9632\u706b\u5899\uff09\uff0c\u63d0\u4f9b\u8fd1400\u4eba\u7684\u4e0a\u7f51\u670d\u52a1\u4e1d\u6beb\u4e0d\u900a\u8272\u4f01\u4e1a\u7ea7\u4e13\u4e1a\u8def\u7531\u5668\u9632\u706b\u5899\u3002\u00a0iptables + zebra + squid (\u4f01\u4e1a\u5e38\u7528\u7f51\u7edc\u5f00\u6e90\u4ea7\u54c1\uff09\u3002<br \/>\niptables\u662flinux2.4\u53ca2.6\u5185\u6838\u4e2d\u96c6\u6210\u7684\u670d\u52a1\uff0c\u5176\u529f\u80fd\u4e0e\u5b89\u5168\u6027\u6bd4\u5176\u8001\u4e00\u871aipfwadm\uff0cipchains\u00a0\u5f3a\u5927\u7684\u591a\uff0ciptables\u4e3b\u8981\u5de5\u4f5c\u57280SI\u4e03\u5c42\u7684\u4e8c\u3001\u4e09\u3001\u56db\u5c42\uff0c\u5982\u679c\u91cd\u65b0\u7f16\u8bd1\u5185\u6838\uff0ciptables\u4e5f\u53ef\u4ee5\u652f\u6301\u00a07\u00a0\u5c42\u63a7\u5236\uff08squid\u4ee3\u7406+iptables\uff09\u3002<\/p>\n<h3><span id=\\\"121_iptables\\\">1.2.1 iptables\u540d\u8bcd\u548c\u672f\u8bed<\/span><\/h3>\n<p>\u4e0d\u5c11\u521a\u63a5\u89e6\u5230iptables\u7684\u670b\u53cb\u53ef\u80fd\u4f1a\u5bf9iptables\u9632\u706b\u5899\u7684\u76f8\u5173\u540d\u8bcd\u641e\u7684\u5f88\u6655\uff0c\u4e0d\u77e5\u9053\u5176\u6240\u4e91\u7684\u5177\u4f53\u610f\u601d\uff0c\u800c\u662f\u5c31\u6700\u57fa\u672c\u7684\u80fd\u8ba9\u5927\u5bb6\u5bb9\u6613\u5feb\u901f\u7406\u89e3\u548c\u638c\u63e1\u7684\u601d\u8def\u6765\u63cf\u8ff0\uff1a<br \/>\n\u5bb9\u5668\uff1a\u5305\u542b\u6216\u8005\u8bf4\u5c5e\u4e8e\u7684\u5173\u7cfb<\/p>\n<h3><span id=\\\"122\\\">1.2.2\u00a0\u4ec0\u4e48\u662f\u5bb9\u5668<\/span><\/h3>\n<p>\u8c01\u4e0d\u77e5\u9053\u554a\uff0c\u5bb9\u5668\u5c31\u662f\u88c5\u4e1c\u897f\u7684\uff0c\u5982\uff08\u7bb1\u3001\u5305\u3001\u575b\uff09\u3002\u6ca1\u9519\uff0c\u606d\u559c\u4f60\u7b54\u5bf9\u4e86.\u8bcd\u5178\u91cc\u89e3\u91ca\u8bf4\uff0c\u5bb9\u5668\u5c31\u662f\u7528\u6765\u5305\u88c5\u6216\u88c5\u8f7d\u7269\u54c1\u7684\u8d2e\u5b58\u5668\uff08\u5982\u7bb1\u3001\u7f50\u3001\u575b\uff09\u6216\u8005\u6210\u5f62\u6216\u67d4\u8f6f\u4e0d\u6210\u5f62\u7684\u5305\u8986\u6750\u6599.<br \/>\n\u5728iptables\u91cc\u7684\u5462\uff0c\u5c31\u662f\u7528\u6765\u63cf\u8ff0\u8fd9\u79cd\u5305\u542b\u6216\u8005\u8bf4\u5c5e\u4e8e\u7684\u5173\u7cfb\u3002<\/p>\n<h3><span id=\\\"123_Netfilteriptables\\\">1.2.3\u00a0\u4ec0\u4e48\u662f\u00a0Netfilter\/iptables ?<\/span><\/h3>\n<p>Netfilter\u662f\u8868\uff08tables\uff09\u7684\u5bb9\u5668\uff0c\u8fd9\u6837\u89e3\u91ca\u5927\u5bb6\u80af\u5b9a\u8fd8\u662f\u6655\u3002\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u5982\u679c\u628aNetfilter\u770b\u6210\u662f\u67d0\u4e2a\u5c0f\u533a\u7684\u4e00\u680b\u697c\u3002\u90a3\u4e48\u8868\uff08tables)\u5c31\u662f\u697c\u91cc\u7684\u5176\u4e2d\u7684\u4e00\u5957\u623f\u5b50\u3002\u8fd9\u5957\u623f\u5b50\\&#8221;\u8868\uff08tables)\\&#8221;\u5c5e\u4e8e\u8fd9\u680b\u201cNetfilter\u201d\u3002<\/p>\n<h3><span id=\\\"124_tables\\\">1.2.4\u00a0\u4ec0\u4e48\u662f\u8868\uff08tables\uff09\uff1f<\/span><\/h3>\n<p>\u8868\uff08tables\uff09\u662f\u94fe\u7684\u5bb9\u5668\uff0c\u5373\u6240\u6709\u7684\u94fe\uff08chains\uff09\u90fd\u5c5e\u4e8e\u5176\u5bf9\u5e94\u7684\u8868\uff08tables\uff09.\u5982\u4e0a\uff0c\u5982\u679c\u628aNetfilter\u770b\u6210\u662f\u67d0\u4e2a\u5c0f\u533a\u7684\u4e00\u680b\u697c.\u90a3\u4e48\u8868\uff08tables\uff09\u5c31\u662f\u697c\u91cc\u7684\u5176\u4e2d\u7684\u4e00\u5957\u623f\u5b50\u3002<\/p>\n<h3><span id=\\\"125_chains\\\">1.2.5\u00a0\u4ec0\u4e48\u662f\u94fe\uff08chains\uff09\uff1f<\/span><\/h3>\n<p>\u94fe\uff08chains\uff09\u662f\u89c4\u5219\uff08Policys\uff09\u7684\u5bb9\u5668\u3002\u63a5\u4e0a\uff0c\u5982\u679c\u628a\u8868\uff08tables\uff09\u5f53\u4f5c\u6709\u4e00\u5957\u623f\u5b50\uff0c\u90a3\u4e48\u94fe\uff08chains\uff09\u5c31\u53ef\u4ee5\u8bf4\u662f\u623f\u5b50\u91cc\u7684\u5bb6\u5177\uff08\u67dc\u5b50\u7b49\uff09\u3002<\/p>\n<h3><span id=\\\"126_Policy\\\">1.2.6\u00a0\u4ec0\u4e48\u662f\u89c4\u5219\uff08Policy\uff09\uff1f<\/span><\/h3>\n<p>\u89c4\u5219\uff08Policy\uff09\u5c31\u6bd4\u8f83\u5bb9\u6613\u7406\u89e3\u4e86\uff0c\u5c31\u662fiptables\u7cfb\u5217\u8fc7\u6ee4\u4fe1\u606f\u7684\u89c4\u8303\u548c\u5177\u4f53\u65b9\u6cd5\u6761\u6b3e\u4e86.\u53ef\u4ee5\u7406\u89e3\u4e3a\u67dc\u5b50\u5982\u4f55\u589e\u52a0\u5e76\u6446\u653e\u67dc\u5b50\u4e1c\u897f\u7b49\u3002<br \/>\n\u57fa\u672c\u672f\u8bed\u5982\u4e0b\u8868\u683c\u6240\u793a\uff1a<\/p>\n<table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\n<tbody>\n<tr>\n<td valign=\\\"top\\\" width=\\\"19%\\\">\n<p align=\\\"center\\\"><strong>Netfilter<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"23%\\\">\n<p align=\\\"center\\\"><strong>\u8868\uff08tables<\/strong><strong>\uff09<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"23%\\\">\n<p align=\\\"center\\\"><strong>\u94fe\uff08chains<\/strong><strong>\uff09<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"33%\\\">\n<p align=\\\"center\\\"><strong>\u89c4\u5219\uff08Policy<\/strong><strong>\uff09<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"19%\\\">\n<p align=\\\"center\\\"><strong>\u4e00\u680b\u697c<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"23%\\\">\n<p align=\\\"center\\\">\u6309\u91cc\u7684\u623f\u5b50<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"23%\\\">\n<p align=\\\"center\\\">\u623f\u5b50\u91cc\u7684\u67dc\u5b50<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"33%\\\">\n<p align=\\\"center\\\">\u67dc\u5b50\u91cc\u8863\u670d\uff0c\u6446\u653e\u89c4\u5219<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><span id=\\\"13_iptables\\\">1.3 iptables\u00a0\u8868\u548c\u94fe<\/span><\/h2>\n<p>\u63cf\u8ff0\u5b8ciptables\u672f\u8bed\u540e\uff0c\u76f8\u4fe1\u5927\u5bb6\u5bf9iptables\u7684\u8868\u548c\u94fe\u6709\u4e86\u521d\u6b65\u7684\u4e86\u89e3\u4e86\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0ciptables\u6839\u636e\u529f\u80fd\u548c\u8868\u7684\u5b9a\u4e49\u5212\u5206\u5305\u542b\u4e09\u4e2a\u8868\uff0cfilter,nat,mangle,\u5176\u6bcf\u4e2a\u8868\u53c8\u5305\u542b\u4e0d\u540c\u7684\u64cd\u4f5c\u94fe\uff08chains )\u3002\u00a0\u5b9e\u9645iptables\u5305\u542b4\u5f20\u8868\u548c\u4e94\u4e2a\u94fe,\u5de7\u4e3b\u8981\u8bb0\u4f4f\u4e24\u5f20\u8868\u5373\u53effilter\u548cnat\u8868\u5373\u53ef\u3002<br \/>\n\u4e0b\u9762\u8868\u683c\u5c55\u793a\u4e86\u8868\u548c\u94fe\u7684\u5bf9\u5e94\u5173\u7cfb\u3002<br \/>\n<strong>\u56db\u4e2a\u8868\uff1a<\/strong><\/p>\n<div align=\\\"center\\\">\n<table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\n<tbody>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>\u8868\uff08tables<\/strong><strong>\uff09<\/strong><\/p>\n<\/td>\n<td colspan=\\\"2\\\" width=\\\"81%\\\">\n<p align=\\\"center\\\"><strong>\u94fe\uff08chains<\/strong><strong>\uff09<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\\\"4\\\" width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>Filter<\/strong><\/p>\n<\/td>\n<td colspan=\\\"2\\\" width=\\\"81%\\\">\u8fd9\u662f\u9ed8\u8ba4\u8868\uff0c\u5b9e\u73b0\u9632\u706b\u5899\u6570\u636e\u8fc7\u6ee4\u529f\u80fd\u3002<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>INPUT<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">\u5bf9\u4e8e\u6307\u5b9a\u5230\u672c\u5730\u5957\u63a5\u5b57\u7684\u5305\uff0c\u5373\u5230\u8fbe\u672c\u5730\u9632\u706b\u5899\u670d\u52a1\u5668\u7684\u6570\u636e\u5305\u3002<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>FORWARD<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">\u8def\u7531\u7a7f\u8fc7\u7684\u6570\u636e\u5305\uff0c\u5373\u7ecf\u8fc7\u672c\u5730\u9632\u706b\u5899\u670d\u52a1\u5668\u7684\u6570\u636e\u5305\u3002<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>OUTPUT<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">\u672c\u5730\u521b\u5efa\u7684\u6570\u636e\u5305<\/td>\n<\/tr>\n<tr>\n<td rowspan=\\\"4\\\" width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>NAT<\/strong><\/p>\n<\/td>\n<td colspan=\\\"2\\\" width=\\\"81%\\\">\u5f53\u9047\u5230\u65b0\u521b\u5efa\u7684\u6570\u636e\u5305\u8fde\u63a5\u65f6\u5c06\u53c2\u8003\u8fd9\u4e2a\u8868<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>FREROUTING<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">\u4e00\u8fdb\u6765\u5c31\u5bf9\u6570\u636e\u5305\u8fdb\u884c\u6539\u53d8<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>OUTPUT<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">\u672c\u5730\u521b\u5efa\u7684\u6570\u636e\u5305\u5728\u8def\u7531\u524d\u8fdb\u884c\u6539\u53d8<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>POSTROUTING<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">\u5728\u6570\u636e\u5305\u5373\u5c06\u51fa\u53bb\u65f6\u6539\u53d8\u6570\u636e\u5305\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td rowspan=\\\"6\\\" width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>Mangle<\/strong><\/p>\n<\/td>\n<td colspan=\\\"2\\\" width=\\\"81%\\\">\u8fd9\u4e2a\u8868\u4e13\u95e8\u7528\u4e8e\u6539\u53d8\u6570\u636e\u5305<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>INPUT<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">\u8fdb\u5165\u5230\u8bbe\u5907\u672c\u8eab\u7684\u5305<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>FORWARD<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">\u5bf9\u8def\u7531\u540e\u7684\u6570\u636e\u5305\u4fe1\u606f\u8fdb\u884c\u4fee\u6539<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>FREROUTING<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">\u5728\u8def\u7531\u4e4b\u524d\u66f4\u6539\u4f20\u5165\u7684\u5305<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>OUTPUT<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">\u672c\u5730\u521b\u5efa\u7684\u6570\u636e\u5305\u5728\u8def\u7531\u4e4b\u524d\u6539\u53d8<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>POSTROUTING<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">\u5728\u6570\u636e\u5305\u5373\u5c06\u79bb\u5f00\u65f6\u66f4\u6539\u6570\u636e\u5305\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td rowspan=\\\"3\\\" width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>raw<\/strong><\/p>\n<\/td>\n<td colspan=\\\"2\\\" width=\\\"81%\\\"><strong>\u6b64\u8868\u7528\u5904\u8f83\u5c11\uff0c\u53ef\u4ee5\u5ffd\u7565\u4e0d\u8ba1\u3002<\/strong><br \/>\nThis\u00a0 table is used mainly for configuring exemptions from connection tracking in combination with the\u00a0 NOTRACK\u00a0 target.<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>PREROUTING<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">for packets arriving via any network interface<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>OUTPUT<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">for packets\u00a0 generated by local processes<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>\u4e94\u4e2a\u94fe<\/strong><\/p>\n<table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\n<tbody>\n<tr>\n<td rowspan=\\\"2\\\" width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>\u8868\uff08tables<\/strong><strong>\uff09<\/strong><\/p>\n<\/td>\n<td colspan=\\\"5\\\" width=\\\"81%\\\">\n<p align=\\\"center\\\"><strong>\u94fe\uff08chains<\/strong><strong>\uff09<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\\\"15%\\\">\n<p align=\\\"center\\\">INPUT<\/p>\n<\/td>\n<td width=\\\"16%\\\">\n<p align=\\\"center\\\">FORWARD<\/p>\n<\/td>\n<td width=\\\"15%\\\">\n<p align=\\\"center\\\">OUTPUT<\/p>\n<\/td>\n<td width=\\\"16%\\\">\n<p align=\\\"center\\\">PREROUTING<\/p>\n<\/td>\n<td width=\\\"17%\\\">\n<p align=\\\"center\\\">POSTROUTING<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>Filter<\/strong><\/p>\n<\/td>\n<td width=\\\"15%\\\">\n<p align=\\\"center\\\">\u221a<\/p>\n<\/td>\n<td width=\\\"16%\\\">\n<p align=\\\"center\\\">\u221a<\/p>\n<\/td>\n<td width=\\\"15%\\\">\n<p align=\\\"center\\\">\u221a<\/p>\n<\/td>\n<td width=\\\"16%\\\">\n<p align=\\\"center\\\">\u00d7<\/p>\n<\/td>\n<td width=\\\"17%\\\">\n<p align=\\\"center\\\">\u00d7<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>NAT<\/strong><\/p>\n<\/td>\n<td width=\\\"15%\\\">\n<p align=\\\"center\\\"><strong>\u00d7<\/strong><\/p>\n<\/td>\n<td width=\\\"16%\\\">\n<p align=\\\"center\\\">\u00d7<\/p>\n<\/td>\n<td width=\\\"15%\\\">\n<p align=\\\"center\\\">\u221a<\/p>\n<\/td>\n<td width=\\\"16%\\\">\n<p align=\\\"center\\\">\u221a<\/p>\n<\/td>\n<td width=\\\"17%\\\">\n<p align=\\\"center\\\">\u221a<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>Managle<\/strong><\/p>\n<\/td>\n<td width=\\\"15%\\\">\n<p align=\\\"center\\\">\u221a<\/p>\n<\/td>\n<td width=\\\"16%\\\">\n<p align=\\\"center\\\">\u221a<\/p>\n<\/td>\n<td width=\\\"15%\\\">\n<p align=\\\"center\\\">\u221a<\/p>\n<\/td>\n<td width=\\\"16%\\\">\n<p align=\\\"center\\\">\u221a<\/p>\n<\/td>\n<td width=\\\"17%\\\">\n<p align=\\\"center\\\">\u221a<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>raw<\/strong><\/p>\n<\/td>\n<td width=\\\"15%\\\">\n<p align=\\\"center\\\">\u00d7<\/p>\n<\/td>\n<td width=\\\"16%\\\">\n<p align=\\\"center\\\">\u00d7<\/p>\n<\/td>\n<td width=\\\"15%\\\">\n<p align=\\\"center\\\">\u221a<\/p>\n<\/td>\n<td width=\\\"16%\\\">\n<p align=\\\"center\\\">\u221a<\/p>\n<\/td>\n<td width=\\\"17%\\\">\n<p align=\\\"center\\\">\u00d7<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\\\"6\\\" width=\\\"100%\\\">\u8bf4\u660e\uff1a\u221a\u00a0\u8868\u793a\u6709\uff0c\u00d7\u00a0\u8868\u793a\u65e0\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p align=\\\"center\\\"><img src=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118095127803-1524170528.png\\\" alt=\\\"\u4f01\u4e1a\u9632\u706b\u5899\u4e4biptables\\\" data-original=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118095127803-1524170528.png\\\" \/><\/p>\n<p align=\\\"center\\\">\u56fe\u00a0&#8211; iptables\u4e2d\u7684\u8868\u4e0e\u94fe\u7684\u7ed3\u6784\u5173\u7cfb<\/p>\n<h3><span id=\\\"131_filter\\\">1.3.1 filter\u8868\u7684\u8be6\u7ec6\u4ecb\u7ecd<\/span><\/h3>\n<table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\n<tbody>\n<tr>\n<td width=\\\"20%\\\">\n<p align=\\\"center\\\"><strong>filter<\/strong><strong>\u8868<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"79%\\\">\u4e3b\u8981\u548c\u4e3b\u673a\u81ea\u8eab\u76f8\u5173\uff0c\u771f\u6b63\u8d1f\u8d23\u4e3b\u673a\u9632\u706b\u5899\u529f\u80fd\u7684\uff08\u8fc7\u6ee4\u6d41\u5165\u6d41\u51fa\u4e3b\u673a\u7684\u6570\u636e\u5305\uff09<br \/>\nfilter\u8868\u662fiptables\u9ed8\u8ba4\u4f7f\u7528\u7684\u8868\uff0c\u8fd9\u4e2a\u8868\u5b9a\u4e49\u4e86\u4e09\u4e2a\u94fe\uff08chains\uff09<br \/>\n<strong>\u4f01\u4e1a\u5de5\u4f5c\u573a\u666f:<\/strong><strong>\u4e3b\u673a\u9632\u706b\u5899<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\\\"20%\\\">\n<p align=\\\"center\\\"><strong>INPUT<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"79%\\\">\u8d1f\u8d23\u8fc7\u6ee4\u6240\u6709\u76ee\u6807\u662f\u672c\u673a\u5730\u5740\u7684\u6570\u636e\u5305<br \/>\n\u901a\u4fd7\u6765\u8bf4\uff1a\u5c31\u662f\u8fc7\u6ee4\u8fdb\u5165\u4e3b\u673a\u7684\u6570\u636e\u5305<\/td>\n<\/tr>\n<tr>\n<td width=\\\"20%\\\">\n<p align=\\\"center\\\"><strong>FORWARD<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"79%\\\">\u8d1f\u8d23\u8f6c\u53d1\u6d41\u7ecf\u4e3b\u673a\u7684\u6570\u636e\u5305\u3002\u8d77\u5230\u8f6c\u53d1\u7684\u4f5c\u7528\uff0c\u548cNAT\u5173\u7cfb\u5f88\u5927\u3002<br \/>\nLVS NAT\u00a0\u6a21\u5f0f\uff0cnet.ipv4.ip_forward=0<\/td>\n<\/tr>\n<tr>\n<td width=\\\"20%\\\">\n<p align=\\\"center\\\"><strong>OUTPUT<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"79%\\\">\u5904\u7406\u6240\u6709\u6e90\u5730\u5740\u662f\u672c\u673a\u5730\u5740\u7684\u6570\u636e\u5305<br \/>\n\u901a\u4fd7\u7684\u8bb2\uff1a\u5c31\u662f\u5904\u7406\u4ece\u4e3b\u673a\u53d1\u51fa\u7684\u6570\u636e\u5305<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5bf9\u4e8efilter\u8868\u7684\u63a7\u5236\u662f\u6211\u4eec\u5b9e\u73b0\u672c\u673a\u9632\u706b\u5899\u529f\u80fd\u7684\u91cd\u8981\u624b\u6bb5\uff0c\u7279\u522b\u662fINPUT\u94fe\u7684\u63a7\u5236\u3002<\/p>\n<h3><span id=\\\"132_NAT\\\">1.3.2 NAT\u8868\u4fe1\u606f\u8be6\u7ec6\u4ecb\u7ecd<\/span><\/h3>\n<table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\n<tbody>\n<tr>\n<td width=\\\"20%\\\">\n<p align=\\\"center\\\">NAT\u8868<\/p>\n<\/td>\n<td width=\\\"79%\\\">\u8d1f\u8d23\u7f51\u7edc\u5730\u5740\u8f6c\u6362\u7684\uff0c\u5373\u6765\u6e90\u4e0e\u76ee\u7684\u7684IP\u5730\u5740\u548cport\u7684\u8f6c\u6362\u3002<br \/>\n\u5e94\u7528\uff1a\u548c\u4e3b\u673a\u672c\u8eab\u65e0\u5173\uff0c\u4e00\u822c\u7528\u4e8e\u5c40\u57df\u7f51\u5171\u4eab\u4e0a\u7f51\u6216\u8005\u7279\u6b8a\u7684\u7aef\u53e3\u8f6c\u6362\u76f8\u5173.<br \/>\n<strong><em>\u5de5\u4f5c\u573a\u666f\uff1a<\/em><\/strong><br \/>\n1\u3001\u7528\u4e8e\u4f01\u4e1a\u8def\u7531(zebra)\u6216\u7f51\u5173(iptables),\u5171\u4eab\u4e0a\u7f51(POSTROUTING)<br \/>\n2\u3001\u505a\u5185\u90e8\u5916\u90e8IP\u5730\u5740\u4e00\u5bf9\u4e00\u6620\u5c04(dmz),\u786c\u4ef6\u9632\u706b\u5899\u6620\u5c04IP\u5230\u5185\u90e8\u670d\u52a1\u5668\uff0cFTP\u670d\u52a1(PREROUTING)<br \/>\n3\u3001WEB,\u5355\u4e2a\u7aef\u53e3\u7684\u6620\u5c04\uff0c\u76f4\u63a5\u6620\u5c0480\u7aef\u53e3(PREROUTING)<br \/>\n\u8fd9\u4e2a\u8868\u5b9a\u4e49\u4e863\u4e2a\u94fe\uff0cnat\u529f\u80fd\u76f8\u5f53\u4e8e\u7f51\u7edc\u7684acl\u63a7\u5236\u3002\u548c\u7f51\u7edc\u4ea4\u6362\u673aacl\u7c7b\u4f3c\u3002<\/td>\n<\/tr>\n<tr>\n<td width=\\\"20%\\\">\n<p align=\\\"center\\\"><strong>OUTPUT<\/strong><\/p>\n<\/td>\n<td width=\\\"79%\\\">\u548c\u4e3b\u673a\u653e\u51fa\u53bb\u7684\u6570\u636e\u5305\u6709\u5173\uff0c\u6539\u53d8\u4e3b\u673a\u53d1\u51fa\u6570\u636e\u5305\u7684\u76ee\u7684\u5730\u5740\u3002<\/td>\n<\/tr>\n<tr>\n<td width=\\\"20%\\\">\n<p align=\\\"center\\\"><strong>PREROUTING<\/strong><\/p>\n<\/td>\n<td width=\\\"79%\\\">\u5728\u6570\u636e\u5305\u5230\u8fbe\u9632\u706b\u5899\u65f6\uff0c\u8fdb\u884c\u8def\u7531\u5224\u65ad\u4e4b\u524d\u6267\u884c\u7684\u89c4\u5219\uff0c\u4f5c\u7528\u662f\u6539\u53d8\u6570\u636e\u5305\u7684\u76ee\u7684\u5730\u5740\u3001\u76ee\u7684\u7aef\u53e3\u7b49<br \/>\n\u5c31\u662f\u6536\u4fe1\u65f6\uff0c\u6839\u636e\u89c4\u5219\u91cd\u5199\u6536\u4ef6\u4eba\u7684\u5730\u5740<br \/>\n\u4f8b\u5982\uff1a\u628a\u516c\u7f51IP\uff1a\u00a0xxx.xxx.xxx.xxx\u00a0\u6620\u5c04\u5230\u5c40\u57df\u7f51\u7684\u00a0x.x.x.x\u00a0\u670d\u52a1\u5668<br \/>\n\u5982\u679c\u662fweb\u670d\u52a1\uff0c\u53ef\u4ee5\u628a80\u8f6c\u6362\u4e3a\u5c40\u57df\u7f51\u7684\u670d\u52a1\u56689000\u7aef\u53e3\u4e0a\u3002<\/td>\n<\/tr>\n<tr>\n<td width=\\\"20%\\\">\n<p align=\\\"center\\\"><strong>POSTROUTING<\/strong><\/p>\n<\/td>\n<td width=\\\"79%\\\">\u5728\u6570\u636e\u5305\u79bb\u5f00\u9632\u706b\u5899\u65f6\u8fdb\u884c\u8def\u7531\u5224\u65ad\u4e4b\u540e\u6267\u884c\u7684\u89c4\u5219\uff0c\u4f5c\u7528\u6539\u53d8\u6570\u636e\u5305\u7684\u6e90\u5730\u5740\uff0c\u6e90\u7aef\u53e3\u7b49\u3002<br \/>\n\u5199\u597d\u6536\u4ef6\u4eba\u7684\u5730\u5740\uff0c\u8981\u8ba9\u5bb6\u4eba\u56de\u4fe1\u65f6\u80fd\u591f\u6709\u5730\u5740\u53ef\u56de\u3002<br \/>\n\u4f8b\u5982\u3002\u9ed8\u8ba4\u7b14\u8bb0\u672c\u548c\u865a\u62df\u673a\u90fd\u662f\u5c40\u57df\u7f51\u5730\u5740\uff0c\u5728\u51fa\u7f51\u7684\u65f6\u5019\u88ab\u8def\u7531\u5668\u5c06\u6e90\u5730\u5740\u6539\u4e3a\u516c\u7f51\u5730\u5740\u3002<br \/>\n<strong><em>\u751f\u4ea7\u5e94\u7528\uff1a<\/em><\/strong>\u5c40\u57df\u7f51\u5171\u4eab\u4e0a\u7f51\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span id=\\\"133_Mangle\\\">1.3.3 Mangle\u8868\u4fe1\u606f\u8be6\u7ec6\u4ecb\u7ecd<\/span><\/h3>\n<table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\n<tbody>\n<tr>\n<td width=\\\"20%\\\">\n<p align=\\\"center\\\">Mangle\u8868<\/p>\n<\/td>\n<td width=\\\"79%\\\">\u4e3b\u8981\u8d1f\u8d23\u4fee\u6539\u6570\u636e\u5305\u4e2d\u7279\u6b8a\u7684\u8def\u7531\u6807\u8bb0\uff0c\u5982TTL,TOS,MARK\u7b49\uff0c\u8fd9\u4e2a\u8868\u5b9a\u4e49\u4e865\u4e2a\u94fe(chains).<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7531\u4e8e\u8fd9\u4e2a\u8868\u4e0e\u7279\u6b8a\u6807\u8bb0\u76f8\u5173\uff0c\u4e00\u822c\u5029\u51b5\u4e0b\uff0c\u6211\u4eec\u7528\u4e0d\u5230\u8fd9\u4e2amangle\u8868\u3002<br \/>\n\u8fd9\u91cc\u5c31\u4e0d\u505a\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u3002<\/p>\n<h2><span id=\\\"14_iptables\\\">1.4 iptables\u5de5\u4f5c\u6d41\u7a0b<\/span><\/h2>\n<h3><span id=\\\"141\\\">1.4.1\u00a0\u5de5\u4f5c\u6d41\u7a0b\u8bf4\u660e<\/span><\/h3>\n<p>\u524d\u9762\u4ecb\u7ecd\u5df2\u7ecf\u63d0\u5230\uff0ciptables\u662f\u91c7\u7528\u6570\u636e\u5305\u8fc7\u6ee4\u673a\u5236\u5de5\u4f5c\u7684\uff0c\u6240\u4ee5\u5b83\u4f1a\u5bf9\u8bf7\u6c42\u7684\u6570\u636e\u5305\u7684\u5305\u5934\u6570\u636e\u8fdb\u884c\u5206\u6790\uff0c\u5e76\u6839\u636e\u6211\u4eec\u9884\u5148\u8bbe\u5b9a\u7684\u89c4\u5219\u8fdb\u884c\u5339\u914d\u6765\u51b3\u5b9a\u662f\u5426\u53ef\u4ee5\u8fdb\u5165\u4e3b\u673a\u3002<br \/>\niptables\u662f\u91c7\u7528\u6570\u636e\u5305\u8fc7\u6ee4\u673a\u5236\u5de5\u4f5c\u7684\uff0c\u6240\u4ee5\u5b83\u4f1a\u5bf9\u8bf7\u6c42\u7684\u6570\u636e\u5305\u7684\u5305\u5934\u6570\u636e\u8fdb\u884c\u5206\u6790\uff0c\u5e76\u6839\u636e\u6211\u4eec\u9884\u5148\u8bbe\u5b9a\u7684\u89c4\u5219\u8fdb\u884c\u5339\u914d\u6765\u51b3\u5b9a\u662f\u5426\u53ef\u4ee5\u8fdb\u5165\u4e3b\u673a\u3002<br \/>\n\u6570\u636e\u5305\u7684\u6d41\u5411\u662f\u4ece\u5de6\u5411\u53f3\u7684\u3002<\/p>\n<p align=\\\"center\\\">\u00a0<img src=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118095142834-207194553.png\\\" alt=\\\"\u4f01\u4e1a\u9632\u706b\u5899\u4e4biptables\\\" data-original=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118095142834-207194553.png\\\" \/><\/p>\n<p align=\\\"center\\\">\u56fe\u00a0&#8211; iptables\u5305\u5904\u7406\u6d41\u7a0b\u56fe<\/p>\n<p align=\\\"center\\\">\u00a0<img src=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118095149740-1977616339.png\\\" alt=\\\"\u4f01\u4e1a\u9632\u706b\u5899\u4e4biptables\\\" data-original=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118095149740-1977616339.png\\\" \/><\/p>\n<p align=\\\"center\\\">\u56fe\u00a0&#8211; iptables\u5305\u5904\u7406\u6d41\u7a0b\u56fe(\u7b80\u5316)<\/p>\n<p><strong><em>\u62bd\u8c61\u8bf4\u660e\uff1a<\/em><\/strong>\u4e0a\u56fe\u53ef\u4ee5\u7528\u5317\u4eac\u5730\u94c11,2\u53f7\u7ebf\u6765\u63cf\u8ff0\uff1a<br \/>\n1\u53f7\u7ebf\uff1a\u4e3b\u8981\u662fNAT\u529f\u80fd<\/p>\n<blockquote><p>\u00a0\u4f01\u4e1a\u6848\u4f8b\uff1a<br \/>\n1)\u5c40\u57df\u7f51\u4e0a\u7f51\u5171\u4eab\uff08\u8def\u7531\u548c\u7f51\u5173\uff09\uff0c\u4f7f\u7528NAT\u7684POSTROUTING\u94fe\u3002<br \/>\n2)\u5916\u90e8IP\u548c\u7aef\u53e3\u6620\u5c04\u4e3a\u5185\u90e8IP\u548c\u7aef\u53e3\uff08DMZ\u529f\u80fd\uff09\uff0c\u4f7f\u7528NAT\u7684PREROUTING\u94fe<\/p><\/blockquote>\n<p>2\u53f7\u7ebf\uff1a\u4e3b\u8981\u662fFILTER\u529f\u80fd\uff0c\u5373\u9632\u706b\u5899\u529f\u80fdFILTER INPUT FORWARD<\/p>\n<blockquote><p>\u4f01\u4e1a\u6848\u4f8b\uff1a<br \/>\n\u4e3b\u8981\u5e94\u7528\u5c31\u662f\u4e3b\u673a\u670d\u52a1\u5668\u9632\u706b\u5899\uff0c\u4f7f\u7528FILTER\u7684INPUT\u94fe<\/p><\/blockquote>\n<p align=\\\"center\\\">\u00a0<img src=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118095207678-1251478781.png\\\" alt=\\\"\u4f01\u4e1a\u9632\u706b\u5899\u4e4biptables\\\" data-original=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118095207678-1251478781.png\\\" \/><\/p>\n<p align=\\\"center\\\">\u56fe\u00a0&#8211; iptables\u6570\u636e\u5305\u8f6c\u53d1\u6d41\u7a0b\u56fe<\/p>\n<h3><span id=\\\"142_iptables\\\">1.4.2 iptables\u5de5\u4f5c\u6d41\u7a0b\u5c0f\u7ed3<\/span><\/h3>\n<blockquote><p>1\u3001\u9632\u706b\u5899\u662f\u4e00\u5c42\u5c42\u8fc7\u6ee4\u7684\u3002\u5b9e\u9645\u662f\u6309\u7167\u914d\u7f6e\u89c4\u5219\u7684\u987a\u5e8f\u4ece\u4e0a\u5230\u4e0b\uff0c\u4ece\u524d\u5230\u540e\u8fdb\u884c\u8fc7\u6ee4\u7684\u3002<br \/>\n2\u3001\u5982\u679c\u5339\u914d\u4e0a\u4e86\u89c4\u5219\uff0c\u5373\u660e\u786e\u8868\u660e\u662f\u963b\u6b62\u8fd8\u662f\u901a\u8fc7\uff0c\u6b64\u65f6\u6570\u636e\u5305\u5c31\u4e0d\u5728\u5411\u4e0b\u5339\u914d\u65b0\u89c4\u5219\u4e86\u3002<br \/>\n3\u3001\u5982\u679c\u6240\u6709\u89c4\u5219\u4e2d\u6ca1\u6709\u660e\u786e\u8868\u660e\u662f\u963b\u6b62\u8fd8\u662f\u901a\u8fc7\u8fd9\u4e2a\u6570\u636e\u5305\uff0c\u4e5f\u5c31\u662f\u6ca1\u6709\u5339\u914d\u4e0a\u89c4\u5219\uff0c\u5411\u4e0b\u8fdb\u884c\u5339\u914d\uff0c\u76f4\u5230\u5339\u914d\u9ed8\u8ba4\u89c4\u5219\u5f97\u5230\u660e\u786e\u7684\u963b\u6b62\u8fd8\u662f\u901a\u8fc7\u3002<br \/>\n4\u3001\u9632\u706b\u5899\u7684\u9ed8\u8ba4\u89c4\u5219\u662f\u5bf9\u5e94\u94fe\u7684\u6240\u6709\u7684\u89c4\u5219\u6267\u884c\u5b8c\u4ee5\u540e\u624d\u4f1a\u6267\u884c\u7684\uff08\u6700\u540e\u6267\u884c\u7684\u89c4\u5219\uff09\u3002<\/p><\/blockquote>\n<h2><span id=\\\"15_iptables\\\">1.5 iptables\u64cd\u4f5c<\/span><\/h2>\n<p>\u7cfb\u7edf\u73af\u5883\u8bf4\u660e<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@clsn ~]# cat \/etc\/redhat-release\nCentOS release 6.9 (Final)\n[root@clsn ~]# hostname -I\n10.0.0.188 172.16.1.188<\/pre>\n<\/div>\n<p>\u8f6f\u4ef6\u7248\u672c<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@clsn ~]# iptables -V\niptables v1.4.7<\/pre>\n<\/div>\n<h3><span id=\\\"151_iptables\\\">1.5.1 iptables\u53c2\u6570\u8bf4\u660e<\/span><\/h3>\n<table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\n<tbody>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>\u53c2\u6570<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\n<p align=\\\"center\\\"><strong>\u53c2\u6570\u8bf4\u660e<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\\\"4\\\" width=\\\"100%\\\"><strong>\u663e\u793a\u76f8\u5173\u53c2\u6570<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>-n\/&#8211;numeric<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u4ee5\u6570\u5b57\u7684\u65b9\u5f0f\u663e\u793a\u5730\u5740\u6216\u7aef\u53e3\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>-L\/ &#8211;list<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u5217\u51fa\u4e00\u4e2a\u94fe\u6216\u6240\u6709\u94fe\u4e2d\u7684\u89c4\u5219\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;list-rules\/-S<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">Print the rules in a chain or all chains<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;line-number<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u5f53\u5217\u51fa\u89c4\u5219\u4fe1\u606f\u65f6\uff0c\u6253\u5370\u89c4\u5219\u884c\u53f7<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>-v<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u663e\u793a\u8be6\u7ec6\u4fe1\u606f\uff0c\u53ef\u4ee5\u53e0\u52a0<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>-h<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u663e\u793a\u5e2e\u52a9\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td colspan=\\\"4\\\" width=\\\"100%\\\"><strong>\u521d\u59cb\u5316\u76f8\u5173\u53c2\u6570<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>iptables -F<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u6e05\u9664\u6240\u6709\u89c4\u5219\uff0c\u4e0d\u4f1a\u5904\u7406\u9ed8\u8ba4\u7684\u89c4\u5219<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>iptables -X<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u5220\u9664\u7528\u6237\u81ea\u5b9a\u4e49\u7684\u94fe<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>iptables -Z<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u94fe\u7684\u8ba1\u6570\u5668\u6e05\u96f6\uff08\u6570\u636e\u5305\u8ba1\u6570\u5668\u4e0e\u6570\u636e\u5305\u5b57\u8282\u8ba1\u6570\u5668\uff09<\/td>\n<\/tr>\n<tr>\n<td colspan=\\\"4\\\" width=\\\"100%\\\"><strong>\u914d\u7f6e\u5e38\u7528\u53c2\u6570<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>-t\u00a0<\/strong><strong>\u8868\u540d\u79f0<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u6307\u5b9a\u914d\u7f6e\u54ea\u4e2a\u8868\uff0c\u6307\u5b9a\u914d\u7f6e\u8868\u540d\u79f0\u3002<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;append\/-A\u00a0<\/strong><strong>\u94fe\u540d\u79f0<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u9644\u52a0\u6216\u8ffd\u52a0\u4e0a\u76f8\u5e94\u89c4\u5219\u7b56\u7565\uff0c\u5230\u6307\u5b9a\u94fe(\u94fe\u540d\u79f0\u5fc5\u987b\u5927\u5199)\uff0c\u9ed8\u8ba4\u5c06\u914d\u7f6e\u7684\u89c4\u5219\u63d2\u5165\u5230\u6700\u540e\u4e00\u6761\u3002<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;check\/-C<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">Check for the existence of a rule<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;insert\/-I\u00a0<\/strong><strong>\u94fe\u540d\u79f0<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u63d2\u5165\u76f8\u5e94\u89c4\u5219\u7b56\u7565\uff0c\u5230\u6307\u5b9a\u94fe\u4e0a\uff0c\u9ed8\u8ba4\u5c06\u914d\u7f6e\u7684\u89c4\u5219\u63d2\u5165\u5230\u7b2c\u4e00\u6761\uff08\u53ef\u4ee5\u6839\u636e\u89c4\u5219\u5e8f\u53f7\u63d2\u5165\u5230\u6307\u5b9a\u4f4d\u7f6e\uff09&#8211;\u5c01IP\u5730\u5740\u4f7f\u7528\u3002<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;delete\/-D\u00a0<\/strong><strong>\u94fe\u540d\u79f0<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u5220\u9664\u6307\u5b9a\u7684\u89c4\u5219(\u53ef\u4ee5\u6839\u636e\u89c4\u5219\u5e8f\u53f7\u8fdb\u884c\u5220\u9664)<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;replace\/-R<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">Replace rule rulenum (1 = first) in chain<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>-P(<\/strong><strong>\u5927\u5199)<\/strong><strong>\u94fe\u540d\u79f0<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u6539\u53d8\u94fe\u4e0a\u7684\u6700\u7ec8\u9ed8\u8ba4\u89c4\u5219\u7b56\u7565<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;new\/-N<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u521b\u5efa\u65b0\u7684\u7528\u6237\u5b9a\u4e49\u94fe<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>-p\u00a0<\/strong><strong>\u534f\u8bae\u540d\u79f0<\/strong><\/p>\n<p align=\\\"center\\\"><strong>[!]\u00a0&#8211;proto<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u6307\u5b9a\u89c4\u5219\u7684\u534f\u8bae\u540d\u79f0\u00a0all tcp udp icmp<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;dport<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u6307\u5b9a\u5339\u914d\u7684\u76ee\u6807\u7aef\u53e3\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;sport<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u6307\u5b9a\u5339\u914d\u7684\u6e90\u7aef\u53e3\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td rowspan=\\\"7\\\" width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>-j\u00a0<\/strong><strong>\u52a8\u4f5c<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u5339\u914d\u6570\u636e\u5305\u540e\u7684\u52a8\u4f5c<\/td>\n<\/tr>\n<tr>\n<td colspan=\\\"2\\\" width=\\\"20%\\\">\n<p align=\\\"center\\\"><strong>ACCEPT<\/strong><\/p>\n<\/td>\n<td width=\\\"47%\\\">\u5141\u8bb8<\/td>\n<\/tr>\n<tr>\n<td colspan=\\\"2\\\" width=\\\"20%\\\">\n<p align=\\\"center\\\"><strong>DROP<\/strong><\/p>\n<\/td>\n<td width=\\\"47%\\\">\u4e22\u5f03(\u6ca1\u6709\u54cd\u5e94)<\/td>\n<\/tr>\n<tr>\n<td colspan=\\\"2\\\" width=\\\"20%\\\">\n<p align=\\\"center\\\"><strong>REJECT<\/strong><\/p>\n<\/td>\n<td width=\\\"47%\\\">\u62d2\u7edd(\u56de\u5e94\u8bf7\u6c42\u8005\u660e\u786e\u7684\u62d2\u7edd)<\/td>\n<\/tr>\n<tr>\n<td colspan=\\\"2\\\" width=\\\"20%\\\">\n<p align=\\\"center\\\"><strong>MASQUERADE<\/strong><\/p>\n<\/td>\n<td width=\\\"47%\\\">\u4f2a\u88c5\u4e0a\u7f51\u65f6\u4f7f\u7528<\/td>\n<\/tr>\n<tr>\n<td colspan=\\\"2\\\" width=\\\"20%\\\">\n<p align=\\\"center\\\"><strong>SNAT<\/strong><\/p>\n<\/td>\n<td width=\\\"47%\\\">\u5171\u4eab\u5730\u5740\u4e0a\u7f51<\/td>\n<\/tr>\n<tr>\n<td colspan=\\\"2\\\" width=\\\"20%\\\">\n<p align=\\\"center\\\"><strong>DNAT<\/strong><\/p>\n<\/td>\n<td width=\\\"47%\\\">\u76ee\u7684\u5730\u5740\u6539\u5199<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>-i<\/strong><\/p>\n<p align=\\\"center\\\"><strong>[!]\u00a0&#8211;in-interface<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u5728INPUT\u94fe\u914d\u7f6e\u89c4\u5219\u4e2d\uff0c\u6307\u5b9a\u4ece\u54ea\u4e00\u4e2a\u7f51\u5361\u63a5\u53e3\u8fdb\u5165\u7684\u6d41\u91cf\uff08\u53ea\u80fd\u914d\u7f6e\u5728INPUT\u94fe\u4e0a\uff09<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>-o<\/strong><\/p>\n<p align=\\\"center\\\"><strong>[!]\u00a0&#8211;out-interface<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u5728OUTPUT\u94fe\u914d\u7f6e\u89c4\u5219\u4e2d\uff0c\u6307\u5b9a\u4ece\u54ea\u4e00\u4e2a\u7f51\u63a5\u53e3\u51fa\u53bb\u7684\u6d41\u91cf\uff08\u53ea\u80fd\u914d\u7f6e\u5728OUTPUT\u94fe\u4e0a\uff09<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>-s<\/strong><\/p>\n<p align=\\\"center\\\">\u00a0<strong>[!] &#8211;source\u00a0<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u6307\u5b9a\u6e90IP\u5730\u5740\u6216\u6e90\u7f51\u6bb5\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>-d<\/strong><\/p>\n<p align=\\\"center\\\"><strong>[!]\u00a0&#8211;destination<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u6307\u5b9a\u76ee\u6807IP\u5730\u5740\u6216\u76ee\u6807\u7f51\u6bb5\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td colspan=\\\"4\\\" width=\\\"100%\\\"><strong>\u6269\u5c55\u53c2\u6570<\/strong><\/td>\n<\/tr>\n<tr>\n<td rowspan=\\\"4\\\" width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>-m\u00a0<\/strong><strong>\u6a21\u5757<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u8868\u793a\u589e\u52a0\u6269\u5c55\uff0c\u5339\u914d\u529f\u80fd\u6269\u5c55\u5339\u914d\uff08\u53ef\u4ee5\u52a0\u8f7d\u6269\u5c55\u53c2\u6570\uff09<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>multiport<\/strong><\/p>\n<\/td>\n<td colspan=\\\"2\\\" width=\\\"48%\\\">\u5b9e\u73b0\u4e0d\u8fde\u7eed\u591a\u7aef\u53e3\u6269\u5c55\u5339\u914d<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>icmp<\/strong><\/p>\n<\/td>\n<td colspan=\\\"2\\\" width=\\\"48%\\\">\u4f7f\u7528icmp\u7684\u6269\u5c55<\/td>\n<\/tr>\n<tr>\n<td width=\\\"18%\\\">\n<p align=\\\"center\\\"><strong>state<\/strong><\/p>\n<\/td>\n<td colspan=\\\"2\\\" width=\\\"48%\\\">\u72b6\u6001\u6a21\u5757\u6269\u5c55<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;icmp-type<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u53ea\u6709\u7c7b\u578b8\u662f\u771f\u6b63\u4f1a\u5f71\u54cdping\uff0c\u6216\u8005\u4e5f\u53ef\u4ee5\u91c7\u7528any\uff1b\u4e86\u89e3\u5f88\u591aicmp\u7c7b\u578b<em>iptables -p icmp -h<\/em><\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;limit n\/{second\/minute\/hour}<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u6307\u5b9a\u65f6\u95f4\u5185\u7684\u8bf7\u6c42\u901f\u7387\u201dn\u201d\u4e3a\u901f\u7387\uff0c\u540e\u9762\u4e3a\u65f6\u95f4\u5206\u522b\u4e3a\uff1a\u79d2\u00a0\u5206\u00a0\u65f6<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;limit-burst [n]<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u5728\u540c\u4e00\u65f6\u95f4\u5185\u5141\u8bb8\u901a\u8fc7\u7684\u8bf7\u6c42\u201dn\u201d\u4e3a\u6570\u5b57\uff0c\u4e0d\u6307\u5b9a\u9ed8\u8ba4\u4e3a5<\/td>\n<\/tr>\n<tr>\n<td width=\\\"32%\\\">\n<p align=\\\"center\\\"><strong>&#8211;exact\/-x<\/strong><\/p>\n<\/td>\n<td colspan=\\\"3\\\" width=\\\"67%\\\">\u6269\u5c55\u6570\u5b57\uff08\u663e\u793a\u7cbe\u786e\u6570\u503c\uff09<\/td>\n<\/tr>\n<tr>\n<td width=\\\"282\\\"><\/td>\n<td width=\\\"129\\\"><\/td>\n<td width=\\\"9\\\"><\/td>\n<td width=\\\"287\\\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>!<\/strong><strong>\u7684\u4f7f\u7528\u5b9e\u4f8b<\/strong><\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@clsn ~]# iptables ! -V\nNot 1.4.7 ;-)\n[root@clsn ~]# iptables  -V\niptables v1.4.7<\/pre>\n<\/div>\n<p>\u6ce8\u610f\uff1a\u5728iptables\u4e2d\u6240\u6709\u94fe\u540d\u5fc5\u987b\u5927\u5199\uff0c\u8868\u660e\u5fc5\u987b\u5c0f\u5199\uff0c\u52a8\u4f5c\u5fc5\u987b\u5927\u5199\uff0c\u5339\u914d\u5fc5\u987b\u5c0f\u5199\u3002<\/p>\n<h3><span id=\\\"152\\\">1.5.2\u00a0\u914d\u7f6e\u524d\u51c6\u5907<\/span><\/h3>\n<p>\u5728\u914d\u7f6e\u9632\u706b\u5899\u9996\u5148\u8981\u5176\u4e2d\u9632\u706b\u5899<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@clsn ~]# \/etc\/init.d\/iptables start\niptables: Applying firewall rules:                         [  OK  ]<\/pre>\n<\/div>\n<p>\u6e05\u9664iptables\u6240\u6709\u89c4\u5219<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@clsn ~]# iptables -Z\n[root@clsn ~]# iptables -X\n[root@clsn ~]# iptables -F<\/pre>\n<\/div>\n<p>\u67e5\u770biptables\u7684\u89c4\u5219<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@clsn ~]# iptables -nvL\nChain INPUT (policy ACCEPT 0 packets, 0 bytes)\n pkts bytes target     prot opt in     out     source               destination\nChain FORWARD (policy ACCEPT 0 packets, 0 bytes)\n pkts bytes target     prot opt in     out     source               destination\nChain OUTPUT (policy ACCEPT 0 packets, 0 bytes)\n pkts bytes target     prot opt in     out     source               destination<\/pre>\n<\/div>\n<p>\u67e5\u770b\u5176\u4ed6\u7684\u8868\u914d\u7f6e\uff08-t\u00a0\u53c2\u6570\uff09<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@clsn ~]# iptables -nL -t raw\nChain PREROUTING (policy ACCEPT)\ntarget     prot opt source               destination\nChain OUTPUT (policy ACCEPT)\ntarget     prot opt source               destination<\/pre>\n<\/div>\n<p>\u67e5\u770b\u914d\u7f6e\u89c4\u5219\u7684\u987a\u5e8f\u53f7<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@clsn ~]# iptables -nvL --number-list\n--line-number #  \u663e\u793a\u89c4\u5219\u7684\u5e8f\u53f7<\/pre>\n<\/div>\n<h2><span id=\\\"16_iptables_filter\\\">1.6 iptables filter\u8868\u914d\u7f6e\u5b9e\u4f8b<\/span><\/h2>\n<h3><span id=\\\"161\\\">1.6.1\u00a0\u57fa\u7840\u914d\u7f6e<\/span><\/h3>\n<p><strong>\u914d\u7f6e\u5b9e\u4f8b\u4e00\uff1a<\/strong>\u914d\u7f6e22\/ssh\u7aef\u53e3\u8bbf\u95ee\u63a7\u5236\u89c4\u5219<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A INPUT -p tcp --dprot 22 -j DROP     # \u7981\u6b62\u6240\u6709\u4eba\u8bbf\u95ee22\u7aef\u53e3\niptables -I INPUT -p tcp --dprot 22 -j ACCEPT   # \u6062\u590d\u8fde\u63a5\u65b9\u6cd5\niptables -I INPUT 2 -p tcp --dprot 22 -j ACCEPT # \u901a\u8fc7\u63d2\u5165\u6307\u5b9a\u884c\u53f7\u4fe1\u606f\uff0c\u6307\u5b9a\u5c06\u89c4\u5219\u63d2\u5165\u5230\u7b2c\u51e0\u884c\niptables -D INPUT -p tcp --dport 22 -j ACCEPT   # \u5220\u9664\u6307\u5b9a\u89c4\u5219\niptables -D INPUT 2                             # \u6839\u636e\u89c4\u5219\u884c\u53f7\uff0c\u5220\u9664\u76f8\u5e94\u7684\u89c4\u5219<\/pre>\n<\/div>\n<p>\u53ea\u5141\u8bb810.0.0.1\u7684ip\u901a\u8fc7ssh\u8fde\u63a5\u8fd9\u53f0\u670d\u52a1\u5668<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -I INPUT -s 10.0.0.1 -p tcp --dport 22 -j ACCEPT<\/pre>\n<\/div>\n<p>\u914d\u7f6e\u5b9e\u4f8b\u4e8c\uff1a\u7981\u6b62\u7f51\u6bb5\u8fde\u5165\uff08\u7981\u6b62172.16.1.0\u7f51\u6bb5\u8bbf\u95ee172.16.1.188\uff09<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A INPUT  -s 172.16.1.0\/24 -d 172.16.1.188  -j DROP<\/pre>\n<\/div>\n<p>\u914d\u7f6e\u5b9e\u4f8b\u4e09\uff1a\u7981\u6b62\u67d0\u4e2a172.16.1.0\u7f51\u6bb5\u8bbf\u95ee\u670d\u52a1\u5668\u4e3b\u673a\u768422\u7aef\u53e3<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A INPUT -s 172.16.1.0\/24 -d 172.16.1.188  -p tcp --dport 22 -j DROP<\/pre>\n<\/div>\n<p>\u65b9\u5411\u8bf4\u660e\uff1a<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre># \u5728\u5165\u65b9\u5411\u63a7\u5236\niptables -I INPUT -i eth0  -p tcp --dport 22 -j ACCEPT\n# \u5728\u51fa\u65b9\u5411\u63a7\u5236\niptables -I OUTPUT -o eth0  -p tcp --sport 22 -j DROP<\/pre>\n<\/div>\n<h3><span id=\\\"162_10000\\\">1.6.2\u00a0\u914d\u7f6e\u5b9e\u4f8b\u56db\uff1a\u966410.0.0.0\u7f51\u6bb5\u53ef\u4ee5\u8fdb\u884c\u8fde\u63a5\u670d\u52a1\u5668\u4e3b\u673a\u610f\u5916\uff0c\u5176\u4f59\u7f51\u6bb5\u90fd\u7981\u6b62<\/span><\/h3>\n<p><em>\u00a0<\/em><em>\u7b2c\u4e00\u79cd\u65b9\u5f0f\uff1a<\/em><\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A INPUT -s 10.0.0.0\/24 -d 172.16.1.8  -j ACCEPT<\/pre>\n<\/div>\n<p>\u4fee\u6539\u9ed8\u8ba4\u89c4\u5219\uff0c\u5c06\u9ed8\u8ba4\u89c4\u5219\u6539\u4e3a\u62d2\u7edd<br \/>\n<em>\u7b2c\u4e8c\u79cd\u65b9\u5f0f\uff1a<\/em><br \/>\n\uff01\u00a0 &#8212;\u00a0\u8868\u793a\u5bf9\u89c4\u5219\u4fe1\u606f\u8fdb\u884c\u53d6\u53cd<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A INPUT ! -s 10.0.0.0\/24 -d 172.16.1.8  -j DROP   --- centos6\u7528\u6cd5\niptables -A INPUT -s ! 10.0.0.0\/24 -d 172.16.1.8  -j DROP   --- centos5\u7528\u6cd5<\/pre>\n<\/div>\n<p>\u8bf4\u660e\uff1a\u53ea\u6709iptables\u5e2e\u52a9\u624b\u518c\u4e2d\u6307\u5b9a\u7684\u53c2\u6570\u53ef\u4ee5\u7528\u53d6\u53cd\u7b26\u53f7\uff08iptables &#8211;help\uff09<\/p>\n<h3><span id=\\\"163\\\">1.6.3\u00a0\u914d\u7f6e\u5b9e\u4f8b\u4e94\uff1a\u6d4b\u8bd5\u5339\u914d\u5217\u4e3e\u7aef\u53e3\u8303\u56f4\u3002<\/span><\/h3>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A INPUT -p tcp --dport 22:80 -j DROP                 # \u8bbe\u7f6e\u8fde\u7eed\u591a\u7aef\u53e3\u63a7\u5236\u7b56\u7565\niptables -A INPUT -p tcp -m multiport  --dport 22,80 -j DROP   # \u8bbe\u7f6e\u4e0d\u8fde\u7eed\u591a\u7aef\u53e3\u63a7\u5236\u7b56\u7565<\/pre>\n<\/div>\n<p>-m\u00a0\u53c2\u6570\u8868\u793a\u589e\u52a0\u6269\u5c55\u5339\u914d\u529f\u80fd\uff0cmultiport\u00a0\u5b9e\u73b0\u4e0d\u8fde\u7eed\u591a\u7aef\u53e3\u6269\u5c55\u5339\u914d<\/p>\n<h3><span id=\\\"164_ICMP\\\">1.6.4\u00a0\u914d\u7f6e\u5b9e\u4f8b\u516d\uff1a\u5339\u914dICMP\u7c7b\u578b<\/span><\/h3>\n<p>\u7981\u6b62ping\u7b56\u7565\u539f\u5219<br \/>\niptables\u670d\u52a1\u5668\u662fping\u547d\u4ee4\u53d1\u8d77\u8005\u6216\u662f\u63a5\u53d7\u8005<br \/>\n<strong>\u53d1\u8d77\u8005\uff1a<\/strong><br \/>\ninput\u94fe\uff1a\u00a0\u7981\u6b62icmp-type 0<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A INPUT -i eth0 -p icmp --icmp-type 0 -j DROP<\/pre>\n<\/div>\n<p>output\u94fe\uff1a\u00a0\u7981\u6b62icmp-type 8<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A OUTPUT -o eth0 -p icmp --icmp-type 8 -j DROP<\/pre>\n<\/div>\n<p><strong>\u00a0\u00a0\u00a0<\/strong><strong>\u63a5\u53d7\u8005\uff1a<\/strong><br \/>\ninput\u94fe\uff1a\u00a0\u7981\u6b62icmp-type 8<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A INPUT -i eth0 -p icmp --icmp-type 8 -j DROP<\/pre>\n<\/div>\n<p>output\u94fe\uff1a\u00a0\u7981\u6b62icmp-type 0<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A OUTPUT -o eth0 -p icmp --icmp-type 0 -j DROP<\/pre>\n<\/div>\n<p>\u7b80\u5316\u914d\u7f6e\uff1a<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A INPUT -i eth0 -p icmp -m icmp --icmp-type any -j DROP  #\u7981\u6b62\u6240\u6709\u7c7b\u578b\u7684icmp<\/pre>\n<\/div>\n<p>\u6307\u5b9a\u7c7b\u578b\u7981\u6b62icmp<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A INPUT -p icmp --icmp-type 8\niptables -A INPUT -p icmp --icmp-type 8 -j DROP\niptables -A INPUT -p icmp -m icmp --icmp-type any -j ACCEPT\niptables -A FORWARD -s 192.168.1.0\/24 -p icmp -m icmp --icmp-type any -j ACCEPT<\/pre>\n<\/div>\n<p>\u8bf4\u660e\uff1a\u53ea\u6709\u7c7b\u578b8\u662f\u771f\u6b63\u4f1a\u5f71\u54cdping\uff0c\u6216\u8005\u4e5f\u53ef\u4ee5\u91c7\u7528any\uff1b\u4e86\u89e3\u5f88\u591aicmp\u7c7b\u578biptables -p icmp -h<br \/>\n<strong>ICMP<\/strong><strong>\u7c7b\u578b\u7684\u8bf4\u660e<\/strong><\/p>\n<table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\n<tbody>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">TYPE<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">CODE<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Description<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">Query<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">Error<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>0<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Echo Reply\u2014\u2014\u56de\u663e\u5e94\u7b54\uff08Ping\u5e94\u7b54\uff09<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Network Unreachable\u2014\u2014\u7f51\u7edc\u4e0d\u53ef\u8fbe<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">1<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Host Unreachable\u2014\u2014\u4e3b\u673a\u4e0d\u53ef\u8fbe<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">2<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Protocol Unreachable\u2014\u2014\u534f\u8bae\u4e0d\u53ef\u8fbe<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">3<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Port Unreachable\u2014\u2014\u7aef\u53e3\u4e0d\u53ef\u8fbe<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">4<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Fragmentation needed but no frag. bit set\u2014\u2014\u9700\u8981\u8fdb\u884c\u5206\u7247\u4f46\u8bbe\u7f6e\u4e0d\u5206\u7247\u6bd4\u7279<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">5<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Source routing failed\u2014\u2014\u6e90\u7ad9\u9009\u8def\u5931\u8d25<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">6<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Destination network unknown\u2014\u2014\u76ee\u7684\u7f51\u7edc\u672a\u77e5<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">7<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Destination host unknown\u2014\u2014\u76ee\u7684\u4e3b\u673a\u672a\u77e5<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">8<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Source host isolated (obsolete)\u2014\u2014\u6e90\u4e3b\u673a\u88ab\u9694\u79bb\uff08\u4f5c\u5e9f\u4e0d\u7528\uff09<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">9<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Destination network administratively prohibited\u2014\u2014\u76ee\u7684\u7f51\u7edc\u88ab\u5f3a\u5236\u7981\u6b62<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">10<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Destination host administratively prohibited\u2014\u2014\u76ee\u7684\u4e3b\u673a\u88ab\u5f3a\u5236\u7981\u6b62<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">11<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Network unreachable for TOS\u2014\u2014\u7531\u4e8e\u670d\u52a1\u7c7b\u578bTOS\uff0c\u7f51\u7edc\u4e0d\u53ef\u8fbe<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">12<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Host unreachable for TOS\u2014\u2014\u7531\u4e8e\u670d\u52a1\u7c7b\u578bTOS\uff0c\u4e3b\u673a\u4e0d\u53ef\u8fbe<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">13<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Communication administratively prohibited by filtering\u2014\u2014\u7531\u4e8e\u8fc7\u6ee4\uff0c\u901a\u4fe1\u88ab\u5f3a\u5236\u7981\u6b62<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">14<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Host precedence violation\u2014\u2014\u4e3b\u673a\u8d8a\u6743<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>3<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">15<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Precedence cutoff in effect\u2014\u2014\u4f18\u5148\u4e2d\u6b62\u751f\u6548<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>4<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Source quench\u2014\u2014\u6e90\u7aef\u88ab\u5173\u95ed\uff08\u57fa\u672c\u6d41\u63a7\u5236\uff09<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>5<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Redirect for network\u2014\u2014\u5bf9\u7f51\u7edc\u91cd\u5b9a\u5411<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>5<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">1<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Redirect for host\u2014\u2014\u5bf9\u4e3b\u673a\u91cd\u5b9a\u5411<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>5<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">2<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Redirect for TOS and network\u2014\u2014\u5bf9\u670d\u52a1\u7c7b\u578b\u548c\u7f51\u7edc\u91cd\u5b9a\u5411<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>5<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">3<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Redirect for TOS and host\u2014\u2014\u5bf9\u670d\u52a1\u7c7b\u578b\u548c\u4e3b\u673a\u91cd\u5b9a\u5411<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>8<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Echo request\u2014\u2014\u56de\u663e\u8bf7\u6c42\uff08Ping\u8bf7\u6c42\uff09<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>9<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Router advertisement\u2014\u2014\u8def\u7531\u5668\u901a\u544a<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>10<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Route solicitation\u2014\u2014\u8def\u7531\u5668\u8bf7\u6c42<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>11<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">TTL equals 0 during transit\u2014\u2014\u4f20\u8f93\u671f\u95f4\u751f\u5b58\u65f6\u95f4\u4e3a0<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>11<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">1<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">TTL equals 0 during reassembly\u2014\u2014\u5728\u6570\u636e\u62a5\u7ec4\u88c5\u671f\u95f4\u751f\u5b58\u65f6\u95f4\u4e3a0<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>12<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">IP header bad (catchall error)\u2014\u2014\u574f\u7684IP\u9996\u90e8\uff08\u5305\u62ec\u5404\u79cd\u5dee\u9519\uff09<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>12<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">1<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Required options missing\u2014\u2014\u7f3a\u5c11\u5fc5\u9700\u7684\u9009\u9879<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>13<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Timestamp request (obsolete)\u2014\u2014\u65f6\u95f4\u6233\u8bf7\u6c42\uff08\u4f5c\u5e9f\u4e0d\u7528\uff09<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>14<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Timestamp reply (obsolete)\u2014\u2014\u65f6\u95f4\u6233\u5e94\u7b54\uff08\u4f5c\u5e9f\u4e0d\u7528\uff09<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>15<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Information request (obsolete)\u2014\u2014\u4fe1\u606f\u8bf7\u6c42\uff08\u4f5c\u5e9f\u4e0d\u7528\uff09<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>16<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Information reply (obsolete)\u2014\u2014\u4fe1\u606f\u5e94\u7b54\uff08\u4f5c\u5e9f\u4e0d\u7528\uff09<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>17<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Address mask request\u2014\u2014\u5730\u5740\u63a9\u7801\u8bf7\u6c42<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">x<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\"><strong>18<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\">\n<p align=\\\"center\\\">0<\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"56%\\\">Address mask reply\u2014\u2014\u5730\u5740\u63a9\u7801\u5e94\u7b54<\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\"><\/td>\n<td valign=\\\"top\\\" width=\\\"11%\\\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p align=\\\"right\\\">\u6570\u636e\u6765\u6e90\uff1ahttp:\/\/www.cnitblog.com\/yang55xiaoguang\/articles\/59581.html<\/p>\n<h3><span id=\\\"165\\\">1.6.5\u00a0\u9632\u706b\u5899\u72b6\u6001\u673a\u5236\u914d\u7f6e<\/span><\/h3>\n<p>\u72b6\u6001\u96c6\u7b80\u5355\u8bf4\u660e:<\/p>\n<table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\n<tbody>\n<tr>\n<td valign=\\\"top\\\" width=\\\"50%\\\">\n<p align=\\\"center\\\"><strong>\u72b6\u6001\u96c6<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"50%\\\">\n<p align=\\\"center\\\"><strong>\u8bf4\u660e<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"50%\\\">\n<p align=\\\"center\\\"><strong>NEW<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"50%\\\">\u8868\u793a\u65b0\u5efa\u7acb\u8fde\u63a5\u7684\u6570\u636e\u5305\u72b6\u6001<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"50%\\\">\n<p align=\\\"center\\\"><strong>ESTABLISHED<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"50%\\\">\u8868\u793a\u65b0\u5efa\u7acb\u8fde\u63a5\u6570\u636e\u5305\u53d1\u9001\u4e4b\u540e\uff0c\u56de\u590d\u54cd\u5e94\u7684\u6570\u636e\u5305\u72b6\u6001<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"50%\\\">\n<p align=\\\"center\\\"><strong>RELATED<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"50%\\\">\u8868\u793a\u501f\u52a9\u5df2\u7ecf\u5efa\u7acb\u7684\u94fe\u8def\uff0c\u53d1\u9001\u65b0\u7684\u8fde\u63a5\u6570\u636e\u5305<\/td>\n<\/tr>\n<tr>\n<td valign=\\\"top\\\" width=\\\"50%\\\">\n<p align=\\\"center\\\"><strong>INVALID<\/strong><\/p>\n<\/td>\n<td valign=\\\"top\\\" width=\\\"50%\\\">\u65e0\u6548\u65e0\u6cd5\u8bc6\u522b\u7684\u6570\u636e\u5305<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6ce8\u610f\uff1a\u5141\u8bb8\u5173\u8054\u7684\u72b6\u6001\u5305\u901a\u8fc7\uff08web\u670d\u52a1\u4e0d\u8981\u4f7f\u7528FTP\u670d\u52a1\uff09<br \/>\n\u9632\u706b\u5899\u670d\u52a1\u914d\u7f6e\u5728FTP\u670d\u52a1\u5668\u4e0a\u65f6\uff0c\u9700\u8981\u914d\u7f6e\u4ee5\u4e0b\u7b56\u7565<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\niptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT<\/pre>\n<\/div>\n<p>\u5b9e\u73b0\u53d1\u73b0sent_syn\u72b6\u6001<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A INPUT -m state --state NEW -j DROP    # \u9632\u706b\u5899\u6240\u8fde\u63a5\u5ba2\u6237\u7aef\u4e0a\u914d\u7f6e<\/pre>\n<\/div>\n<p>\u5b9e\u73b0\u53d1\u73b0sent_rcvd\u72b6\u6001<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -I INPUT -i eth0 -s 10.0.0.201 -m state --state ESTABLISHED -j DROP  # \u9632\u62a4\u5899\u4e0a\u914d\u7f6e\u7684<\/pre>\n<\/div>\n<h3><span id=\\\"166_iptables\\\">1.6.6\u00a0\u4f7f\u7528iptables\u5b9e\u73b0\u9650\u901f\u529f\u80fd<\/span><\/h3>\n<p>limit\u662fiptables\u7684\u4e00\u4e2a\u5339\u914d\u6a21\u5757\uff0c\u7528\u5b83\u7ed3\u5408iptables\u7684\u5176\u5b83\u547d\u4ee4\u53ef\u4ee5\u5b9e\u73b0\u9650\u901f\u7684\u529f\u80fd\u3002<br \/>\n\u4e0d\u8fc7\u9996\u5148\u5fc5\u987b\u660e\u786e\uff0climit\u672c\u8eab\u53ea\u662f\u4e00\u4e2a\u201c\u5339\u914d\u201d\u6a21\u5757\u3002\u6211\u4eec\u77e5\u9053\uff0ciptables\u7684\u57fa\u672c\u539f\u7406\u662f\u201c\u5339\u914d&#8211;\u5904\u7406\u201d\uff0climit\u5728\u8fd9\u4e2a\u5de5\u4f5c\u8fc7\u7a0b\u4e2d\u53ea\u80fd\u8d77\u5230\u5339\u914d\u7684\u4f5c\u7528\uff0c\u5b83\u672c\u8eab\u662f\u65e0\u6cd5\u5bf9\u7f51\u7edc\u6570\u636e\u5305\u8fdb\u884c\u4efb\u4f55\u5904\u7406\u7684\u3002\u6211\u770b\u5230\u7f51\u4e0a\u6709\u4e9blimit\u7684\u4f8b\u5b50\u91cc\u9762\u8bf4\u53ea\u00a0\u7528\u4e00\u6761\u5305\u542blimit\u5339\u914d\u89c4\u5219\u7684iptables\u8bed\u53e5\u5c31\u53ef\u4ee5\u5b9e\u73b0\u9650\u901f\uff0c\u90a3\u662f\u9519\u8bef\u7684\u3002<br \/>\n\u5b9e\u9645\u4e0a\uff0c\u5229\u7528imit\u6765\u9650\u901f\u9700\u8981\u5305\u62ec\u4e24\u4e2a\u6b65\u9aa4:<br \/>\n1.\u5bf9\u7b26\u5408limit\u5339\u914d\u89c4\u5219\u5305\u653e\u884c<br \/>\n2.\u4e22\u5f03\/\u62d2\u7edd\u672a\u653e\u884c\u7684\u5305<br \/>\n\u793a\u4f8b\uff1a<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -I INPUT -s 10.0.0.7 -p icmp --icmp-type 8 -m limit --limit 6\/min --limit-burst 5 -j ACCEPT\niptables -I INPUT -s 10.0.0.7 -p icmp --icmp-type 8 -j DROP<\/pre>\n<\/div>\n<p>\u8bed\u53e5\u542b\u4e49\uff1a\u5f53\u6765\u81ea10.0.0.7\u00a0\u7684ping\u5305\u8d85\u8fc75\u4e2a\u65f6\u8fdb\u884c\u9650\u901f\uff0c\u9650\u5236\u4e3a\u6bcf10s\u4e00\u4e2a\u3002<br \/>\n\u53c2\u6570\u8bf4\u660e\uff1a<\/p>\n<table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\n<tbody>\n<tr>\n<td width=\\\"44%\\\">\n<p align=\\\"center\\\"><strong>\u53c2\u6570<\/strong><\/p>\n<\/td>\n<td width=\\\"55%\\\">\n<p align=\\\"center\\\"><strong>\u53c2\u6570\u542b\u4e49<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\\\"44%\\\"><strong>&#8211;limit n\/{second\/minute\/hour}<\/strong><\/td>\n<td width=\\\"55%\\\">\u6307\u5b9a\u65f6\u95f4\u5185\u7684\u8bf7\u6c42\u901f\u7387\u201dn\u201d\u4e3a\u901f\u7387\uff0c\u540e\u9762\u4e3a\u65f6\u95f4\u5206\u522b\u4e3a\uff1a\u79d2\u00a0\u5206\u00a0\u65f6<\/td>\n<\/tr>\n<tr>\n<td width=\\\"44%\\\"><strong>&#8211;limit-burst [n]<\/strong><\/td>\n<td width=\\\"55%\\\">\u5728\u540c\u4e00\u65f6\u95f4\u5185\u5141\u8bb8\u901a\u8fc7\u7684\u8bf7\u6c42\u201dn\u201d\u4e3a\u6570\u5b57\uff0c\u4e0d\u6307\u5b9a\u9ed8\u8ba4\u4e3a5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>limit<\/strong><strong>\u6a21\u5757\u5177\u4f53\u662f\u5982\u4f55\u5de5\u4f5c\u7684\u3002\uff1f<\/strong><br \/>\nlimit\u7684\u5339\u914d\u662f\u57fa\u4e8e\u4ee4\u724c\u6876\u00a0(Token bucket\uff09\u6a21\u578b\u7684\u3002<br \/>\n\u4ee4\u724c\u6876\u662f\u4e00\u79cd\u7f51\u7edc\u901a\u8baf\u4e2d\u5e38\u89c1\u7684\u7f13\u51b2\u533a\u5de5\u4f5c\u539f\u7406\uff0c\u5b83\u6709\u4e24\u4e2a\u91cd\u8981\u7684\u53c2\u6570\uff0c\u4ee4\u724c\u6876\u5bb9\u91cfn\u548c\u4ee4\u724c\u4ea7\u751f\u901f\u7387s\u3002<\/p>\n<blockquote><p>\u6211\u4eec\u53ef\u4ee5\u628a\u4ee4\u724c\u5f53\u6210\u662f\u95e8\u7968\uff0c\u800c\u4ee4\u724c\u6876\u5219\u662f\u8d1f\u8d23\u5236\u4f5c\u548c\u53d1\u653e\u95e8\u7968\u7684\u7ba1\u7406\u5458\uff0c\u5b83\u624b\u91cc\u6700\u591a\u6709n\u5f20\u4ee4\u724c\u3002\u4e00\u5f00\u59cb\uff0c\u7ba1\u7406\u5458\u5f00\u59cb\u624b\u91cc\u6709n\u5f20\u4ee4\u724c\u3002\u6bcf\u5f53\u4e00\u4e2a\u6570\u636e\u5305\u5230\u8fbe\u540e\uff0c\u7ba1\u7406\u5458\u5c31\u770b\u770b\u624b\u91cc\u662f\u5426\u8fd8\u6709\u53ef\u7528\u7684\u4ee4\u724c\u3002\u5982\u679c\u6709\uff0c\u5c31\u628a\u4ee4\u724c\u53d1\u7ed9\u8fd9\u4e2a\u6570\u636e\u5305\uff0climit\u5c31\u544a\u8bc9iptables\uff0c\u8fd9\u4e2a\u6570\u636e\u5305\u88ab\u5339\u914d\u4e86\u3002\u800c\u5f53\u7ba1\u7406\u5458\u628a\u624b\u4e0a\u6240\u6709\u7684\u4ee4\u724c\u90fd\u53d1\u5b8c\u4e86\uff0c\u518d\u6765\u7684\u6570\u636e\u5305\u5c31\u62ff\u4e0d\u5230\u4ee4\u724c\u4e86\u3002\u8fd9\u65f6\uff0climit\u6a21\u5757\u5c31\u544a\u8bc9iptables\uff0c\u8fd9\u4e2a\u6570\u636e\u5305\u4e0d\u80fd\u88ab\u5339\u914d\u3002\u9664\u4e86\u53d1\u653e\u4ee4\u724c\u4e4b\u5916\uff0c\u53ea\u8981\u4ee4\u724c\u6876\u4e2d\u7684\u4ee4\u724c\u6570\u91cf\u5c11\u4e8en\uff0c\u5b83\u5c31\u4f1a\u4ee5\u901f\u7387s\u6765\u4ea7\u751f\u65b0\u7684\u4ee4\u724c\uff0c\u76f4\u5230\u4ee4\u724c\u6570\u91cf\u5230\u8fben\u4e3a\u6b62\u3002<\/p><\/blockquote>\n<p>\u901a\u8fc7\u4ee4\u724c\u6876\u673a\u5236\uff0c\u5373\u53ef\u4ee5\u6709\u6548\u7684\u63a7\u5236\u5355\u4f4d\u65f6\u95f4\u5185\u901a\u8fc7\uff08\u5339\u914d\uff09\u7684\u6570\u636e\u5305\u6570\u91cf\uff0c\u53c8\u53ef\u4ee5\u5bb9\u8bb8\u77ed\u65f6\u95f4\u5185\u7a81\u53d1\u7684\u5927\u91cf\u6570\u636e\u5305\u7684\u901a\u8fc7\uff08\u53ea\u8981\u6570\u636e\u5305\u6570\u91cf\u4e0d\u8d85\u8fc7\u4ee4\u724c\u6876n\uff09\u3002<br \/>\nlimit\u6a21\u5757\u63d0\u4f9b\u4e86\u4e24\u4e2a\u53c2\u6570&#8211;limit\u548c&#8211;limit-burst\uff0c\u5206\u522b\u5bf9\u5e94\u4e8e\u4ee4\u724c\u4ea7\u751f\u901f\u7387\u548c\u4ee4\u724c\u6876\u5bb9\u91cf\u3002\u9664\u4e86\u4ee4\u724c\u6876\u6a21\u578b\u5916\uff0climit\u5339\u914d\u7684\u53e6\u5916\u4e00\u4e2a\u91cd\u8981\u6982\u5ff5\u662f\u5339\u914d\u9879\u3002\u5728limit\u4e2d\uff0c\u6bcf\u4e2a\u5339\u914d\u9879\u62e5\u6709\u4e00\u4e2a\u5355\u72ec\u7684\u4ee4\u724c\u6876\uff0c\u6267\u884c\u72ec\u7acb\u7684\u5339\u914d\u8ba1\u7b97\u3002<\/p>\n<h3><span id=\\\"167\\\">1.6.7\u00a0\u4f01\u4e1a\u7ea7\u9632\u706b\u5899\u914d\u7f6e<\/span><\/h3>\n<p>\u6e05\u9664\u9632\u706b\u5899\u89c4\u5219<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@clsn ~]# iptables -F\n[root@clsn ~]# iptables -X\n[root@clsn ~]# iptables -Z<\/pre>\n<\/div>\n<p>\u4fee\u6539\u9ed8\u8ba4\u89c4\u5219\u4e3a\u62d2\u7edd\uff08\u4fee\u6539\u524d\u5148\u653e\u884c22\u7aef\u53e3\uff0c\u4fdd\u8bc1\u81ea\u5df1\u80fd\u591f\u8fde\u4e0a\u4e3b\u673a\uff09<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@clsn ~]# iptables -A INPUT -p tcp --dport  22 -j ACCEPT\n[root@clsn ~]# iptables -P INPUT DROP\n[root@clsn ~]# iptables -P FORWARD DROP<\/pre>\n<\/div>\n<p>\u653e\u884c\u6307\u5b9a\u7684\u7aef\u53e3<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@clsn ~]# iptables -A INPUT -i lo -j ACCEPT\n[root@clsn ~]# iptables -A INPUT  -p tcp  -m multiport --dport  80,443 -j ACCEPT\n[root@clsn ~]# iptables -A INPUT -s 172.16.1.0\/24 -j ACCEPT\n[root@clsn ~]# iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT<\/pre>\n<\/div>\n<p><strong>\u4fdd\u5b58iptables<\/strong><strong>\u914d\u7f6e<\/strong><br \/>\n01.\u00a0\u7b2c\u4e00\u79cd\u65b9\u5f0f<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@clsn ~]# \/etc\/init.d\/iptables save\niptables: Saving firewall rules to \/etc\/sysconfig\/iptables:[  OK  ]\n[root@clsn ~]# cat \/etc\/sysconfig\/iptables\n# Generated by iptables-save v1.4.7 on Tue Apr  4 12:24:43 2017\n*filter\n:INPUT DROP [0:0]\n:FORWARD DROP [0:0]\n:OUTPUT ACCEPT [159:10664]\n-A INPUT -s 10.0.0.0\/24 -j ACCEPT\n-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT\n-A INPUT -p tcp -m multiport --dports 80,443 -j ACCEPT\n-A INPUT -s 172.16.1.0\/24 -j ACCEPT\n-A INPUT -i lo -j ACCEPT\n-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT\nCOMMIT\n# Completed on Tue Apr  4 12:24:43 2017<\/pre>\n<\/div>\n<p>02.\u00a0\u7b2c\u4e8c\u79cd\u65b9\u5f0f<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables-save &gt;\/etc\/sysconfig\/iptables<\/pre>\n<\/div>\n<h2><span id=\\\"17_iptables_nat\\\">1.7 iptables nat\u8868\u914d\u7f6e\u5b9e\u4f8b<\/span><\/h2>\n<h3><span id=\\\"171_iptables\\\">1.7.1 iptables\u5b9e\u73b0\u5171\u4eab\u4e0a\u7f51<\/span><\/h3>\n<p align=\\\"center\\\">\u00a0<img src=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118095907193-681615791.png\\\" alt=\\\"\u4f01\u4e1a\u9632\u706b\u5899\u4e4biptables\\\" data-original=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118095907193-681615791.png\\\" \/><\/p>\n<p align=\\\"center\\\">\u56fe\u00a0&#8211; SNAT\u00a0\u914d\u7f6e\u539f\u7406\u56fe<\/p>\n<p>\u7b2c\u4e00\u4e2a\u91cc\u7a0b\u7891\uff1a\u914d\u7f6e\u5185\u7f51\u670d\u52a1\u5668\uff0c\u8bbe\u7f6e\u7f51\u5173\u5730\u5740<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>\/etc\/init.d\/iptables stop      # \u5185\u7f51\u670d\u52a1\u5668\u505c\u6b62\u9632\u706b\u5899\u670d\u52a1\nifdown eth0                    # \u6a21\u62df\u5173\u95ed\u5185\u7f51\u670d\u52a1\u5668\u5916\u7f51\u7f51\u5361\nsetup                          # \u4fee\u6539\u5185\u7f51\u7f51\u5361\u7f51\u5173\u548cDNS\u5730\u5740\u4fe1\u606f<\/pre>\n<\/div>\n<p>\u4e5f\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u6dfb\u52a0\u9ed8\u8ba4\u7f51\u5173<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>route add default gw 172.16.1.188<\/pre>\n<\/div>\n<p>\u67e5\u770b\u9ed8\u8ba4\u7684\u8def\u7531\u4fe1\u606f<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@test ~]# route -n\nKernel IP routing table\nDestination     Gateway         Genmask         Flags Metric Ref    Use Iface\n172.16.1.0      0.0.0.0         255.255.255.0   U     0      0        0 eth1\n169.254.0.0     0.0.0.0         255.255.0.0     U     1003   0        0 eth1\n0.0.0.0         172.16.1.188    0.0.0.0         UG    0      0        0 eth1<\/pre>\n<\/div>\n<p>\u8bf4\u660e\uff1a\u5185\u7f51\u670d\u52a1\u5668\u7f51\u5173\u5730\u5740\u6307\u5b9a\u4e3a\u5171\u4eab\u4e0a\u7f51\u670d\u52a1\u5668\u5185\u7f51\u7f51\u5361\u5730\u5740<br \/>\n\u7b2c\u4e8c\u4e2a\u91cc\u7a0b\u7891\uff1a\u914d\u7f6e\u5171\u4eab\u4e0a\u7f51\u670d\u52a1\u5668\uff0c\u5f00\u542f\u5171\u4eab\u4e0a\u7f51\u670d\u52a1\u5668\u8def\u7531\u8f6c\u53d1\u529f\u80fd<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>[root@clsn ~]# vim \/etc\/sysctl.conf\n[root@clsn ~]# sysctl -p\n~~~\nnet.ipv4.ip_forward = 1\n~~~<\/pre>\n<\/div>\n<p>\u7b2c\u4e09\u4e2a\u91cc\u7a0b\u7891\uff1a\u914d\u7f6e\u5171\u4eab\u4e0a\u7f51\u670d\u52a1\u5668\uff0c\u5b9e\u73b0\u5185\u7f51\u8bbf\u95ee\u5916\u7f51\u7684NAT\u6620\u5c04<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -t nat -A POSTROUTING -s 172.16.1.0\/24 -o eth0 -j SNAT --to-source 10.0.0.188<\/pre>\n<\/div>\n<p>\u53c2\u6570\u8be6\u89e3\uff1a<\/p>\n<table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\n<tbody>\n<tr>\n<td width=\\\"37%\\\">\n<p align=\\\"center\\\"><strong>\u53c2\u6570<\/strong><\/p>\n<\/td>\n<td width=\\\"62%\\\">\n<p align=\\\"center\\\"><strong>\u53c2\u6570\u8bf4\u660e<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\\\"37%\\\"><strong>-s 172.16.1.0\/24<\/strong><\/td>\n<td width=\\\"62%\\\">\u6307\u5b9a\u5c06\u54ea\u4e9b\u5185\u7f51\u7f51\u6bb5\u8fdb\u884c\u6620\u5c04\u8f6c\u6362<\/td>\n<\/tr>\n<tr>\n<td width=\\\"37%\\\"><strong>-o eth0<\/strong><\/td>\n<td width=\\\"62%\\\">\u6307\u5b9a\u5728\u5171\u4eab\u4e0a\u7f51\u54ea\u4e2a\u7f51\u5361\u63a5\u53e3\u4e0a\u505aNAT\u5730\u5740\u8f6c\u6362<\/td>\n<\/tr>\n<tr>\n<td width=\\\"37%\\\"><strong>-j SNAT<\/strong><\/td>\n<td width=\\\"62%\\\">\u5c06\u6e90\u5730\u5740\u8fdb\u884c\u8f6c\u6362\u53d8\u66f4<\/td>\n<\/tr>\n<tr>\n<td width=\\\"37%\\\"><strong>-j DNAT<\/strong><\/td>\n<td width=\\\"62%\\\">\u5c06\u76ee\u6807\u5730\u5740\u8fdb\u884c\u8f6c\u6362\u53d8\u66f4<\/td>\n<\/tr>\n<tr>\n<td width=\\\"37%\\\"><strong>&#8211;to-source ip<\/strong><strong>\u5730\u5740<\/strong><\/td>\n<td width=\\\"62%\\\">\u5c06\u6e90\u5730\u5740\u6620\u5c04\u4e3a\u4ec0\u4e48IP\u5730\u5740<\/td>\n<\/tr>\n<tr>\n<td width=\\\"37%\\\"><strong>&#8211;to-destination ip<\/strong><strong>\u5730\u5740<\/strong><\/td>\n<td width=\\\"62%\\\">\u5c06\u76ee\u6807\u5730\u5740\u6620\u5c04\u4e3a\u4ec0\u4e48IP\u5730\u5740<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5f53filter\u8868\u4e2d\u7684forward\u9ed8\u8ba4\u4e3adrop\u7b56\u7565\u65f6\uff0c\u5982\u4f55\u914d\u7f6eforward\u94fe\uff1f<\/p>\n<p align=\\\"center\\\">\u00a0<img src=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100154553-999721017.png\\\" alt=\\\"\u4f01\u4e1a\u9632\u706b\u5899\u4e4biptables\\\" data-original=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100154553-999721017.png\\\" \/><\/p>\n<p align=\\\"center\\\">\u56fe\u00a0&#8211; forward\u5de5\u4f5c\u539f\u7406<\/p>\n<p><strong>\u00a0\u00a0\u00a0<\/strong><strong>\u914d\u7f6e\u793a\u4f8b<\/strong><\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -A FORWARD -i eth1 -s 172.16.1.0\/24 -j ACCEPT\n# iptables -A FORWARD -o eth0 -s 172.16.1.0\/24 -j ACCEPT  # \u53ef\u4ee5\u4e0d\u8fdb\u884c\u914d\u7f6e\niptables -A FORWARD -i eth0 -d 172.16.1.0\/24 -j ACCEPT\n# iptables -A FORWARD -o eth1 -d 172.16.1.0\/24 -j ACCEPT   # \u53ef\u4ee5\u4e0d\u8fdb\u884c\u914d\u7f6e<\/pre>\n<\/div>\n<p>\u5f53\u5916\u7f51ip\u4e0d\u56fa\u5b9a\u65f6\u5982\u4f55\u914d\u7f6e\uff1f<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -t nat -A POSTROUTING -s 172.16.1.0\/24 -o eth0 -j MASQUERADE   # \u4f2a\u88c5\u5171\u4eab\u4e0a\u7f51<\/pre>\n<\/div>\n<p>\u8bf4\u660e\uff1a\u5728\u4f01\u4e1a\u4e2d\u5982\u4f55\u6ca1\u6709\u56fa\u5b9a\u5916\u7f51IP\u5730\u5740\uff0c\u53ef\u4ee5\u91c7\u53d6\u4ee5\u4e0a\u4f2a\u88c5\u6620\u5c04\u7684\u65b9\u5f0f\u8fdb\u884c\u5171\u4eab\u4e0a\u7f51<br \/>\n<strong>\u914d\u7f6e\u6620\u5c04\u65b9\u6cd5\u5c0f\u7ed3<\/strong><\/p>\n<blockquote><p>\u00a001.\u00a0\u6307\u5b9a\u54ea\u4e9b\u7f51\u6bb5\u9700\u8981\u8fdb\u884c\u6620\u5c04\u00a0 \u00a0\u00a0\u00a0-s 172.16.1.0\/24<br \/>\n02.\u00a0\u6307\u5b9a\u5728\u54ea\u505a\u6620\u5c04\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -o eth0<br \/>\n03.\u00a0\u7528\u4ec0\u4e48\u65b9\u6cd5\u505a\u6620\u5c04\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 -j SNAT\/DNAT MASQUERADE<br \/>\n04.\u00a0\u6620\u5c04\u6210\u4ec0\u4e48\u5730\u5740\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &#8211;to-source\u00a0 ip\u5730\u5740\/&#8211;to-destination ip\u5730\u5740<\/p><\/blockquote>\n<h3><span id=\\\"172_iptablesIPIP\\\">1.7.2 iptables\u5b9e\u73b0\u5916\u7f51IP\u7684\u7aef\u53e3\u6620\u5c04\u5230\u5185\u7f51IP\u7684\u7aef\u53e3<\/span><\/h3>\n<p>\u5b9e\u9645\u9700\u6c42\uff1a\u5c06\u7f51\u5173\u7684IP\u548c9000\u7aef\u53e3\u6620\u5c04\u5230\u5185\u7f51\u670d\u52a1\u5668\u768422\u7aef\u53e3<br \/>\n\u7aef\u53e3\u6620\u5c04\u00a010.0.0.188:9000 &#8211;&gt;172.16.1.180:22<br \/>\n\u914d\u7f6e\u5b9e\u4f8b\uff1a<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -t nat -A PREROUTING -d 10.0.0.188 -p tcp --dport 9000 -i eth0 -j DNAT --to-destination 172.16.1.7:22<\/pre>\n<\/div>\n<p>\u53c2\u6570\u8bf4\u660e:<\/p>\n<table border=\\\"1\\\" cellspacing=\\\"0\\\" cellpadding=\\\"0\\\">\n<tbody>\n<tr>\n<td width=\\\"44%\\\">\n<p align=\\\"center\\\"><strong>\u53c2\u6570<\/strong><\/p>\n<\/td>\n<td width=\\\"55%\\\">\n<p align=\\\"center\\\"><strong>\u53c2\u6570\u8bf4\u660e<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\\\"44%\\\">\n<p align=\\\"center\\\"><strong>-d 10.0.0.188<\/strong><\/p>\n<\/td>\n<td width=\\\"55%\\\">\n<p align=\\\"center\\\">\u76ee\u6807\u5730\u5740\u3002<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\\\"44%\\\">\n<p align=\\\"center\\\"><strong>-j DNAT<\/strong><\/p>\n<\/td>\n<td width=\\\"55%\\\">\n<p align=\\\"center\\\">\u76ee\u7684\u5730\u5740\u6539\u5199\u3002<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span id=\\\"173_IP\\\">1.7.3 IP\u4e00\u5bf9\u4e00\u6620\u5c04<\/span><\/h3>\n<p align=\\\"center\\\"><img src=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100320756-725387577.png\\\" alt=\\\"\u4f01\u4e1a\u9632\u706b\u5899\u4e4biptables\\\" data-original=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100320756-725387577.png\\\" \/><\/p>\n<p align=\\\"center\\\">\u56fe\u00a0&#8211; DNAT\u00a0\u6620\u5c04\u539f\u7406<\/p>\n<p>\u00a0\u00a0\u00a0\u5b9e\u9645\u9700\u6c42\uff1a\u5c06ip\u00a0\u5730\u5740172.16.1.180\u00a0\u6620\u5c04\u523010.0.0.188<br \/>\n\u901a\u8fc7\u8f85\u52a9IP\u914d\u7f6e\uff1a<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>ip addr add 10.0.0.81\/24 dev eth0 label eth0:0   # \u6dfb\u52a0\u8f85\u52a9IP\niptables  -t nat -I PREROUTING -d 10.0.0.81 -j DNAT --to-destination 172.16.1.51\niptables  -t nat -I POSTROUTING -s 172.16.1.51 -o eth0 -j SNAT --to-source 10.0.0.81<\/pre>\n<\/div>\n<p>\u9002\u5408\u5185\u7f51\u7684\u673a\u5668\u8bbf\u95eeNAT\u5916\u7f51\u7684IP<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables  -t nat -I POSTROUTING -s 172.16.1.0\/255.255.240.0 -d 10.0.0.81 -j SNAT --to-source 172.16.1.8<\/pre>\n<\/div>\n<p>\u68c0\u67e5\u914d\u7f6e\uff1a<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>ping 10.0.0.81 -t\ntcpdump|grep -i icmp\uff08\u4e24\u53f0\u673a\u5668\u4e0a\u5206\u522b\u76d1\u6d4b\uff09\ntelnet 10.0.0.81 22<\/pre>\n<\/div>\n<h3><span id=\\\"174_IP\\\">1.7.4\u00a0\u6620\u5c04\u591a\u4e2a\u5916\u7f51IP\u4e0a\u7f51<\/span><\/h3>\n<p>\u65b9\u6cd51\uff1a<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -t nat -A POSTROUTING -s 10.0.1.0\/255.255.240.0 -o eth0 -j SNAT --to-source 124.42.60.11-124.42.60.16<\/pre>\n<\/div>\n<p>\u5728\u4e09\u5c42\u4ea4\u6362\u673a\u6216\u8def\u7531\u5668\uff0c\u5212\u5206VLAN\u3002<br \/>\n\u65b9\u6cd52\uff1a<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -t nat -A POSTROUTING -s 10.0.1.0\/22 -o eth0 -j SNAT --to-source 124.42.60.11\niptables -t nat -A POSTROUTING -s 10.0.2.0\/22 -o eth0 -j SNAT --to-source 124.42.60.12<\/pre>\n<\/div>\n<p>\u6269\u5927\u5b50\u7f51\uff0c\u4f1a\u589e\u52a0\u5e7f\u64ad\u98ce\u66b4\u3002<\/p>\n<h3><span id=\\\"175\\\">1.7.5\u00a0\u7cfb\u7edf\u9632\u706b\u5899\u4e0e\u7f51\u7edc\u5185\u6838\u4f18\u5316\u6807\u51c6\u53c2\u6570<\/span><\/h3>\n<p>\u6709\u5173iptables\u7684\u5185\u6838\u4f18\u5316<br \/>\n\u8c03\u6574\u5185\u6838\u53c2\u6570\u6587\u4ef6\/etc\/sysctl.conf<br \/>\n\u4ee5\u4e0b\u662f\u6211\u7684\u751f\u4ea7\u73af\u5883\u7684\u67d0\u4e2a\u670d\u52a1\u5668\u7684\u914d\u7f6e\uff1a<br \/>\n<strong>\u89e3\u51b3time-wait<\/strong><strong>\u8fc7\u591a<\/strong>\u7684\u89e3\u51b3\u529e\u6cd5\uff1a<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>net.ipv4.tcp_fin_timeout = 2\nnet.ipv4.tcp_tw_reuse = 1\nnet.ipv4.tcp_tw_recycle = 1\nnet.ipv4.tcp_syncookies = 1\nnet.ipv4.tcp_keepalive_time = 600\nnet.ipv4.tcp_max_tw_buckets = 36000<\/pre>\n<\/div>\n<div class=\\\"cnblogs_code\\\">\n<pre>net.ipv4.ip_local_port_range = 4000  65000\nnet.ipv4.tcp_max_syn_backlog = 16384\nnet.ipv4.route.gc_timeout = 100\nnet.ipv4.tcp_syn_retries = 1\nnet.ipv4.tcp_synack_retries = 1<\/pre>\n<\/div>\n<p>\u5728dmesg\u4e2d\u663e\u793a\u00a0<span class=\\\"cnblogs_code\\\">\u00a0ip_conntrack: table full, dropping packet.<\/span>\u00a0\u7684\u9519\u8bef\u63d0\u793a\uff0c\u4ec0\u4e48\u539f\u56e0\uff1f<br \/>\n\u5982\u4f55\u89e3\u51b3\uff1f<br \/>\n#iptables\u4f18\u5316<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>net.nf_conntrack_max = 25000000\nnet.netfilter.nf_conntrack_max = 25000000\nnet.netfilter.nf_conntrack_tcp_timeout_established = 180\nnet.netfilter.nf_conntrack_tcp_timeout_time_wait = 120\nnet.netfilter.nf_conntrack_tcp_timeout_close_wait = 60\nnet.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120<\/pre>\n<\/div>\n<h2><span id=\\\"18\\\">1.8\u00a0\u81ea\u5b9a\u4e49\u94fe\u7684\u914d\u7f6e<\/span><\/h2>\n<p align=\\\"center\\\">\u00a0<img src=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100524162-470889662.png\\\" alt=\\\"\u4f01\u4e1a\u9632\u706b\u5899\u4e4biptables\\\" data-original=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100524162-470889662.png\\\" \/><\/p>\n<p align=\\\"center\\\">\u56fe\u00a0&#8211;\u00a0\u81ea\u5b9a\u4e49\u94fe\u539f\u7406<\/p>\n<p>\u521b\u5efa\u81ea\u5b9a\u4e49\u94fe<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>#\u793a\u4f8b\uff1a\u5728filter\u8868\u4e2d\u521b\u5efaNOICMP\u81ea\u5b9a\u4e49\u94fe\niptables -t filter -N NOICMP<\/pre>\n<\/div>\n<p>\u5f15\u7528\u81ea\u5b9a\u4e49\u94fe<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>#\u793a\u4f8b\uff1a\u5728INPUT\u94fe\u4e2d\u5f15\u7528\u521a\u624d\u521b\u5efa\u7684\u81ea\u5b9a\u4e49\u94fe\niptables -t filter -I INPUT -p icmp  -j NOICMP<\/pre>\n<\/div>\n<p>\u91cd\u547d\u540d\u81ea\u5b9a\u4e49\u94fe<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>#\u793a\u4f8b\uff1a\u5c06IN_WEB\u81ea\u5b9a\u4e49\u94fe\u91cd\u547d\u540d\u4e3aWEB\niptables -E NOICMP ACCEPTICMP<\/pre>\n<\/div>\n<p>\u5220\u9664\u81ea\u5b9a\u4e49\u94fe<\/p>\n<blockquote><p>\u00a0\u5220\u9664\u81ea\u5b9a\u4e49\u94fe\u9700\u8981\u6ee1\u8db3\u4e24\u4e2a\u6761\u4ef6<br \/>\n1\u3001\u81ea\u5b9a\u4e49\u94fe\u6ca1\u6709\u88ab\u5f15\u7528<br \/>\n2\u3001\u81ea\u5b9a\u4e49\u94fe\u4e2d\u6ca1\u6709\u4efb\u4f55\u89c4\u5219<\/p><\/blockquote>\n<div class=\\\"cnblogs_code\\\">\n<pre># \u793a\u4f8b\uff1a \u5220\u9664\u5f15\u7528\u6570\u4e3a0\u4e14\u4e0d\u5305\u542b\u4efb\u4f55\u89c4\u5219\u7684ACCEPTICMP\u94fe\niptables -X ACCEPTICMP<\/pre>\n<\/div>\n<h2><span id=\\\"19\\\">1.9\u00a0\u9644\u5f55-\u9632\u706b\u5899\u72b6\u6001\u673a\u5236<\/span><\/h2>\n<p>\u72b6\u6001\u673a\u5236\u662fiptables\u4e2d\u8f83\u4e3a\u7279\u6b8a\u7684\u4e00\u90e8\u5206\uff0c\u8fd9\u4e5f\u662fiptables\u548c\u6bd4\u8f83\u8001\u7684ipchains\u7684\u4e00\u4e2a\u6bd4\u8f83\u5927\u7684\u533a\u5225\u4e4b\u4e00\uff0c\u8fd0\u884c\u72b6\u6001\u673a\u5236\uff08\u8fde\u63a5\u8ddf\u8e2a\uff09\u7684\u9632\u706b\u5899\u79f0\u4f5c\u5e26\u6709\u72b6\u6001\u673a\u5236\u7684\u9632\u706b\u5899\uff0c\u4ee5\u4e0b\u7b80\u79f0\u4e3a\u72b6\u6001\u9632\u706b\u5899.\u72b6\u6001\u9632\u706b\u5899\u6bd4\u975e\u72b6\u6001\u9632\u706b\u5899\u8981\u5b89\u5168\uff0c\u56e0\u4e3a\u5b83\u5141\u8bb8\u6211\u4eec\u7f16\u5199\u66f4\u4e25\u5bc6\u7684\u89c4\u5219\u3002<br \/>\n\u5728iptables\u4e0a\u4e00\u5171\u6709\u56db\u79cd\u72b6\u6001\uff0c\u5206\u522b\u88ab\u79f0\u4e3aNEW\u3001ESTABLISHED\u3001INVALID\u3001RELATED,\u8fd9\u56db\u79cd\u72b6\u6001\u5bf9\u4e8eTCP\u3001UDP\u3001ICMP\u4e09\u79cd\u534f\u8bae\u5747\u6709\u6548\u3002\u4e0b\u9762\uff0c\u6211\u4eec\u6765\u5206\u522b\u9610\u8ff0\u56db\u79cd\u72b6\u6001\u7684\u7279\u6027.<br \/>\n<strong>? NEW<\/strong><br \/>\nmeaning that the packet has started a new connection, or otherwise associated with a connection which has not seen packets in both directions<br \/>\nNEW\u8bf4\u660e\u8fd9\u4e2a\u5305\u662f\u6211\u4eec\u770b\u5230\u7684\u7b1b\u4e00\u4e2a\u5305\u3002\u610f\u601d\u5c31\u662f\uff0c\u8fd9\u662fconntrack\u6a2a\u5757\u770b\u5230\u7684\u67d0\u4e2a\u8fde\u63a5\u7684\u7b2c\u4e00\u4e2a\u5305\uff0c\u5b83\u5373\u683c\u88ab\u5339\u914d\u4e86\u3002\u6bd4\u5982\uff0c\u6211\u4eec\u770b\u5230\u4e00\u4e2aSYN\u5305\uff0c\u662f\u6211\u4eec\u6240\u7559\u610f\u7684\u8fde\u63a5\u7684\u7b2c\u4e00\u00a0\u4e2a\u5305\uff0c\u5c31\u8981\u5339\u914d\u5b83\u3002<\/p>\n<p align=\\\"center\\\"><img src=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100700365-1333317962.png\\\" alt=\\\"\u4f01\u4e1a\u9632\u706b\u5899\u4e4biptables\\\" data-original=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100700365-1333317962.png\\\" \/><\/p>\n<p><strong>?\u00a0ESTABLISHED<\/strong><br \/>\nmeaning that the packet is associated with a connection which has seen packets in both directions<br \/>\nESTABLISHED\u5df2\u7ecf\u6ce8\u610f\u5230\u4e24\u4e2a\u65b9\u5411\u4e0a\u7684\u6570\u636e\u4f20\u8f93\uff0c\u800c\u4e14\u4f1a\u7ee7\u7eed\u5339\u914d\u8fd9\u4e2a\u8fde\u63a5\u7684\u5305.\u5904\u4e8eESTABLISHED\u72b6\u6001\u7684\u8fde\u63a5\u662f\u975e\u5e38\u5bb9\u6613\u7406\u89e3\u7684.\u53ea\u8981\u53d1\u9001\u5e76\u63a5\u5230\u5e94\u7b54\uff0c\u8fde\u63a5\u5c31\u662fESTABLISHED\u7684\u4e86\u3002\u4e00\u4e2a\u8fde\u63a5\u8981\u4eceNEW\u53d8\u4e3aESTABLISHED,\u53ea\u9700\u8981\u63a5\u5230\u5e94\u7b54\u5305\u5373\u53ef\uff0c\u4e0d\u7ba1\u8fd9\u4e2a\u5305\u662f\u53d1\u5f80\u9632\u706b\u5899\u7684\uff0c\u8fd8\u662f\u8981\u7531\u9632\u706b\u5899\u8f6c\u53d1\u7684.ICMP\u7684\u9519\u8bef\u548c\u91cd\u5b9a\u5411\u7b49\u4fe1\u606f\u5305\u4e5f\u88ab\u770b\u4f5c\u662fESTABLISHED,\u53ea\u8981\u5b83\u4eec\u662f\u6211\u4eec\u6240\u53d1\u51fa\u7684\u4fe1\u606f\u7684\u5e94\u7b54\u3002<\/p>\n<p align=\\\"center\\\">\u00a0<img src=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100709240-1842733823.png\\\" alt=\\\"\u4f01\u4e1a\u9632\u706b\u5899\u4e4biptables\\\" data-original=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100709240-1842733823.png\\\" \/><\/p>\n<p><strong>?\u00a0<\/strong>RELATED<br \/>\nmeaning that the packet is starting a new connection, but is associated with an existing connection, such as an FTP data transfer, or an ICMP error.<br \/>\nRELATED\u662f\u4e2a\u6bd4\u8f83\u9ebb\u70e6\u7684\u72b6\u6001.\u5f53\u4e00\u4e2a\u8fde\u63a5\u548c\u67d0\u4e2a\u5df2\u5904\u4e8eESTABLISHED\u72b6\u6001\u7684\u8fde\u63a5\u6709\u5173\u7cfb\u65f6\uff0c\u5c31\u88ab\u8ba4\u4e3a\u662fRELATED\u7684\u4e86\uff0c\u6362\u53e5\u8bdd\u8bf4\uff0c\u4e00\u4e2a\u8fde\u63a5\u8981\u60f3\u662fRELATED\u7684\uff0c\u9996\u5148\u8981\u6709\u4e00\u4e2aESTABLISHED\u7684\u8fde\u63a5\u3002\u8fd9\u4e2aESTABLISHED\u8fde\u63a5\u518d\u4ea7\u751f\u4e00\u4e2a\u4e3b\u8fde\u63a5\u4e4b\u5916\u7684\u8fde\u63a5\uff0c\u8fd9\u4e2a\u65b0\u7684\u8fde\u63a5\u5c31\u662fRELATED\u7684\u4e86\uff0c\u5f53\u7136\u524d\u63d0\u662fconntrack\u6a21\u5757\u8981\u80fd\u7406\u89e3RELATED\u3002ftp\u662f\u4e2a\u5f88\u597d\u7684\u4f8b\u5b50\uff0cFTP-data\u8fde\u63a5\u5c31\u662f\u548cFTP-control\u6709\u5173\u8054\u7684\uff0c\u5982\u679c\u6ca1\u6709\u5728iptables\u7684\u7b56\u7565\u4e2d\u914dRELATED\u72b6\u6001\uff0cFTP-data\u7684\u8fde\u63a5\u662f\u65e0\u6cd5\u6b63\u786e\u5efa\u7acb\u7684\uff0c\u8fd8\u6709\u5176\u4ed6\u7684\u4f8b\u5b50\uff0c\u6bd4\u5982\uff0c\u901a\u8fc7IRC\u7684DCC\u8fde\u63a5#\u6709\u4e86\u8fd9\u4e2a\u72b6\u6001\uff0cICMP\u5e94\u7b54\u3001FTP\u4f20\u8f93\u3001DCC\u7b49\u624d\u80fd\u7a7f\u8fc7\u9632\u706b\u5899\u6b63\u5e38\u5de5\u4f5c.\u6ce8\u610f\uff0c\u5927\u90e8\u5206\u8fd8\u6709\u4e00\u4e9bUDP\u534f\u8bae\u90fd\u4f9d\u8d56\u8fd9\u4e2a\u673a\u5236\u3002\u8fd9\u4e9b\u534f\u8bae\u662f\u5f88\u590d\u6742\u7684\uff0c\u5b83\u4eec\u628a\u8fde\u63a5\u4fe1\u606f\u653e\u5728\u6570\u636e\u5305\u91cc\uff0c\u5e76\u4e14\u8981\u6c42\u8fd9\u4e9b\u4fe1\u606f\u80fd\u88ab\u6b63\u786e\u7406\u89e3\u3002<\/p>\n<p align=\\\"center\\\"><img src=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100716459-532997150.png\\\" alt=\\\"\u4f01\u4e1a\u9632\u706b\u5899\u4e4biptables\\\" data-original=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100716459-532997150.png\\\" \/><\/p>\n<p><strong>?\u00a0INVALID<\/strong><br \/>\nmeaning that the packet is associated with no known connection<br \/>\nINVALID\u8bf4\u660e\u6570\u636e\u5305\u4e0d\u80fd\u88ab\u8bc6\u522b\u5c5e\u4e8e\u54ea\u4e2a\u8fde\u63a5\u6216\u6ca1\u6709\u4efb\u4f55\u72b6\u6001.\u6709\u51e0\u4e2a\u539f\u56e0\u53ef\u4ee5\u4ea7\u751f\u8fd9\u79cd\u60c5\u51b5\uff0c\u6bd4\u5982\uff0c\u5185\u5b58\u6ea2\u51fa\uff0c\u6536\u5230\u4e0d\u77e5\u53b2\u4e8e\u54ea\u4e2a\u8fde\u63a5\u7684ICMP\u9519\u8bef\u4fe1\u606f\u3002\u4e00\u822c\u5730\uff0c\u6211\u4eecDROP\u8fd9\u4e2a\u72b6\u6001\u7684\u4efb\u4f55\u4e1c\u897f\uff0c\u56e0\u4e3a\u9632\u706b\u5899\u8ba4\u4e3a\u8fd9\u662f\u4e0d\u5b89\u5168\u7684\u4e1c\u897f<\/p>\n<p align=\\\"center\\\">\u00a0<img src=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100722240-904097578.png\\\" alt=\\\"\u4f01\u4e1a\u9632\u706b\u5899\u4e4biptables\\\" data-original=\\\"https:\/\/clsn.io\/wp-content\/uploads\/2018\/03\/1190037-20180118100722240-904097578.png\\\" \/><\/p>\n<h3><span id=\\\"191_iptables\\\">1.9.1 iptables\u914d\u7f6e\u54f2\u5b66<\/span><\/h3>\n<p>\u5982\u4f55\u9632\u6b62\u81ea\u5df1\u88ab\u5173\u5728\u95e8\u5916\uff1f<\/p>\n<blockquote><p>\u00a001\u3001\u53bb\u673a\u623f\u91cd\u542f\u7cfb\u7edf\u6216\u8005\u767b\u9646\u670d\u52aa\u5668\u5220\u9664\u521a\u624d\u7684\u7981\u6b62\u89c4\u5219\u3002<\/p>\n<div>\n<p class=\\\"a\\\">02\u3001\u8ba9\u673a\u623f\u4eba\u5458\u91cd\u542f\u670d\u82b3\u5668\u6216\u8005\u8ba9\u673a\u623f\u4eba\u5458\u62ff\u7528\u6237\u5bc6\u7801\u767b\u5f55\u8fdb\u53bb\u3002<\/p>\n<p class=\\\"a\\\">03\u3001\u901a\u8fc7\u670d\u52aa\u5668\u7684\u8fdc\u7a0b\u7ba1\u7406\u5361\u7ba1\u7406\uff08\u63a8\u8350\uff09\u3002<\/p>\n<p class=\\\"a\\\">04\u3001\u5148\u5199\u4e00\u4e2a\u5b9a\u65f6\u4efb\u52a1\uff0c\u6bcf5\u5206\u949f\u5c31\u505c\u6b62\u9632\u706b\u5899\u3002<\/p>\n<p class=\\\"a\\\">05\u3001\u6d4b\u8bd5\u73af\u5883\u6d4b\u8bd5\u597d\uff0c\u5199\u6210\u811a\u672c\uff0c\u6279\u7f6e\u6267\u884c<\/p>\n<\/div>\n<\/blockquote>\n<p>\u914d\u7f6e\u7981\u752822\u7aef\u53e3\u7b56\u7565:<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -I INPUT -p tcp - dport 22 -j DROP\n# \u8bf4\u660e\uff1a\u5229\u7528-I\u53c2\u6570\uff0c\u5b9e\u73b0\u5f3a\u884c\u963b\u6b62\u8bbf\u95ee22\u7aef\u53e3\uff0c\u5c06Jffc\u89c4\u5219\u653e\u5728\u7b2c\u4e00\u4f4d<\/pre>\n<\/div>\n<p>\u5220\u9664\u914d\u7f6e\u7684\u7981\u6b62\u8fde\u63a522\u7aef\u53e3\u7684\u89c4\u5219<\/p>\n<div class=\\\"cnblogs_code\\\">\n<pre>iptables -t filter -D INPUT -p tcp \u2014dport 22 -j DROP\niptables -F\n\/etc\/init.d\/iptables restart<\/pre>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1.1 \u4f01\u4e1a\u4e2d\u5b89\u5168\u4f18\u5316\u914d\u7f6e\u539f\u5219 \u5c3d\u53ef\u80fd\u4e0d\u7ed9\u670d\u52a1\u5668\u914d\u7f6e\u5916\u7f51ip ,\u53ef\u4ee5\u901a\u8fc7\u4ee3\u7406\u8f6c\u53d1\u6216\u8005\u901a\u8fc7\u9632\u706b\u5899\u6620\u5c04.\u5e76\u53d1\u4e0d\u662f\u7279 &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.weijing.co\/?p=5435\"> <span class=\"screen-reader-text\">Iptables\u8be6\u89e3<\/span> \u67e5\u770b\u5168\u6587 &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":""},"categories":[102,124],"tags":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"mailpoet_newsletter_max":false,"woocommerce_thumbnail":false,"woocommerce_single":false,"woocommerce_gallery_thumbnail":false,"shop_catalog":false,"shop_single":false,"shop_thumbnail":false},"uagb_author_info":{"display_name":"weijing","author_link":"http:\/\/www.weijing.co\/?author=4"},"uagb_comment_info":0,"uagb_excerpt":"1.1 \u4f01\u4e1a\u4e2d\u5b89\u5168\u4f18\u5316\u914d\u7f6e\u539f\u5219 \u5c3d\u53ef\u80fd\u4e0d\u7ed9\u670d\u52a1\u5668\u914d\u7f6e\u5916\u7f51ip ,\u53ef\u4ee5\u901a\u8fc7\u4ee3\u7406\u8f6c\u53d1\u6216\u8005\u901a\u8fc7\u9632\u706b\u5899\u6620\u5c04.\u5e76\u53d1\u4e0d\u662f\u7279&hellip;","_links":{"self":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/5435"}],"collection":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5435"}],"version-history":[{"count":0,"href":"http:\/\/www.weijing.co\/index.php?rest_route=\/wp\/v2\/posts\/5435\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5435"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.weijing.co\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}