1、设置网卡IP地址、缺省路由、DNS解析服务器:
ip link set dev ens33 up
ip a add 192.168.1.38/24 dev ens33
ip r add 0.0.0.0/0 via 192.168.1.1
echo "nameserver 223.6.6.6" > /etc/resolv.conf
4、修改sshd端口:
vi /etc/ssh/sshd_config
systemctl restart sshd
5、永久设置网卡参数:
vi /etc/sysconfig/network-scripts/ifcfg-ens33
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.1.38
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=223.6.6.6
配置生效:
systemctl start NetworkManager 或
nmcli c reload
以下命令不行,显示“Failed to restart network.service: Unit network.service not found.”:
service network restart
/etc/init.d/network restart
systemctl restart network