|NO.Z.00002|——————————|LinuxNetwork|——|Linux&路由端口.V01|
一、Centos6.x和Centos7.x对比
### --- CentosOS6.x和CentOS7.x对比-文件系统
~~~ #centos6.x:EXT4:
~~~ ext4的单个文件系统容量达到1EB,单个文件大小则达到16TB
~~~ #centos7.x:XFS:
~~~ xfs默认支持8EB减1字节的单个文件系统,最大可支持的文件大小为9EB,
~~~ 最大文件系统尺寸为18EB
### --- CentosOS6.x和CentOS7.x对比-防火墙/内核版本/默认数据库
~~~ centos6.x:防火墙:iptables 内核版本:3.6.x-x 默认数据库:mysql
~~~ centos7.x:防火墙:firewalld 内核版本:3.10.x-x 默认数据库:mariadb
### --- CentosOS6.x和CentOS7.x对比-时间同步/修改时区/修改语言
~~~ centos6.x:时间同步:ntpq -p 修改时区:/etc/sysconfig/clock 修改语言:/etc/sysconfig/i18n
~~~ centos7.x:时间同步:chronyc sources 修改时区:timedatectl set-timezone Asia/Shanghai 修改语言:localectl set-locale LANG=zh_CN.UTF-8
### --- centos7.x
[root@cento7 ~]# timedatectl // 查看当前系统的时区
Time zone: Asia/Shanghai (CST, +0800)
[root@cento7 ~]# timedatectl set-timezone Asia/Shanghai // 修改时区
[root@cento7 ~]# localectl
System Locale: LANG=en_US.UTF-8
VC Keymap: us
X11 Layout: us
[root@cento7 ~]# localectl set-locale LANG=en_US.utf8 // 修改语言
[root@cento7 ~]# localectl
System Locale: LANG=en_US.utf8
VC Keymap: us
X11 Layout: us
### --- centos6.x
[root@centos6 ~]# cat /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16" // i18n:i十八n
二、CentosOS6.x和CentOS7.x对比-主机名
### --- CentosOS6.x和CentOS7.x对比-主机名
~~~ centos6.x:的配置文件为:/etc/sysconfig/network(永久配置)
~~~ centos7.x:的配置文件为:/etc/hostname(永久配置)
~~~ centos7.x:还可以使用命令永久设置:hostnamectl set-hostname atyanqi.com
### --- centos6.x
[root@centos6 ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
[root@centos6 ~]# hostname atyanqi // 更改主机名,临时生效
[root@centos6 ~]# cat /etc/sysconfig/network // 配置文件未生效。
NETWORKING=yes
HOSTNAME=localhost.localdomain
### --- centos7.x
[root@cento7 ~]# cat /etc/hostname
localhost.localdomain
[root@cento7 ~]# hostnamectl set-hostname atyanqi.com // 更改主机名,永久生效
[root@cento7 ~]# cat /etc/hostname // 配置文件生效
atyanqi.com
三、CentosOS6.x和CentOS7.x对比-网络服务管理
操作行为 | centos6.x | centos7.x |
启动指定服务 | service 服务名 start | systemctl start 服务名 |
关闭指定服务 | service 服务名 stop | systemctl stop 服务名 |
重启指定服务 | service 服务名 restart | systemctl restart 服务名 |
查看指定服务状态 | service 服务名 status | systemctl status 服务名 |
查看所有服务状态 | service --status-all | systemctl list-units |
设置服务自启动 | chkconfig 服务名 on | systemctl enable 服务名 |
设置服务不自启动 | chkconfig 服务名 off | systemctl disable 服务名 |
查看所欲服务自启动状态 | chkconfig --list | systemctl list-unit-files |
### --- 查看服务是否开机自启动
### --- centos6.x中service只是启动的一种方法,还可以使用绝对命令
[root@cento7 ~]# systemctl disable vsftpd // 设置开机不自启动
[root@cento7 ~]# systemctl list-unit-files|grep vsftpd
vsftpd.service disabled
vsftpd@.service disabled
vsftpd.target disabled
[root@cento7 ~]# systemctl enable vsftpd // 设置开机自启动
[root@cento7 ~]# systemctl list-unit-files|grep vsftpd
vsftpd.service enabled // 这是标准状态,
vsftpd@.service disabled // 这两个不是
vsftpd.target disabled // 这两个不是
四、CentosOS6.x和CentOS7.x对比-网络设置
### --- CentosOS6.x和CentOS7.x对比-网络设置
~~~ 网卡名: centos 6.x网卡名为:eth0 centos7.x网卡名:ens33
~~~ 网络配置命令: centos6.x:ifconfig/setup centos7.x:ip/nmtui
~~~ 网络服务: centos6.x:默认使用network服务 centos7.x:默认使用NetworkManager服务(network作为备用)
### --- centos6.x下查找命令所在位置
[root@centos6 ~]# which ifconfig // 查看命令所在位置
/sbin/ifconfig
[root@centos6 ~]# rpm -qf /sbin/ifconfig // 查询系统文件属于哪个包
net-tools-1.60-110.el6_2.x86_64
[root@centos6 ~]# setup // 图形化配置网卡设置
Authentication configuration │ // 身份验证配置
Firewall configuration │ // 防火墙配置
Keyboard configuration │ // 键盘配置
Network configuration │ // 网络配置
System services │ // 系统服务
│ Run Tool │ │ Quit
### --- centos7.x
[root@cento7 ~]# nmtui // 图形化配置网卡设置
NetworkManager TUI // 编辑连接
Activate a connection // 启用连接
Set system hostname // 设置主机名
│ Quit <OK>
五、centos7.x网络设置

### --- centos7、x配置文件/网卡改名
### --- 配置网卡文件
~~~ 配置文件目录:/etc/sysconfig/network-scripts/ifcfg-ens33
~~~ 配置管理命令:ifconfig/ip address show
### --- 配置文件内容:
DEVICE=ens33 // 设备名称
NAME=ens33 // 网卡名称
BOOTPROTO=static // 连接方式(dhcp/static)
ONBOOT=yes // 是否开机加载
IPADDR=192.168.12.250 // IP地址
NETMASK=255.255.255.0 // 子网掩码(PREFIX/24)
GATEWAY=192.168.1.1 // 网关
DNS1=8.8.8.8 // DNS
### --- 注意:网卡配置文件内,选项要大写,小写不报错但不生效,参数可小写
六、IP地址配置-Centos7修改网卡名
### --- 修改网卡配置文件名(建议将原配置文件备份)
[root@centos7 ~]# cd /etc/sysconfig/network-scripts/
[root@centos7 network-scripts]# cp -a ifcfg-ens33 ifcfg-eth0
[root@centos7 network-scripts]# mv ifcfg-ens33 /root/
### --- 修给网卡配置文件内容
[root@centos7 network-scripts]# vim ifcfg-eth0
NAME=eth0 // 网卡名
DEVICE=eth0 // 设备名
### --- 修给grub配置文件
~~~ 在指定位置新增红色参数,关闭一致性命名规则;
~~~ net.ifnames=0:网卡里面永久关闭0 biosdevname=0:bison的设备也是关闭后状态
[root@centos7 network-scripts]# vim /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0"
### --- 更新grub配置文件,并加载新的参数
[root@centos7 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
### --- 重启操作系统
reboot
### --- 查看配置文件已经生效,网卡名更改成功
[root@localhost ~]# ip addr
2: eth0:
3: eth1:
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor
分类:
cdv007-network
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通