{"id":129,"date":"2010-01-28T17:30:19","date_gmt":"2010-01-28T14:30:19","guid":{"rendered":"http:\/\/oss-it.su\/?p=129"},"modified":"2018-10-22T10:26:28","modified_gmt":"2018-10-22T07:26:28","slug":"%d0%bd%d0%b0%d1%81%d1%82%d1%80%d0%be%d0%b9%d0%ba%d0%b0-ubuntu-9-10-%d1%81%d0%b5%d1%82%d0%b5%d0%b2%d1%8b%d0%bc-%d1%88%d0%bb%d1%8e%d0%b7%d0%be%d0%bc-%d0%b4%d0%bb%d1%8f-%d1%80%d0%b0%d0%b7%d0%b4%d0%b0","status":"publish","type":"post","link":"https:\/\/oss-it.su\/en\/129","title":{"rendered":"Setting Ubuntu server as Internet Gateway"},"content":{"rendered":"<p>How to: configure Ubuntu as a router.<\/p>\n<p>English version of this page under construction. <a href=\"https:\/\/translate.google.com\/translate?sl=ru&amp;tl=en&amp;u=https%3A%2F%2Foss-it.su%2F129\">You can read automatic translation<\/a>.<\/p>\n<hr \/>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0437\u0430\u043c\u0435\u0442\u043a\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <i>iptables<\/i> \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441 Ubuntu \u0438 Debian \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0430\u0447\u0438 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u0434\u0440\u0443\u0433\u0438\u043c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438. \u041d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430\u043a \u043c\u0430\u0448\u0438\u043d\u0443 \u0441 \u0434\u0432\u0443\u043c\u044f \u0441\u0435\u0442\u0435\u0432\u044b\u043c\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c\u0438 (\u0432 \u043e\u0434\u0438\u043d \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442, \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u2014 \u00ab\u0432\u044b\u0445\u043e\u0434\u0438\u0442\u00bb) \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0448\u043b\u044e\u0437\u043e\u043c.<\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0447\u0435\u0440\u0435\u0437 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Webmin, \u0447\u0435\u0440\u0435\u0437 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 &#8211; \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e GAdmintools. \u041d\u043e \u043c\u044b \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0448\u043b\u044e\u0437 \u043d\u0430\u043f\u044f\u043c\u0443\u044e, \u0430 \u043d\u0435 \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b.<\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0447\u0442\u043e \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e-\u0441\u0435\u0442\u0435\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0443\u0436\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0430, \u043d\u0430 \u0432\u0430\u0448\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 \u0438 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b \u0441\u0435\u0442\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0447\u0442\u043e \u043a \u0447\u0435\u043c\u0443, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0432\u0435\u0434\u0435\u043c \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p><code>ifconfig<\/code><\/p>\n<p>\u041e\u043d\u0430 \u0432\u044b\u0434\u0430\u0441\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432. \u0421\u0440\u0435\u0434\u0438 \u043d\u0438\u0445 \u043d\u0430\u0434\u043e \u043e\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0442\u0435, \u0447\u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0441\u043e \u0441\u043b\u043e\u0432 \u00abLink encap:Ethernet\u00bb \u2014 \u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u043a\u0430\u0440\u0442. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u044d\u0442\u043e eth0 \u0438 eth1.<br \/>\n\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0432 \u043a\u0430\u043a\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442, \u0430 \u0438\u0437 \u043a\u0430\u043a\u043e\u0433\u043e \u00ab\u0432\u044b\u0445\u043e\u0434\u0438\u0442\u00bb. \u041f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e \u0438\u0445 ip-\u0430\u0434\u0440\u0435\u0441\u0430\u043c.<br \/>\n\u0418\u0442\u0430\u043a, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0447\u0435\u0440\u0435\u0437 eth0 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0447\u0435\u0440\u0435\u0437 adsl-\u043c\u043e\u0434\u0435\u043c \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 ppp), \u0430 eth1 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u0430\u0441 \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u044c\u044e.<br \/>\n\u0415\u0441\u043b\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 <i>Network Manager<\/i>, \u0442\u043e \u043c\u044b \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0441\u0435\u0442\u0438:<\/p>\n<p><code>sudo nano \/etc\/network\/interfaces<\/code><\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0438\u0441\u043f\u0440\u0430\u0432\u044c\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043a \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 eth1), \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p><code>auto eth1<br \/>\niface eth1 inet static<br \/>\naddress 192.168.0.10<br \/>\nnetmask 255.255.255.0<br \/>\nnetwork 192.168.0.0<br \/>\nbroadcast 192.168.0.255<\/code><\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 address \u2014 \u044d\u0442\u043e \u0430\u0439\u043f\u0438 \u0432\u0430\u0448\u0435\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u0448\u043b\u044e\u0437.<br \/>\n\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 netmask \u2014 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0435\u0442\u044f\u0445 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u0430\u043a\u0430\u044f. \u0414\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432 <a href=\"http:\/\/www.subnetmask.info\/\">\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u0434\u0435\u0441\u044c<\/a>.<br \/>\n\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f network \u0438 broadcast \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0432\u0438\u0441\u0435\u0442\u044c \u043e\u0442 \u0432\u0430\u0448\u0435\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430. \u0422\u043e \u0435\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u0432\u0430\u0448 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 ip \u2014 10.0.0.10, \u0442\u043e network \u0438 broadcast \u0431\u0443\u0434\u0443\u0442 10.0.0.0 \u0438 10.255.255.255 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>\u041b\u0438\u0431\u043e, \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<p><code>sudo ifconfig eth1 192.168.0.10<\/code><\/p>\n<p>\u042d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442 \u0432\u0430\u0448\u0443 \u0441\u0435\u0442\u0435\u0432\u0443\u044e \u043a\u0430\u0440\u0442\u0443 eth1 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u0430\u0439\u043f\u0438-\u0430\u0434\u0440\u0435\u0441\u0430, \u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0448\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b <i>\/etc\/network\/interfaces<\/i><\/p>\n<p>\u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u0438\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 networking:<\/p>\n<p><code>sudo \/etc\/init.d\/networking restart<\/code><\/p>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<p><code>ifconfig<\/code><\/p>\n<p>\u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435, \u0447\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u0432 \u0441\u0438\u043b\u0443 \u0438 \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u0435\u043b\u043e \u0437\u0430 \u043c\u0430\u043b\u044b\u043c. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u0443\u0436\u0435 \u043f\u044b\u0442\u0430\u043b\u0438\u0441\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u0430\u0448\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0448\u043b\u044e\u0437\u043e\u043c, \u043d\u043e \u0443 \u0432\u0430\u0441 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0438\u043b\u0438 \u043f\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u0432\u044b \u0436\u0435\u043b\u0430\u0435\u0442\u0435 \u043e\u0431\u043d\u0443\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0444\u0430\u0439\u0440\u0432\u043e\u043b\u0430 iptables, \u0442\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438:<\/p>\n<p><code>iptables --flush<br \/>\niptables --table nat --flush<br \/>\niptables --delete-chain<br \/>\niptables --table nat --delete-chain<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u044f\u043c\u043e\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0441\u0431\u0440\u043e\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a iptables \u043d\u0435\u0442, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u044f\u0442 \u0432\u0430\u0448 iptables \u0434\u043b\u044f NAT-\u0442\u0440\u0430\u043d\u0441\u043b\u044f\u0446\u0438\u0438 (NAT, Network Address Translation \u2014 \u00ab\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432\u00bb) \u0447\u0435\u0440\u0435\u0437 Ubuntu-\u0448\u043b\u044e\u0437:<\/p>\n<p><code>sudo iptables -A FORWARD -i eth0 -o eth1 -s 192.168.0.0\/24 -m conntrack --ctstate NEW -j ACCEPT<br \/>\nsudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT<br \/>\nsudo iptables -A POSTROUTING -t nat -j MASQUERADE<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0432\u0430\u043c \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 eth0 \u0438 eth1, \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<br \/>\n\u0415\u0441\u043b\u0438 \u0432\u0430\u0448\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0435\u0442\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 192.168.x.x, \u0442\u043e \u043c\u0430\u0441\u043a\u0443 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043b\u0435\u0433\u043a\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <a href=\"http:\/\/www.subnetmask.info\/\">\u0441\u0435\u0440\u0432\u0438\u0441 <i>Network Calculators<\/i><\/a>.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 gateway&#8217;\u044f \u0434\u043b\u044f \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c IP-\u0444\u043e\u0440\u0432\u0430\u0440\u0434\u0438\u043d\u0433 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<p><code>sudo sh -c \"echo 1 &gt; \/proc\/sys\/net\/ipv4\/ip_forward\"<\/code><\/p>\n<p>\u0418 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0442\u0440\u0438\u0445: \u043d\u0430\u0434\u043e \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b <i>sysctl.conf<\/i>:<\/p>\n<p><code>sudo nano \/etc\/sysctl.conf<\/code><\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 \u043d\u0435\u0433\u043e \u0432\u043e\u0442 \u044d\u0442\u0438 \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u044f \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u0430:<\/p>\n<p><code>net.ipv4.conf.default.forwarding=1<br \/>\nnet.ipv4.conf.all.forwarding=1<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u0430\u0448 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u0448\u043b\u044e\u0437 \u0433\u043e\u0442\u043e\u0432 \u043a \u0440\u0430\u0431\u043e\u0442\u0435. \u041c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u043c\u0430\u0448\u0438\u043d\u044b. \u041d\u0430 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u043b\u044f \u043d\u0438\u0445 gateway \u0431\u0443\u0434\u0435\u0442 192.168.0.10<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0432\u043d\u0435\u0441\u0435\u043d\u043d\u044b\u0435 \u0432\u0430\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0438 \u0432\u044b \u0436\u0435\u043b\u0430\u0435\u0442\u0435 \u0432\u043d\u0435\u0441\u0442\u0438 \u044d\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 (\u0430 \u0438\u043c\u0435\u043d\u043d\u043e, \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 <i>iptables<\/i> \u0442\u0435\u0440\u044f\u044e\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b), \u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u043d\u044b\u043d\u0435\u0448\u043d\u044e\u044e \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e <i>iptables<\/i> \u0432 \u0444\u0430\u0439\u043b \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<p><code>sudo sh -c \"iptables-save &gt; \/etc\/iptables.up.rules\"<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432 \u0441\u0430\u043c \u0444\u0430\u0439\u043b \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \/etc\/network\/interfaces (<code>sudo nano \/etc\/network\/interfaces<\/code>) \u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043a \u0432\u0430\u043c \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &#8211; \u044d\u0442\u043e eth0) \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<p><code>pre-up iptables-restore &lt; \/etc\/iptables.up.rules<\/code><\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u043e\u043d\u043e \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0432\u0438\u0434\u0430:<\/p>\n<p><code>auto eth0<br \/>\niface eth0 inet manual<br \/>\npre-up iptables-restore &lt; \/etc\/iptables.up.rules<\/code><\/p>\n<p>\u0422\u043e\u043b\u044c\u043a\u043e \u043d\u0435 \u043c\u0435\u043d\u044f\u0439\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 iface, \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 auto eth0 (\u043d\u0443 \u0438\u043b\u0438 \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430). \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 <i>iptables<\/i> \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u044d\u0442\u043e\u043c\u0443 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0440\u0430\u0437\u0434\u0430\u0447\u0443 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 (dhcp) \u0438 \u043f\u0440\u043e\u043a\u0441\u0438, \u0442\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0442 <a href=\"http:\/\/leolik.blogspot.ru\/2008\/04\/dhcp-squid_19.html\">\u044d\u0442\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0435\u0439<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to: configure Ubuntu as a router.<\/p>\n","protected":false},"author":1,"featured_media":791,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[15],"class_list":["post-129","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-system","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/posts\/129","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/comments?post=129"}],"version-history":[{"count":5,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/posts\/129\/revisions"}],"predecessor-version":[{"id":1029,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/posts\/129\/revisions\/1029"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/media\/791"}],"wp:attachment":[{"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/media?parent=129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/categories?post=129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oss-it.su\/en\/wp-json\/wp\/v2\/tags?post=129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}