一、vbox网络设置
1、设置vbox网卡为手动配置
2、DHCP服务器禁用
二、设置AlmaLinux网络为桥接网络
1、选中AlmaLinux,点击设置,进入网络
2、默认网卡1,连接方式选择桥接网卡,名称选择宿主机安装的网卡名称
三、进入AlmaLinux,进行固定ip的设置
1、在 AlmaLinux 9 中,密钥文件的新默认存储位置在 /etc/NetworkManager/system-connections 中
cd /etc/NetworkManager/system-connections
2、默认dhcp配置
[connection]
id=enp0s3
uuid=77c1e2f2-fe9d-3b54-a1cc-ea306b4261e4
type=ethernet
autoconnect-priority=-999
interface-name=enp0s3
timestamp=1725853338
[ethernet]
[ipv4]
method=auto
[ipv6]
addr-gen-mode=eui64
method=auto
[proxy]
3、修改配置,网关地址和dns地址都是宿主机的,可以通过ipconfig /all 进行查询
[connection]
id=enp0s3
uuid=77c1e2f2-fe9d-3b54-a1cc-ea306b4261e4
type=ethernet
autoconnect-priority=-999
interface-name=enp0s3
timestamp=1725853338
[ethernet]
[ipv4]
#手动设置
method=manual
#IP/网关地址
address1=192.168.1.118/192.168.1.1
# DNS服务器
dns=192.168.1.1
[ipv6]
addr-gen-mode=eui64
method=auto
[proxy]
四、重新加载配置文件,注意网卡id是id=enp0s3,所以加载enp0s3
nmcli connection reload enp0s3.nmconnection
nmcli connection up enp0s3
此时内外网都可以连通了: