主机IP地址查询
ifconfig
修改网卡的相关信息.ip地址,网关,子网掩码,DNS
[root@lab01 Desktop]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=493f48d3-2d3d-45b1-9133-931a9a8103e0
ONBOOT=no
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.110.239 //IP
PREFIX=24 //子网掩码
GATEWAY=192.168.110.2
DNS1=8.8.8.8 //DNS
DEFROUTE=yes //网关
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=00:0C:29:EE:A2:EF
LAST_CONNECT=1516694420
如果修改网络相关的信息,我们可以重启服务器
service network restart
用户查看系统进程信息
[root@lab01 ~]# ps -ef |grep java
root 3915 3878 0 22:13 pts/1 00:00:00 grep java
根据端口号查看对应的进程信息
netstat -anp |grep 3306
设置开机启动iptables服务
chkconfig iptables on
重启防火墙,修改配置信息后需要重启服务才生效
service iptables restart
编辑防火墙配置文件
vi /etc/sysconfig/iptables
[root@lab01 ~]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-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
//开放22端口,如果需要配置开发8080端口,参考该配置即可
-p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT