网络相关命令
- 获取ip地址:
ifconfig或者ip -a - 修改网卡名称:
vim /boot/grub2.cfg, 在第一个linux16后添加net.ifnames=0 - 与服务器时间临时同步:
ntpdate IP(及时同步时间命令) - 与服务器时间永久同步:
vim /etc/ntp.conf添加service IP iburst后执行: - ntpd开关
- CentOS6:
-
service ntpd start开启同步服务 -
service ntpd restart重启服务 -
chkconfig ntpd on开机自启动
-
- CentOS7:
-
systemctl start ntpd开启同步服务 -
systemctl restart ntpd重启同步服务 -
systemctl enable ntpd开机自启动
-
- CentOS6:
- 防火墙开关
- CentOS6:
-
service iptables status查看防火墙状态 -
service iptables stop关闭防火墙 -
service iptables start打开防火墙 -
chkconfig iptables on/off永久开启关闭防火墙:
-
- CentOS7:
-
systemctl stop firewalld关闭防火墙 -
systemctl start firewalld打开防火墙 -
systemctl enable/disable firewalld开机启动/不启动防火墙
-
- CentOS6: