四月十日笔记 关闭防火墙 网卡自启

1、查看windows的ip地址
快捷键 win+R
输入cmd,然后敲回车键
输入ipconfig查看本机的ip地址
2、网卡启动/关闭命令
启动网卡:ifup ens33
关闭网卡:ifdown ens33
查看IP地址:ip a
3、远程连接工具的使用
WindTerm、Xshell、FinaShell
4、时间管理

查看当前服务器时间

[root@localhost ~]# date
[root@localhost ~]# date -R

修改系统时间

[root@localhost ~]# date -s ‘2023-12-12 23:10:12’
Tue Dec 12 23:10:12 CST 2023

查看硬件时间

[root@localhost ~]# hwclock -r

修改硬件时间

[root@localhost ~]# hwclock --set --date ‘2022-11-11 11:11:11’
[root@localhost ~]# hwclock -r
Fri 11 Nov 2022 11:11:15 AM CST  -0.628665 seconds

判断服务器是否能连接网络

[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (110.242.68.3) 56(84) bytes of data.
64 bytes from www.baidu.com (110.242.68.3): icmp_seq=1 ttl=54 time=21.2 ms
64 bytes from www.baidu.com (110.242.68.3): icmp_seq=2 ttl=54 time=21.4 ms
64 bytes from www.baidu.com (110.242.68.3): icmp_seq=3 ttl=54 time=21.3 ms
64 bytes from www.baidu.com (110.242.68.3): icmp_seq=4 ttl=54 time=21.1 ms
— www.a.shifen.com ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3028ms
rtt min/avg/max/mdev = 21.119/21.288/21.419/0.209 ms

安装ntpdate服务

[root@localhost ~]# yum install ntpdate

时间同步

[root@localhost ~]# ntpdate ntp.aliyun.com

将系统时间同步至硬件时间

[root@localhost ~]# hwclock --systohc

将硬件时间同步至系统时间

[root@localhost ~]# hwclock --hctosys

将硬件时间写入到主办中

[root@localhost ~]# hwclock -w

国内网络时间服务器 域名
阿里云 ntp.aliyun.com
微软

time.windows.com
中国国家授时中心 ntp.ntsc.ac.cn
5、快捷键
作用 快捷键
清屏 CTRL + L / clear
终止任何命令 CTRL + C

6、网卡开机自启动
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33 
ONBOOT=“no” ==> ONBOOT=“yes”

重启网卡

[root@localhost ~]# systemctl restart network
7、关闭防火墙

查看防火墙状态

[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since Wed 2024-03-13 16:01:44 CST; 1s ago
     Docs: man:firewalld(1)
 Main PID: 15430 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─15430 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid
Mar 13 16:01:43 bogon systemd[1]: Starting firewalld - dynamic firewall daemon…
Mar 13 16:01:44 bogon systemd[1]: Started firewalld - dynamic firewall daemon.
Mar 13 16:01:44 bogon firewalld[15430]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be …g it now.
Hint: Some lines were ellipsized, use -l to show in full.

关闭系统防火墙

[root@localhost ~]# systemctl stop firewalld

再次查看防火墙状态

[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
Oct 17 20:02:19 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon…
Oct 17 20:02:24 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Oct 17 20:02:24 localhost.localdomain firewalld[838]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option… it now.
Oct 17 20:04:38 bogon systemd[1]: Stopping firewalld - dynamic firewall daemon…
Oct 17 20:04:43 bogon systemd[1]: Stopped firewalld - dynamic firewall daemon.
Mar 13 16:01:43 bogon systemd[1]: Starting firewalld - dynamic firewall daemon…
Mar 13 16:01:44 bogon systemd[1]: Started firewalld - dynamic firewall daemon.
Mar 13 16:01:44 bogon firewalld[15430]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be …g it now.
Mar 13 16:02:38 bogon systemd[1]: Stopping firewalld - dynamic firewall daemon…
Mar 13 16:02:42 bogon systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.

重启服务器

[root@localhost ~]# reboot

查看防火墙状态

[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: active (running) since Wed 2024-03-13 16:01:44 CST; 1s ago
     Docs: man:firewalld(1)
 Main PID: 15430 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─15430 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid
Mar 13 16:01:43 bogon systemd[1]: Starting firewalld - dynamic firewall daemon…
Mar 13 16:01:44 bogon systemd[1]: Started firewalld - dynamic firewall daemon.
Mar 13 16:01:44 bogon firewalld[15430]: WARNING: AllowZoneDrifting is enabled. This is considered an insecure configuration option. It will be …g it now.
Hint: Some lines were ellipsized, use -l to show in full.

关闭防火墙的开机自启

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
8、关闭Selinux
SElinux,管理文件上下文
安全增强型 Linux(Security-Enhanced Linux)简称 SELinux,它是一个 Linux 内核模块,也是 Linux 的一个安全子系统。
SELinux 主要由美国国家安全局开发。2.6 及以上版本的 Linux 内核都已经集成了 SELinux 模块。

查看SELinux状态

[root@localhost ~]# getenforce 
Enforcing

临时关闭SELinux

[root@localhost ~]# setenforce 0

查看SELinux状态

[root@localhost ~]# getenforce 
Permissive

永久关闭SELinux

[root@localhost ~]# vi /etc/selinux/config
……

enforcing - SELinux security policy is enforced.  # 在 Enforcing 模式中, SELinux 被启动,并强制执行所有的安全策略规则。

permissive - SELinux prints warnings instead of enforcing.  # 在 Permissive 模式中,SELinux 被启用,但安全策略规则并没有被强制执行。

disabled - No SELinux policy is loaded. # 在 Disable 模式中,SELinux 被关闭,默认的 DAC 访问控制方式被使用。

SELINUX=enforcing
……
修改为
SELINUX=disabled

永久关闭SElinux只有重启服务器才会生效,所以在不重启服务器的情况下,我们修改完配置文件之后还需要执行"setenforce 0",先临时关闭Selinux

重启服务器

[root@localhost ~]# reboot

查看SELinux状态

[root@localhost ~]# getenforce 
Disabled

  • 13
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值