{"id":281004,"date":"2016-11-15T17:15:03","date_gmt":"2016-11-15T14:15:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=281004"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=281004","title":{"rendered":"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 Firewall \u0432 Linux, \u0427\u0430\u0441\u0442\u044c 1.2. \u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0441 Netfilter"},"content":{"rendered":"<p><b>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438:<\/b><\/p>\n<p>  <a href=\"https:\/\/habrahabr.ru\/post\/315340\/\"> <b>1.1<\/b> \u2014 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u0438\u0438 (\u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043c \u0431\u044b\u043b\u043e \u0433\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. \u0421\u0435\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 3\u0445 \u043c\u0430\u0448\u0438\u043d Linux ubuntu).<\/a><br \/>   <b>1.2<\/b> \u2013 \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0432 Linux. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 Netfilter \u0438 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e. \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435, \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c.<br \/>   <b>1.3<\/b> \u2013 \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e char device. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u2014 sysfs. \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 user interface. \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435, \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c. <br \/>  <a name=\"habracut\"><\/a><br \/>  <b>\u041e\u0447\u0435\u043d\u044c \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u041e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/b><\/p>\n<p>  \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u043e\u0441\u043d\u043e\u0432\u0430\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0432 \u043e\u0431\u0449\u0435\u043c \u0438 linux-\u0441\u0438\u0441\u0442\u0435\u043c \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u041e\u0427\u0415\u041d\u042c \u043a\u0440\u0430\u0442\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u0435 \u043d\u0430\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0434\u0432\u0438\u0433\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435. \u0412 Linux, \u043a\u0430\u043a \u0438 \u043c\u043d\u043e\u0433\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u041e\u0421, \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0430\u0434\u0440\u0435\u0441\u043d\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u2013 <i>kernel space<\/i> \u0438 <i>user space<\/i>.<i> Kernel space<\/i> \u2013 \u0442\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u043e\u043d\u0430 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u0430\u043a\u0430\u044f \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0441\u0435\u0439\u0447\u0430\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0435 (scheduling), \u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c output \u0441 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u0430\u043a\u0435\u0442\u0430\u043c\u0438 \u0438\u0437 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u044b, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 IO \u0438 \u043c\u043d\u043e\u0433\u043e \u0432\u0441\u0435\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e). \u041e\u0421 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0438\u043c\u043d\u044b\u0445 \u0441\u0432\u044f\u0437\u044f\u0445 \u0441 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u043c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435\u043c (\u043c\u044b\u0448\u044c, \u043c\u043e\u043d\u0438\u0442\u043e\u0440, \u043f\u0440\u0438\u043d\u0442\u0435\u0440\u2026). \u0422\u0430\u043a \u043a\u0430\u043a \u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0430 \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u0430, \u0434\u043b\u044f \u043d\u0435\u0435 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 <i>user space<\/i> \u2013 \u043c\u0435\u0441\u0442\u043e\u043c, \u0433\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a: \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u044b, \u043a\u0430\u043b\u044c\u043a\u0443\u043b\u044f\u0442\u043e\u0440\u044b, \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b \u0438 \u0442.\u0434. \u0412 Linux, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u041e\u0421 \u2014 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432. \u041e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445 \u2014 \u044d\u0442\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b \u044f\u0434\u0440\u0430 \u0438 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0437\u0430\u043d\u043e\u0432\u043e. \u041d\u043e \u044d\u0442\u043e\u0442 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043e\u043b\u0433\u0438\u0439 \u0438 \u0442\u044f\u0436\u0435\u043b\u044b\u0439, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0438\u043b\u0438 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u043d\u043e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u2013 \u043c\u043e\u0434\u0443\u043b\u0438. \u041c\u043e\u0434\u0443\u043b\u0438 \u2013 \u0433\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u043d\u043e \u0438 \u0431\u044b\u0441\u0442\u0440\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 kernel space, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e, \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u0442\u0430\u043d\u0435\u0442 \u0447\u0430\u0441\u0442\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u0447\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<p>  \u0415\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"http:\/\/www.tldp.org\/LDP\/lkmpg\/2.6\/html\/lkmpg.html\">\u044d\u0442\u0430<\/a> \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0430\u044f. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u044f \u0441\u043c\u043e\u0433 \u0434\u043e\u043d\u0435\u0441\u0442\u0438 \u0438\u043d\u0442\u0443\u0438\u0446\u0438\u044e.<\/p>\n<h3>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0432 Linux. \u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/h3>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u043e\u0447\u0435\u043d\u044c \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f <a href=\"http:\/\/www.thegeekstuff.com\/2013\/07\/write-linux-kernel-module\/\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a> \u2014 \u043f\u043e\u0442\u043e\u043c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Netfilter \u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435. \u041d\u0438\u0436\u0435, \u0431\u0443\u0434\u0443\u0442 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438, \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438, \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0432\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0442\u0435\u043a\u0441\u0442\u044b. \u0418 \u0442\u0430\u043a:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/987\/920\/127\/98792012783144f4a50727c336ee7dee.png\" alt=\"image\"  width=\"90%\"\/><\/div>\n<p>  \u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0449\u0435\u0439:<\/p>\n<p>  <b>1<\/b> \u2013 \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 Geany, \u0442\u0430\u043a \u043a\u0430\u043a Eclpise-\u0441\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435 \u043f\u043e\u0434\u043e\u0439\u0434\u0443\u0442. \u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b, \u043d\u043e \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043c\u043e\u0436\u043d\u043e \u0438 \u0447\u0435\u0440\u0435\u0437 Geany. <\/p>\n<p>  <b>2<\/b> \u2013 \u0432 kernel \u043d\u0435\u0442 printf, \u043d\u043e \u0435\u0441\u0442\u044c \u0435\u0435 \u0430\u043d\u0430\u043b\u043e\u0433 printk, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u041a\u0441\u0442\u0430\u0442\u0438 \u0432 kernel \u0435\u0441\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438 \u0432\u0441\u0435\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (\u0438 \u043d\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0442\u0438\u043f\u0430 stdlib). <\/p>\n<p>  <b>3<\/b> \u2013 printk, \u043d\u0435 \u043f\u0438\u0448\u0435\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c, \u0430 \u043f\u0438\u0448\u0435\u0442 \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0443 dmesg. \u0423 \u043d\u0430\u0441 \u2014 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b (\u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 printk, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0431\u0435\u0437 X \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 Ctrl+Shift+F1). \u0422\u0430\u043a \u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c <i>dmesg \u2013c<\/i>, \u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0432\u0441\u0435\u0433\u043e, \u0447\u0442\u043e \u043d\u0430\u043a\u043e\u043f\u0438\u043b\u043e\u0441\u044c \u0432 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435.<\/p>\n<p>  <b>4<\/b> \u2013 <i>MODULE_LICENSE, MODULE_AUTHOR, MODULE_DESCRIPTION<\/i> \u2014 \u044d\u0442\u043e \u043c\u0430\u043a\u0440\u043e\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u00ab\u0434\u0430\u044e\u0442\u00bb linux \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043c\u043e\u0434\u0443\u043b\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u043e\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 (\u0438\u0441\u043a\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435).<\/p>\n<p>  <b>5<\/b> \u2013 \u0412 kernel \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0442 C89 \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 C. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 (\u0438 \u0433\u043b\u0430\u0432\u043d\u043e\u0435) \u2014 \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0438 \u043e\u0442 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e C99, \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u0435\u0435 \u0447\u0430\u0441\u0442\u0438. \u0415\u0441\u043b\u0438 \u0432\u044b \u041d\u0415 \u0431\u0443\u0434\u0435\u0442\u0435 \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043a\u043e\u0434 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u043d\u043e \u0441 warnings (\u0447\u0442\u043e \u043f\u043b\u043e\u0445\u043e \u0438 \u043d\u0435 \u0434\u043b\u044f \u043d\u0430\u0441).<\/p>\n<h3>\u041a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f<\/h3>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 (\u043d\u0438\u0436\u0435 \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435) \u043d\u0430 Makefile. \u041e\u043d \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u0432 user space. \u0422\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d19\/4e8\/5db\/d194e85db93348ef984bfc04ed069c76.png\" alt=\"image\"  width=\"90%\"\/><\/div>\n<p>  \u041c\u043e\u0434\u0443\u043b\u044c \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <i>\u201cinsmod .\/module_name.ko\u201d<\/i> \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u043a\u0440\u043e\u0441<i> module_init<\/i>. \u041c\u043e\u0434\u0443\u043b\u044c \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 <i>\u201crmmod module_name\u201d<\/i>.<\/p>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c. \u041f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u044c, \u0430 \u043f\u043e\u0442\u043e\u043c \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u043c \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 <i>dmesg<\/i><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/91f\/7dc\/a26\/91f7dca2616a416fa686d11afffc1e83.png\" alt=\"image\"  width=\"90%\"\/><\/div>\n<p>  \u0413\u043e\u0442\u043e\u0432\u043e. \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 \u043c\u043e\u0434\u0443\u043b\u0438 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u043e.<\/p>\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 Netfilter. \u0422\u0435\u043e\u0440\u0438\u044f<\/h3>\n<p>  <i>Netfilter <\/i>\u2013 \u044d\u0442\u043e framework, \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 linux kernel, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u041d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0438 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0442\u0440\u0430\u0444\u0438\u043a\u0430.<\/p>\n<p>  \u041a\u0441\u0442\u0430\u0442\u0438, \u0441\u0430\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u043e \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c framework \u2013 <i>iptables<\/i>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 (\u0442\u043e \u0435\u0441\u0442\u044c \u2014 \u044d\u0442\u043e \u043d\u0438 \u0447\u0442\u043e \u0438\u043d\u043e\u0435, \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e\u0439 firewall) \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 Linux. \u0412 \u0440\u0443\u0441\u0441\u043a\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Wikipedia, \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043c\u0438, \u0447\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u044e \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0441\u044b\u043b\u043a\u0443 \u0434\u0430\u044e \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e. <a href=\"https:\/\/en.wikipedia.org\/wiki\/Netfilter\">Wikipedia \u2014 Netfilter<\/a><br \/>  \u0438 \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0430\u0439\u0442. \u041d\u0430 \u043d\u0435\u043c \u0435\u0441\u0442\u044c \u0432\u0441\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f. <a href=\"http:\/\/www.netfilter.org\/\">www.netfilter.org<\/a><\/p>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430(hooking) \u0442\u0440\u0430\u0444\u0438\u043a\u0430. \u0422\u0435\u043e\u0440\u0438\u044f<\/h3>\n<p>  \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430(hooking) \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0432 Netfilter \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ff5\/453\/5bd\/ff54535bd7834a679f7f214af5b31cbf.png\" alt=\"image\"  width=\"90%\"\/><\/div>\n<p>  <a href=\"https:\/\/debian-handbook.info\/browse\/stable\/sect.firewall-packet-filtering.html\">\u0424\u043e\u0442\u043e<\/a><\/p>\n<p>  \u041d\u0430 \u0441\u0445\u0435\u043c\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0441\u0442\u0430\u0434\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0442 \u043f\u0430\u043a\u0435\u0442\u044b \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u044f \u043d\u0430 phy \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u044b. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435:<\/p>\n<blockquote><p><i>Prerouting<\/i> \u2013 \u0441\u044e\u0434\u0430 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432\u0441\u0435 \u043f\u0430\u043a\u0435\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0448\u043b\u0438 \u043d\u0430 \u0441\u0435\u0442\u0435\u0432\u0443\u044e \u043a\u0430\u0440\u0442\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0438\u0437\u0432\u043d\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u0442\u043e-\u0442\u043e \u0438\u0437 \u0441\u0435\u0442\u0438, \u043f\u044b\u0442\u0430\u0435\u0442 \u043f\u043e\u0441\u043b\u0430\u0442\u044c \u043d\u0430\u043c mail, \u0438\u043b\u0438 \u043c\u044b \u043d\u0430 \u043f\u0443\u0442\u0438 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043a\u0435\u0442\u0430 \u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u0430\u043b\u044c\u0448\u0435).<br \/>  <i>Forward<\/i> \u2013 \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u043d\u0435 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e IP \u0430\u0434\u0440\u0435\u0441\u0430, \u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0435\u0440\u0435\u0448\u043b\u0435\u0442 \u0435\u0433\u043e \u0434\u0430\u043b\u044c\u0448\u0435 (\u043f\u043e\u043c\u043d\u0438\u0442\u0435 forward enable \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438?) \u0438\u043b\u0438 \u0432\u044b\u043a\u0438\u043d\u0435\u0442, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0435\u0433\u043e \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u043c. <br \/>  <i>Input<\/i> \u2013 \u0441\u044e\u0434\u0430 \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u0432\u0441\u0435 \u043f\u0430\u043a\u0435\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0430\u043f\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b \u0434\u043b\u044f \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.<br \/>  <i>Output<\/i> \u2013 \u0442\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432\u0441\u0435 \u043f\u0430\u043a\u0435\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u043f\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u043f\u043e\u0441\u044b\u043b\u0430\u044e\u0442 \u0432 \u0441\u0435\u0442\u044c (\u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435 \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c forwarding). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u043e\u0442 \u0441\u0430\u043c\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430. \u0418\u043b\u0438 ping. <br \/>  <i>Postrouting<\/i> \u2013 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b.<\/p><\/blockquote>\n<p>  \u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438:<\/p>\n<p>  <i>Input data = Prerouting = Forward + Input<\/i><br \/>  <i>Output data = Postrouting = Output + Forward<\/i><\/p>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043e\u0431\u044b\u0447\u043d\u043e <i>input != output<\/i> (\u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u043f\u043e\u043d\u044f\u043b\u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u2014 \u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0435\u043c\u0443 \u0435\u0449\u0435 \u0440\u0430\u0437 \u0438\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435).<\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u044b \u0432\u0432\u0435\u0434\u0451\u043c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 <i><a href=\"http:\/\/www.site.com\">www.site.com<\/a><\/i> \u0442\u043e \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0434\u0432\u0435 \u00ab\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438\u00bb \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u043e\u043f\u0430\u0434\u0435\u0442 \u0432 \u0441\u0435\u0442\u044c \u2013 <i>Output<\/i> \u0438 <i>Postrouting<\/i>.<\/p>\n<p>  \u041a\u043e\u0433\u0434\u0430 site.com \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043c \u043e\u0442\u0432\u0435\u0447\u0430\u0442\u044c, \u0442\u043e \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0434\u0432\u0435 \u00ab\u0441\u0442\u0430\u043d\u0446\u0438\u0438\u00bb, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u043a \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443 &#8212;<i> Input data<\/i> \u0438 <i>Prerouting<\/i>. <\/p>\n<p>  \u0414\u0440\u0443\u0433\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 host1 -&gt; host2, \u043f\u0440\u043e\u0439\u0434\u0443\u0442 \u0447\u0435\u0440\u0435\u0437 <i>Input, Forward, Output.<\/i><br \/>  \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u00ab\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435\u00bb \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u00ab\u043f\u043e\u0439\u043c\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430\u00bb \u2014 \u0445\u043e\u0442\u0438\u043c \u043b\u0438 \u043c\u044b \u0435\u0433\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435, \u0438\u043b\u0438 \u043d\u0435\u0442 (\u0438\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u0435\u0449\u0435).<\/p>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430(hooking) \u0442\u0440\u0430\u0444\u0438\u043a\u0430. \u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430<\/h3>\n<p>  \u0414\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430, \u043c\u044b \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u2013 \u0432\u0441\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 FW_dev (\u0442\u043e\u0442 \u0433\u0434\u0435 \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c firewall), \u0438\u043b\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 FW_dev \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u043e\u0442 \u0441\u0432\u043e\u0435\u0433\u043e \u0438\u043c\u0435\u043d\u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u043c \u2013 \u043c\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043c \u043f\u0440\u043e\u0439\u0442\u0438 (accept). \u0412\u0435\u0441\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u0440\u0430\u0444\u0438\u043a, \u043c\u044b \u0437\u0430\u043a\u0440\u043e\u0435\u043c (deny). \u041a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u0446\u0435\u043b\u044c \u2013 \u043f\u043e\u0434\u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u043f\u0440\u043e\u0448\u043b\u043e, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u043b\u0438 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e (\u0432 user space). <\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u043e\u0434\u0443\u043b\u044f, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"cpp\">static unsigned int accepted_num = 0; static unsigned int dropped_num = 0; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c hook functions, \u0432 \u043d\u0443\u0436\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430 \u0442\u0440\u0430\u0444\u0438\u043a\u0430. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u0430\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0412\u0441\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u043c\u0435\u0442\u044c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u0438\u043f:<\/p>\n<pre><code class=\"cpp\">unsigned int hook_func(unsigned int hooknum, struct sk_buff *skb, \t\tconst struct net_device *in, const struct net_device *out, \t\tint (*okfn)(struct sk_buff *)) {} <\/code><\/pre>\n<p>  \u041a\u043e\u0434 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<pre><code class=\"cpp\">\/\/ hook out packets, accept packet unsigned int hook_func_out(unsigned int hooknum, struct sk_buff *skb, \t\tconst struct net_device *in, const struct net_device *out, \t\tint (*okfn)(struct sk_buff *)) { \taccepted_num++; \treturn NF_ACCEPT; }  \/\/ hook in packets, accept packet unsigned int hook_func_in(unsigned int hooknum, struct sk_buff *skb, \t\tconst struct net_device *in, const struct net_device *out, \t\tint (*okfn)(struct sk_buff *)) { \taccepted_num ++; \treturn NF_ACCEPT; }  \/\/ hook forward packets, drop packet unsigned int hook_func_forward(unsigned int hooknum, struct sk_buff *skb, \t\tconst struct net_device *in, const struct net_device *out, \t\tint (*okfn)(struct sk_buff *)) { \tdropped_num++; \treturn NF_DROP; } <\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u2013 \u0438\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u0440\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043c\u043e\u0434\u0443\u043b\u044f. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"cpp\">\/\/ hook functions structs for registration usage static struct nf_hook_ops nfho_forward; static struct nf_hook_ops nfho_out; static struct nf_hook_ops nfho_in;  static int __init fw_module_init(void) { ..... \/\/ netfilter functions printk(&quot;initialize kernel module\\n&quot;);  \tnfho_in.hook = hook_func_in; \tnfho_in.hooknum = NF_INET_LOCAL_IN; \tnfho_in.pf = PF_INET; \tnfho_in.priority = NF_IP_PRI_FIRST; \tnf_register_hook(&nfho_in); \/\/ Register the hook  \tnfho_out.hook = hook_func_out; \tnfho_out.hooknum = NF_INET_LOCAL_OUT; \tnfho_out.pf = PF_INET; \tnfho_out.priority = NF_IP_PRI_FIRST; \tnf_register_hook(&nfho_out); \/\/ Register the hook  \tnfho_forward.hook = hook_func_forward; \tnfho_forward.hooknum = NF_INET_FORWARD; \tnfho_forward.pf = PF_INET; \tnfho_forward.priority = NF_IP_PRI_FIRST; \tnf_register_hook(&nfho_forward); \/\/ Register the hook \u2026 } <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u043b\u0435 <i>hooknum<\/i>, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u044b \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0435\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u0432\u044b\u0448\u0435. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u0445 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 (\u0434\u0435\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f) \u043f\u0435\u0440\u0435\u0434 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044f \u0438\u0437 \u041e\u0421. <\/p>\n<pre><code class=\"cpp\">static void __exit fw_module_exit(void) { \u2026 \/\/ net filter functions \tnf_unregister_hook(&nfho_in); \tnf_unregister_hook(&nfho_out); \tnf_unregister_hook(&nfho_forward); \/\/ end netfilter functions \u2026 } <\/code><\/pre>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c user interface, \u0447\u0442\u043e\u0431\u044b \u043b\u044e\u0431\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u043c\u043e\u0433 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c.<\/p>\n<h3>\u041f\u0440\u0435\u0434\u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434<\/h3>\n<p>  <\/p>\n<pre><code class=\"cpp\">#include &lt;linux\/module.h&gt; #include &lt;linux\/netfilter_ipv4.h&gt;  #include &quot;fw.h&quot;   MODULE_AUTHOR( AUTHOR);  MODULE_DESCRIPTION( DESCRIPTION); MODULE_VERSION( VERSION);  MODULE_LICENSE(&quot;GPL&quot;);   static unsigned int accepted_num;  static unsigned int dropped_num;   \/\/ hook functions  static struct nf_hook_ops nfho_forward;  static struct nf_hook_ops nfho_out;  static struct nf_hook_ops nfho_in;   \/\/ hook out packets  unsigned int hook_func_out(unsigned int hooknum, struct sk_buff *skb, const struct net_device *in, const struct net_device *out, \t\tint (*okfn)(struct sk_buff *)) {  \tprintk(&quot;Get input packet, accept\\n&quot;);  \taccepted_num++;  \treturn NF_ACCEPT;  }   \/\/ hook in packets  unsigned int hook_func_in(unsigned int hooknum, struct sk_buff *skb, const struct net_device *in, const struct net_device *out, int (*okfn)(struct sk_buff *)) {  \tprintk(&quot;Get input packet, accept\\n&quot;);  \taccepted_num++;  \treturn NF_ACCEPT;  }   \/\/ hook forward packets  unsigned int hook_func_forward(unsigned int hooknum, struct sk_buff *skb, const struct net_device *in, const struct net_device *out, int (*okfn)(struct sk_buff *)) {  \tprintk(&quot;Get forward packet, drop\\n&quot;);  \tdropped_num++;  \treturn NF_DROP; }   static int __init fw_module_init(void) {  \tprintk(&quot;Starting FW module loading\\n&quot;);  \taccepted_num = 0;  \tdropped_num = 0;   \tnfho_in.hook = hook_func_in;  \tnfho_in.hooknum = NF_INET_LOCAL_IN;  \tnfho_in.pf = PF_INET;  \tnfho_in.priority = NF_IP_PRI_FIRST;  \tnf_register_hook(&nfho_in); \/\/ Register the hook  \tnfho_out.hook = hook_func_out;  \tnfho_out.hooknum = NF_INET_LOCAL_OUT;  \tnfho_out.pf = PF_INET;  \tnfho_out.priority = NF_IP_PRI_FIRST;  \tnf_register_hook(&nfho_out); \/\/ Register the hook  \tnfho_forward.hook = hook_func_forward;  \tnfho_forward.hooknum = NF_INET_FORWARD;  \tnfho_forward.pf = PF_INET;  \tnfho_forward.priority = NF_IP_PRI_FIRST;  \tnf_register_hook(&nfho_forward);  \/\/ Register the hook  \treturn 0;  }   static void __exit fw_module_exit(void)  {  \tprintk(&quot;Removing FW module\\n&quot;);  \tnf_unregister_hook(&nfho_in);  \tnf_unregister_hook(&nfho_out);  \tnf_unregister_hook(&nfho_forward);  }   module_init( fw_module_init);  module_exit( fw_module_exit);  <\/code><\/pre>\n<p>  <\/p>\n<h3>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c, \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c<\/h3>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/9d5\/860\/1d5\/9d58601d52b04e79b79423df06331dcd.png\" alt=\"image\"  width=\"90%\"\/><\/div>\n<p>  \u0428\u043b\u0435\u043c \u0441<b> host2<\/b> \u043e\u0434\u043d\u043e ping \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0430 <b>10.0.2.3<\/b> (\u043c\u044b \u043e\u0436\u0438\u0434\u0430\u0435\u043c, \u0447\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442 \u0435\u0433\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e, <b>10.0.2.3 <\/b>\u2013 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u0415\u0441\u043b\u0438 \u0431\u044b \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0434\u043b\u044f <b>host1<\/b> \u2013 <b>10.0.1.1<\/b>, \u0442\u043e\u0433\u0434\u0430 \u043c\u044b \u0431\u044b \u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438)<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/529\/3e8\/ede\/5293e8ede76d4341a119a5adbf26e6c8.png\" alt=\"image\"  width=\"90%\"\/><\/div>\n<p>  \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u00ab\u043b\u043e\u0433\u0438\u00bb, \u0432\u044b\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/8f5\/071\/cf7\/8f5071cf7ccd41afb6af23d8089356ce.png\" alt=\"image\"  width=\"90%\"\/><\/div>\n<p>  <\/p>\n<h3>\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e?<\/h3>\n<p>  <\/p>\n<blockquote><p>\u0412 8354 \u2013 \u044f \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b \u043c\u043e\u0434\u0443\u043b\u044c.<br \/>  \u0412 8356 \u2013 \u043c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u0430\u043a\u0435\u0442. \u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e, \u043d\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 <i>DHCP <\/i>\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438.<br \/>  \u0412 8359 \u2013 \u043c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u0430\u043a\u0435\u0442 \u2014 \u044d\u0442\u043e \u0431\u044b\u043b \u043d\u0430\u0448 ping. \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043c\u044b \u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438, \u043c\u044b \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0430\u043b\u0438 \u043e\u0442\u0432\u0435\u0442 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438 \u0432\u0438\u0434\u0438\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<br \/>  \u0412 8359 \u2013 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 ping.<br \/>  \u0412 8394 \u2013 \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c.<\/p><\/blockquote>\n<p>  \u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0442\u0440\u0430\u0444\u0438\u043a \u0441 <b>host1<\/b> -&gt;<b> host2<\/b>, \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442.<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u043e\u043a\u0430 \u0432\u0441\u0435, \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0441\u044b\u043b\u043e\u043a:<\/p>\n<p>  \u00bb <a href=\"http:\/\/www.tldp.org\/LDP\/lkmpg\/2.6\/html\/lkmpg.html\">The Linux Kernel Module Programming Guide<\/a><br \/>  \u00bb <a href=\"http:\/\/www.thegeekstuff.com\/2013\/07\/write-linux-kernel-module\">How to Write Your Own Linux Kernel Module with a Simple Example<\/a><br \/>  \u00bb <a href=\"https:\/\/en.wikipedia.org\/wiki\/Netfilter\">https:\/\/en.wikipedia.org\/wiki\/Netfilter<\/a><br \/>  <a href=\"http:\/\/www.netfilter.org\/\">www.netfilter.org<\/a><br \/>  \u00bb <a href=\"https:\/\/debian-handbook.info\/browse\/stable\/sect.firewall-packet-filtering.html\">Firewall or Packet Filtering<\/a> \u2014 \u0442\u0443\u0442 \u044f \u0431\u0440\u0430\u043b \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \ud83d\ude42<br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/315350\/\"> https:\/\/habrahabr.ru\/post\/315350\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><b>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438:<\/b><\/p>\n<p>  <a href=\"https:\/\/habrahabr.ru\/post\/315340\/\"> <b>1.1<\/b> \u2014 \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u0438\u0438 (\u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043c \u0431\u044b\u043b\u043e \u0433\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c \u043d\u0430 \u0432\u0430\u0448\u0435\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435. \u0421\u0435\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 3\u0445 \u043c\u0430\u0448\u0438\u043d Linux ubuntu).<\/a><br \/>   <b>1.2<\/b> \u2013 \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0432 Linux. \u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432 Netfilter \u0438 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0442\u0440\u0430\u0444\u0438\u043a\u0430 \u0441 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e. \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435, \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c.<br \/>   <b>1.3<\/b> \u2013 \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e char device. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u2014 sysfs. \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 user interface. \u041e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435, \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-281004","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/281004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=281004"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/281004\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=281004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=281004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=281004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}