网卡文件位置:/etc/sysconfig/network-scripts
网卡配置文件的名称命名格式:ifcfg-网卡名称
onboot:是否开机
bootproto:ip地址分配方式
hwaddr:mac地址
1、service network restart
2、直接调用服务的快捷方式
服务的快捷方式的存放位置:/etc/init.d
故重启网卡:/etc/init.d/network restart
ifdown 网卡名
ifup 网卡名
软链接:ln -s 原始文件的路径 快捷方式额路径
远程连接协议、远程文件传输协议
端口号: 22
端口可以被修改:/etc/ssh/ssh_config
1、范围:0-65535
2、不能使用已经占用的端口
启动/停止/重启
1、service sshd start / stop / restart
2、/etc/init.d/sshd start / stop / restart
hostname 设置的主机名
修改配置文件:/etc/sysconfig/network
需重启后生效,但域名未被dns识别,需要添加到host文件中:
host文件的位置:/etc/hosts
开启http协议:service httpd start
管理开机自启动服务
chkconfig --list
chkconfig --del 服务名
chkconfig --add 服务名
chkconfig -- level 启动级别 服务名 on / off【级别连在一起】
用于对服务器时间的同步
同步方式两种:
上游时间:
ntpdate 时间服务器的域名或者ip
ip地址查询:http://ntp.org.cn/pool.php
服务名:ntpd
启动ntpd服务:service ntpd start 或者 /etc/init.d/ntpd start
设置ntpd 服务开机自启:
chkconfig --list | grep ntpd :查看
chkconfig --level 35 ntpd on :启动
选择让请求进入,保证网络安全
centos6.5的防火墙是 iptables,centos7的防火墙是firewalld
service iptables start / stop / restart
或
/etc/init.d/iptables start / stop / restart
service iptables status
iptables -L -n
-L :列出规则
-n:将单词表达形式改为数字表示
允许80端口通过:iptables -A INPUT -p tcp --dport 80 -j ACCEPT
原文:https://www.cnblogs.com/pam-sh/p/13046633.html