一.服务器配置IP地址相关命令
-
关闭防火墙
# systemctl stop firewalld # systemctl disable firewalld #设置开机不启动
-
关闭 SELinux
//它是一个安全增强系统, 集成在内核中 (主要由美国国家安全局开发) selinux的三种工作模式: 1.enforcing: 强制模式, 违反SELinux规定的行为将被阻止 2.permissive: 宽容模式(警告), 违反规定只会被警告, 一般为调试用 3.disabled: 关闭SELinux 命令设置: 1.# setenforce 1 #设置强制模式 2.# setenforce 0 #设置警告模式 3.永久设置开机不启动: # vi /etc/sysconfig/selinux 输入a, i, o进入编辑模式 #修改: SELINUX=disabled 按下Esc 输入---> :wq 4.因为SELinux集成在内核, 所以需要重启计算机才能生效
ps: 单用户修改root密码的时候为什么要 “touch /.autorelabel” 这个命令
```
⛅为了让 SELinux 生效
⛅SELinux 它是一个安全增强系统, 其内部有许多安全策略
⛅针对一些操作, 如果你做了这些操作, 没有得到策略的放行, 它会给你禁止掉
⛅比如你使用单用修改root密码是不被策略放行的
⛅怎么让 SELinux 策略放行呢?
🔵"touch /.autorelabel" 创建这样一个文件其实就是在告诉SELinux放行这个策略,就是通知一下
🔵直接关闭掉 SELinux
```
-
临时配置IP :
# ifconfig (网卡名字:ens33) 192.168.13.44/24
-
修改网卡配置文件, 先关闭网络管理服务
# systemctl stop NetworkManager #关闭 # systemctl disable NetworkManager #设置开机不启动
-
永久配置
# vi/etc/sysconfig/network-script/ifcfg-ens33
-
修改完配置需要重新启动网卡
# systemctl restart network #重启 # systemctl stop network #关闭网络服务 # systemctl start network #启动网络服务
-
查看当前网络状态
# systemctl status network
-
查看网关地址
# route -n
-
查看DNS远程地址配置文件
# cat /etc/resolv.conf
-
启动网卡报错(Failed to start LSB: Bring up/down networking )