eth0 =》内网172.18.1.240
eth1=》外网211.139.169.Xecho 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE iptables -t nat -A POSTROUTING -s 172.18.1.0/22 -o eth1 -j MASQUERADE
iptables -A FORWARD -i eth0 -j ACCEPT iptables -A FORWARD -s 172.18.1.0/22 -m state --state ESTABLISHED,RELATED -j ACCEPT
service iptables save
#限制特定MAC 地址外部访问: iptables -A FORWARD -m mac --mac-source xx:xx:xx:xx:xx:xx -j DROP #解封: iptables -D FORWARD -m mac --mac-source xx:xx:xx:xx:xx:xx -j DROP
#限制所有通信: iptables -A INPUT -m mac --mac-source xx:xx:xx:xx:xx:xx -j DROP #解封: iptables -A INPUT -m mac --mac-source xx:xx:xx:xx:xx:xx -j DROP
#限制特定IP外部访问: iptables -A FORWARD -s 192.168.0.x -j DROP #解封: iptables -D FORWARD -s 192.168.0.x -j DROP
#限制所有通信: iptables -A INPUT -s 192.168.0.x -j DROP #解封: iptables -D INPUT -s 192.168.0.x -j DROP
iptables -L #或者: cat /etc/sysconfig/iptables
vi /etc/ssh/sshd_config找到#Port 22 行,新增
vi /etc/ssh/sshd_config找到 #PermitRootLogin yes 新增
Service sshd restart