首先找到配置目录
cd /etc/sysconfig/network-scripts
我的是ifcfg-eth0
vi ifcfg-eth0
具体配置
DEVICE="eth0"
BOOTPROTO="static"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
IPADDR=192.168.5.128
NETMASK=255.255.255.0
GATEWAY=192.168.5.1
DNS1=8.8.8.8
reboot重启
防火墙放行端口
vi /etc/sysconfig/iptables
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
或者
-A INPUT -s 59.197.48.6/32 -p tcp -m tcp --dport 8082 -j ACCEPT