
方法一
iptables -A INPUT -p tcp -s 192.168.0.0/24 --destination-port 22 -j ACCEPT
iptables -A INPUT -p tcp -s 192.168.1.0/24 --destination-port 22 -j ACCEPT
iptables -A INPUT -p tcp -s ! 127.0.0.1 --destination-port 22 -j DROP
方法二
[root@nihao ~]# more /etc/hosts.deny
#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to us...