在VirtualBox中为虚拟机设置静态IP地址,可以按照以下步骤进行操作:
/etc/sysconfig/network-scripts/ifcfg-eth0
或 /etc/sysconfig/network-scripts/ifcfg-enp0s3
。BOOTPROTO
设置为 static
。IPADDR=192.168.233.102
NETMASK=255.255.255.0
GATEWAY=192.168.233.1
DNS1=8.8.8.8
ONBOOT=yes
systemctl restart network
或 service network restart
。ping 192.168.233.102
,确认可以ping通。以上步骤适用于大多数Linux发行版,例如CentOS、Ubuntu等。对于Windows系统,配置文件路径和命令可能会有所不同。