1. linux 如何查看防火牆是否開啟
詳細步驟如下:
1、芹讓數打開Linux系統進入桌面,點擊上方菜單欄處【系統】選項;
2. linux闃茬伀澧欓厤緗
linux閰嶇疆闃茬伀澧欐誨叡闇瑕4姝ユ搷浣滐紝鏈瑙嗛戦氳繃centos7緋葷粺鏉ユ搷浣滐紝鍏蜂綋鐨勬搷浣滄柟娉曞備笅錛
1
鎵撳紑緙栬緫鏂囦歡
棣栧厛鍦↙inux緋葷粺涓鏌ユ壘騫舵墦寮緙栬緫閰嶇疆闃茬伀澧欑殑鏂囦歡銆 2
娣誨姞璇鍙
鍦ㄦ墦寮鐨勬枃浠朵腑娣誨姞璇鍙ワ紝璇鍙ヤ竴瀹氳佸湪icmp-host-prohibited涔嬪墠銆 3
閲嶅惎闃茬伀澧
閲嶅惎闃茬伀澧欙紝浣塊厤緗鐢熸晥錛屽叆鍛戒護銆 4
鏌ョ湅闃茬伀澧
鏌ョ湅闃茬伀澧欐槸鍚︾敓鏁堬紝杈撳叆鍛戒護錛歩ptables -L -n銆 end 1 2 3 4
澹版槑錛氭湰緗戦〉鍐呭規棬鍦ㄤ紶鎾鐭ヨ瘑錛岃嫢鏈変鏡鏉冪瓑闂棰樿峰強鏃朵笌鏈緗戣仈緋伙紝鎴戜滑灝嗗湪絎涓鏃墮棿鍒犻櫎澶勭悊銆
3. linux闃茬伀澧欏叧闂鍜屽紑鍚鍛戒護linux闃茬伀澧欏叧闂
linux濡備綍鍏抽棴闃茬伀澧欙紵
rhel6鍏抽棴闃茬伀澧欑殑鏂規硶涓猴細serviceiptablesstatus鏌ョ湅褰撳墠闃茬伀澧欑姸鎬1.姘鎬箙鎬х敓鏁堝紑鍚錛歝hkconfigiptableson鍏抽棴錛歝hkconfigiptablesoff2.鍗蟲椂鐢熸晥錛岄噸鍚鍚庡け鏁堝紑鍚錛歴erviceiptablesstart鍏抽棴錛歴erviceiptablesstoprhel7鍏抽棴闃茬伀澧欑殑鏂規硶媯鑰呬負錛歴ystemctlstatusfirewalld鏌ョ湅褰撳墠闃茬伀澧欑姸鎬1.姘鎬箙鎬х敓鏁堝紑鍚錛歴ystemctlenablefirewalld鍏抽棴錛歴ystemctldisablefirewalld2.鍗蟲椂鐢熸晥錛岄噸鍚鍚庡け鏁堝紑鍚錛歴ystemctlstartfirewalld鍏抽棴錛歴ystemctlstopfirewalld
linux濡備綍鍏抽棴nginx闃茬伀澧欙紵
Linux鍏抽棴Nginx闃茬伀澧欑殑鍛戒護鏄錛氭や婦鍚
firewall-cmd--remove-port=80/tcp--permanent
firewall-cmdreload
systemctlrestartfirewalld.service
linux6.0淇鏀歸槻鐏澧欒劇疆錛
鏀筁inux緋葷粺闃茬伀澧欓厤緗闇瑕佷慨鏀/etc/sysconfig/iptables榪欎釜鏂囦歡
vim/etc/sysconfig/iptables
鍦╲im緙栬緫鍣錛屼細鐪嬪埌涓嬬瓟鏍擱潰鐨勫唴瀹
#-config-firewall
#.
*filter
:INPUTACCEPT
:FORWARDACCEPT
:OUTPUTACCEPT
-AINPUT-mstate--stateESTABLISHED,RELATED-jACCEPT
-AINPUT-picmp-jACCEPT
-AINPUT-ilo-jACCEPT
-AINPUT-mstate--stateNEW-mtcp-ptcp--dport22-jACCEPT
-AINPUT-mstate--stateNEW-mtcp-ptcp--dport8080-jACCEPT
-AINPUT-mstate--stateNEW-mtcp-ptcp--dport3306-jACCEPT
-AINPUT-mstate--stateNEW-mtcp-ptcp--dport2181-jACCEPT
-AINPUT-jREJECT--reject-withicmp-host-prohibited
-AFORWARD-jREJECT--reject-withicmp-host-prohibited
COMMIT
闇瑕佸紑鏀劇鍙o紝璇峰湪閲岄潰娣誨姞涓鏉′竴涓嬪唴瀹瑰嵆鍙:
-ARH-Firewall-1-INPUT-mstate--stateNEW-mtcp-ptcp--dport1521-jACCEPT
鍏朵腑1521鏄瑕佸紑鏀劇殑絝鍙e彿錛岀劧鍚庨噸鏂板惎鍔╨inux鐨勯槻鐏澧欐湇鍔°
Linux涓嬪仠姝/鍚鍔ㄩ槻鐏澧欐湇鍔$殑鍛戒護(root鐢ㄦ埛浣跨敤)錛
serviceiptablesstop--鍋滄
serviceiptablesstart--鍚鍔
鍐欏湪鏈鍚:
#姘鎬箙鎬х敓鏁堬紝閲嶅惎鍚庝笉浼氬嶅師
chkconfigiptableson#寮鍚
chkconfigiptablesoff#鍏抽棴
#鍗蟲椂鐢熸晥錛岄噸鍚鍚庡嶅師
serviceiptablesstart#寮鍚
serviceiptablesstop#鍏抽棴
Linux鍐呮牳鎻愪緵闃茬伀澧欏悧錛
鎻愪緵
SElinux鏄鍩轟簬鍐呮牳寮鍙戝嚭鏉ョ殑涓縐嶅畨鍏ㄦ満鍒訛紝琚縐頒箣涓哄唴鏍哥駭鍔犲己鍨嬮槻鐏澧欙紝鏈夊姏鐨勬彁鍗囦簡緋葷粺鐨勫畨鍏ㄦс
SElinux鐨勪綔鐢ㄥ垎涓轟袱鏂歸潰錛1.鍦ㄦ湇鍔′笂闈㈠姞涓婃爣絳撅紱2.鍦ㄥ姛鑳戒笂闈㈤檺鍒跺姛鑳
鍦╨inux緋葷粺涓浣跨敤getenforce鍛戒護鍙浠ユ煡鐪媠elinux鐨勭姸鎬侊細
disabled涓哄叧闂鐘舵侊紝瀵規湇鍔″拰鍔熻兘閮芥病鏈夐檺鍒
enforcing涓哄己鍒剁姸鎬侊紝瀵規湇鍔″拰鍔熻兘閮借繘琛岄檺鍒
linux涓鎬庢牱鏌ョ湅闃茬伀澧欐槸鍚﹀叧闂浜嗭紵
璇︾粏姝ラゅ備笅錛
1銆佹墦寮Linux緋葷粺榪涘叆妗岄潰錛岀偣鍑諱笂鏂硅彍鍗曟爮澶勩愮郴緇熴戦夐」錛
2銆佸湪寮瑰嚭鐨勮彍鍗曟爮涓錛屼緷嬈$偣鍑匯愮$悊銆戱紝銆愰槻鐏澧欍戦夐」錛
3銆佽繘鍏ラ槻鐏澧欑晫闈錛岃緭鍏ョ敤鎴峰瘑鐮侊紝榪涜屽畨鍏ㄩ獙璇侊紱
4銆佽繛鎺ユ湇鍔″櫒鍚庯紝杈撳叆璇鍙モ榮erviceiptablesstatus鈥欙紝鍥炶濺錛屼細鏄劇ず闃茬伀澧欑姸鎬侊紱
5銆佽緭鍏ヨ鍙モ榗hkconfigiptableson鈥欙紝鍙浠ュ紑鍚闃茬伀澧欍傛垨鑰呬嬌鐢ㄨ鍙モ榗hkconfigiptablesoff鈥欙紝鍏抽棴闃茬伀澧欙紝闇瑕侀噸鍚鍚庣敓鏁堛