redhat9运维变化

创建时间:2023-01-20 14:44:08
栏目:linux

网络配置

配置文件

原来的配置文件是ifcfg格式在/etc/sysconfig/network-scripts目录下。 新的配置文件是keyfile/etc/NetworkManager/system-connections目录下 配置示例

[connection]
id=enp0s3
uuid=633314bc-391f-39fc-893e-1241bfb80b5b
type=ethernet
autoconnect-priority=-999
interface-name=enp0s3
timestamp=1674095845

[ethernet]

[ipv4]
address1=192.168.137.201/24,192.168.137.1
dns=114.114.114.114
method=manual
[ipv6]
addr-gen-mode=eui64
method=auto

[proxy]

其中address1中 192.168.137.201/24表示ip为192.168.137.201,子网掩码为255.255.255.0即24,如果为255.0.0.0就是8 192.168.137.1为网关

重启网络

# 先关闭
nmcli n off
# 再开启
nmcli n on

n是network简称

允许/禁止ping

临时

# 禁止改为1
echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_all

永久

修改/etc/sysctl.conf在末尾加入

# 禁止改为1
net.ipv4.icmp_echo_ignore_all=0

然后执行

sysctl -p

联系我们

微信号:shidaping023