{"id":729,"date":"2013-04-13T19:15:17","date_gmt":"2013-04-13T10:15:17","guid":{"rendered":"http:\/\/www.nightmare-yk.com\/?p=729"},"modified":"2016-02-24T08:30:42","modified_gmt":"2016-02-23T23:30:42","slug":"fedora18-%e7%ac%ac2%e5%bc%befirewalld","status":"publish","type":"post","link":"http:\/\/www.nightmare-yk.com\/?p=729","title":{"rendered":"Fedora18 \u7b2c2\u5f3e(FirewallD)"},"content":{"rendered":"<p>FirewallD\u3092\u8abf\u3079\u308b\u6a5f\u4f1a\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u3044\u308d\u3044\u308d\u3068\u8abf\u3079\u305f\u3093\u3067\u3059\u304c\u3001\u5206\u304b\u3089\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u30e1\u30e2\u30e1\u30e2\u3006(.. )<\/p>\n<p>\u4ee5\u4e0b\u306b\u516c\u5f0f\u306e\u30b5\u30a4\u30c8\u3092\u7d39\u4ecb\u3057\u3066\u304a\u304d\u307e\u3059\u3002\u65e5\u672c\u8a9e\u3082\u7528\u610f\u3055\u308c\u3066\u3044\u3066\u4fbf\u5229\u3067\u3059\u3088\u306d\u30fc\uff08\uff3e\uff3e;\uff09<br \/>\n\u305d\u3063\u3061\u3092\u898b\u305f\u307b\u3046\u304c\u826f\u304b\u3063\u305f\u308a\u3057\u3066\u3002<br \/>\n<a title=\"Fedora18\" href=\"https:\/\/fedoraproject.org\/wiki\/FirewallD\/jp\"><span style=\"color: #00FF00;\">https:\/\/fedoraproject.org\/wiki\/FirewallD\/jp<\/span><\/a><\/p>\n<p>\u305d\u308c\u306f\u3055\u3066\u304a\u304d\u3001FirewallD\u306fiptables\u3092\u52d5\u4f5c\u3055\u305b\u305f\u307e\u307e\u30eb\u30fc\u30eb\u3092\u5909\u66f4\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u30b5\u30fc\u30d3\u30b9\u30c7\u30fc\u30e2\u30f3\u3067\u3059\u3002\u30eb\u30fc\u30eb\u3092\u5909\u66f4\u3057\u305f\u969biptables\u30b5\u30fc\u30d3\u30b9\u306e\u518d\u8d77\u52d5\u304c\u5fc5\u8981\u3068\u306a\u308a\u3001\u518d\u8d77\u52d5\u306e\u969b\u306b\u4e00\u6642\u7684\u306bFirewall\u306e\u30eb\u30fc\u30eb\u304c\u7121\u3044\u72b6\u614b\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u3093\u3067\u3059\u304c\u3001FirewallD\u306f\u505c\u6b62\u306a\u3057\u3067\u3067\u304d\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>FirewallD\u306e\u8d77\u52d5\u7b49\u306fsystemd\u306a\u3093\u3067\u3059\u306d\u3002SystemV\u5f62\u5f0f\u306e\u3082\u306e\u304b\u3089systemd\u3092\u4f7f\u3063\u305f\u3082\u306e\u306b\u5909\u308f\u3063\u3066\u3044\u308b\u3093\u3067\u3059\u3088\u306d\u30fc\u3002<\/p>\n<p>\u25c6 FirewallD\u306e\u8d77\u52d5\/\u505c\u6b62<br \/>\nsystemctl\u3092\u4f7f\u3063\u3066FirewallD\u306e\u8d77\u52d5\u3084\u505c\u6b62\u7b49\u304c\u884c\u3048\u307e\u3059<\/p>\n<table id=\"yk-table\">\n<thead>\n<tr>\n<th>\u5185\u5bb9<\/td>\n<th>\u30b3\u30de\u30f3\u30c9<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th scope=\"row\">Firewalld\u306e\u8d77\u52d5<\/th>\n<td># systemctl start firewalld<\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">Firewalld\u306e\u505c\u6b62<\/th>\n<td># systemctl stop firewalld<\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">Firewalld\u306e\u518d\u8d77\u52d5<\/th>\n<td># systemctl restart firewalld<\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">Firewalld\u306e\u72b6\u614b\u8868\u793a<\/th>\n<td># systemctl status firewalld<\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">Firewalld\u306e\u81ea\u52d5\u8d77\u52d5<\/th>\n<td># systemctl enable firewalld<\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">Firewalld\u306e\u81ea\u52d5\u8d77\u52d5\u505c\u6b62<\/th>\n<td># systemctl disable firewalld<\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">firewalld\u3092\u72b6\u614b\u306e\u60c5\u5831\u3092\u5931\u308f\u305a\u306b\u30ea\u30ed\u30fc\u30c9<\/th>\n<td># firewall-cmd &#45;&#45;reload<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\/etc\/sysconfig\/iptables\u3092\u5909\u66f4\u3057\u3066\u3044\u3064\u3082\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002\u540c\u3058\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u304b\u3068\u6bd4\u8f03\u3057\u3066\u307f\u305f\u3093\u3067\u3059\u304c\u3001\u5c11\u3057\u5dee\u304c\u3002<\/p>\n<p><span style=\"color: #7B68EE;\">\u25a0 \u5916\u90e8\u304b\u3089\u5185\u90e8\u3078\u306essh\u30b5\u30fc\u30d3\u30b9\u3092\u6c38\u7d9a\u7684\u306b\u6709\u52b9\u5316<\/span><br \/>\niptables:<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre>INPUT 1 -p tcp &#45;&#45;dport 22 -m state &#45;&#45;state NEW -j ACCEPT<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>FirewallD:<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># firewall-cmd &#45;&#45;add-service=ssh \u2190\u5373\u6642\u53cd\u6620\r\n# firewall-cmd &#45;&#45;permanent &#45;&#45;add-service=ssh \u2190\u6c38\u7d9a\u8a2d\u5b9a<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #7B68EE;\">\u25a0 \u5185\u90e8\u304b\u3089\u5916\u90e8\u3078\u306essh\u30b5\u30fc\u30d3\u30b9\u3092\u6c38\u7d9a\u7684\u306b\u6709\u52b9\u5316<\/span><br \/>\niptables:<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre>OUTPUT 1 -p tcp &#45;&#45;dport 22 -m state &#45;&#45;state NEW -j ACCEPT<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>FirewallD:<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre><strike>\u6c38\u7d9a\u7684\u306b\u306f\u8a2d\u5b9a\u3067\u304d\u306a\u3044<\/strike>\u3067\u304d\u307e\u3057\u305f\uff01<a title=\"\u7d9a FirewallD\" href=\"http:\/\/www.nightmare-yk.com\/?p=1344\"><span style=\"color: #008000;\">\u3053\u3053\u306b\u8a18\u4e8b\u304c\uff01<\/span><\/a><\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #7B68EE;\">\u25a0 ssh\u3092192.168.0.20\u3068\u3044\u3046\u30db\u30b9\u30c8\u306b\u8ee2\u9001\u3059\u308b\u3002<\/span><br \/>\niptables:<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre>FORWARD -d 192.168.0.20 -p tcp &#45;&#45;doprt 22 -j REDIRECT<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>FirewallD:<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># firewall-cmd &#45;&#45;add-forward-port=port=22:proto=tcp:toaddr=192.168.0.20 \u2190\u5373\u6642\u53cd\u6620\r\n# firewall-cmd &#45;&#45;permanent &#45;&#45;add-forward-port=port=22:proto=tcp:toaddr=192.168.0.20 \u2190\u6c38\u7d9a\u8a2d\u5b9a<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>&nbsp;<\/p>\n<p><span style=\"color: #7B68EE;\">\u25a0 \u30de\u30b9\u30ab\u30ec\u30fc\u30c7\u30a3\u30f3\u30b0\u3092\u6709\u52b9\u5316\u3059\u308b\u3002<\/span><br \/>\niptables:<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre>POSTROUTING -o eth0 -j MASQUERADE<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>FirewallD:<\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># firewall-cmd &#45;&#45;add-masquerade \u2190\u5373\u6642\u53cd\u6620\r\n# firewall-cmd &#45;&#45;permanent &#45;&#45;add-masquerade \u2190\u6c38\u7d9a\u8a2d\u5b9a<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u5916\u90e8\u3078\u306e\u30a2\u30af\u30bb\u30b9\u8a2d\u5b9a\u3068\u3057\u3066\u6c38\u7d9a\u8a2d\u5b9a\u306f\u3067\u304d\u306a\u3044\u3088\u3046\u3067\u3059\u3002\u4e00\u6642\u7684\u306b\u306f\u3067\u304d\u308b\u3088\u3046\u3067\u3059\u304c\u3002<br \/>\n\u5916\u90e8\u304b\u3089\u901a\u4fe1\u8a31\u53ef\u304c\u3067\u304d\u308c\u3070\u307e\u30fc\u5927\u4e08\u592b\u304b\u3068\u601d\u3046\u3093\u3067\u3059\u304c\u3001\u81ea\u5206\u304c\u6271\u3063\u3066\u3044\u308b\u30b7\u30b9\u30c6\u30e0\u3067\u306f\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3068\u3057\u3066\u4f4e\u3044\u306e\u3067\u3002\u3002\u3002\u3082\u3057\u3001\u3067\u304d\u308b\u65b9\u6cd5\u304c\u3042\u308b\u306a\u3089\u6559\u3048\u3066\u3044\u305f\u3060\u304d\u305f\u3044\u3002<br \/>\n\u5f8c\u3001\u9593\u9055\u3048\u3066\u3044\u305f\u3089\u3054\u3081\u3093\u3061\u3083\u3044\u3002<br \/>\n\u5373\u6642\u53cd\u6620\u3068\u6c38\u7d9a\u53cd\u6620\u306e\u4e21\u65b9\u3092\u5b9f\u884c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u305d\u3053\u306f\u6ce8\u610f\u3059\u3079\u304d\u3067\u3059\u306d\u3002<\/p>\n<p>\u30c6\u30af\u30cb\u30ab\u30eb\u306a\u4e8b\u3082\u3067\u304d\u307e\u3059\u304c\u3001\u4eca\u306e\u3068\u3053\u308d\u6d3b\u7528\u3057\u305f\u3053\u3068\u304c\u306a\u3044\u3002\u3002\u3002<\/p>\n<p><span style=\"color: #7B68EE;\">\u25a0 60\u79d2\u9593\u3060\u3051public \u30be\u30fc\u30f3\u3067http \u30b5\u30fc\u30d3\u30b9\u3092\u6709\u52b9\u5316<\/span><\/p>\n<table style=\"table-layout:fixed;\">\n<tr>\n<td>\n<div style=\"overflow-x:auto;\">\n<pre># firewall-cmd &#45;&#45;zone=public &#45;&#45;add-service=http &#45;&#45;timeout=60<\/pre>\n<\/p><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p>&nbsp;<br \/>\n\u6700\u5f8c\u306b\u3001\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306fXML\u5f62\u5f0f\u3067\u66f8\u304b\u308c\u3066\u308b\u3093\u3067\u3059\u306d\u30fc\u3002<br \/>\n\u300c\/etc\/firewalld\/zones\u300d\u306b\u8a18\u8f09\u3057\u3066\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3082\u3046\u5c11\u3057\u4f7f\u3063\u3066\u307f\u308b\u3068\u898b\u3048\u3066\u304f\u308b\u3068\u3053\u308d\u304c\u3042\u308b\u304b\u3082\uff08\uff3e\uff3e\uff1b\uff09<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"http:\/\/www.nightmare-yk.com\/?p=729\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"http:\/\/www.nightmare-yk.com\/?p=729\" ><\/g:plusone><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>FirewallD\u3092\u8abf\u3079\u308b\u6a5f\u4f1a\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u3044\u308d\u3044\u308d\u3068\u8abf\u3079\u305f\u3093\u3067\u3059\u304c\u3001\u5206\u304b\u3089\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u30e1\u30e2\u30e1\u30e2\u3006(.. ) \u4ee5\u4e0b\u306b\u516c\u5f0f\u306e\u30b5\u30a4\u30c8\u3092\u7d39\u4ecb\u3057\u3066\u304a\u304d\u307e\u3059\u3002\u65e5\u672c\u8a9e\u3082\u7528\u610f\u3055\u308c\u3066\u3044\u3066\u4fbf\u5229\u3067\u3059\u3088\u306d\u30fc\uff08\uff3e\uff3e;\uff09 \u305d\u3063\u3061\u3092\u898b\u305f\u307b\u3046\u304c\u826f\u304b\u3063\u305f\u308a\u3057\u3066\u3002 https:\/\/fedoraproject.org\/wik [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[3],"tags":[63,93,22],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/posts\/729"}],"collection":[{"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=729"}],"version-history":[{"count":31,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/posts\/729\/revisions"}],"predecessor-version":[{"id":1330,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=\/wp\/v2\/posts\/729\/revisions\/1330"}],"wp:attachment":[{"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=729"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nightmare-yk.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}