linux禁ping與限制ip登入

來源:互聯網
上載者:User

 

以root進入linux系統,然後編輯檔案icmp_echo_ignore_all
vi /proc/sys/net/ipv4/icmp_echo_ignore_all
將其值改為1後為禁止PING
將其值改為0後為解除禁止PING

我的LNUX也不是很好希望大家以後多多指點!

echo > 1 /proc/sys/net/ipv4/icmp_echo_ignore_all禁ping
echo > 0 /proc/sys/net/ipv4/icmp_echo_ignore_all解ping

============================================================================================
在/etc/hosts.allow輸入  
  (其中192.168.10.88是你要允許登陸ssh的ip,或者是一個網段192.168.10.0/24)  
  sshd:192.168.10.88:allow  
   
  在/etc/hosts.deny輸入(表示除了上面允許的,其他的ip   都拒絕登陸ssh)  
  sshd:ALL
比如說你只允許1.1.1.1這個IP進入,其它都禁止:  
  方法1、iptables。  
  iptables   -A   INPUT   -p   tcp   -s   1.1.1.1   --destination-port   22   -j   ACCEPT  

  iptables   -A   INPUT   -p   tcp   --destination-port   22   -j   DROP    
  方法2:  
  vi   /etc/ssh/sshd_config  
  添加一行:  
  allowusers   xxx@1.1.1.1  
  註:xxx為你用來登入伺服器的使用者名稱

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.