1.VMware里面设置网络为桥接模式
2.Ubuntu里面检查网卡名称
[~] ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:62:df:8f brd ff:ff:ff:ff:ff:ff
altname enp2s1
inet 192.168.122.128/24 metric 100 brd 192.168.122.255 scope global dynamic ens33
valid_lft 1691sec preferred_lft 1691sec
inet6 fe80::20c:29ff:fe62:df8f/64 scope link
valid_lft forever preferred_lft forever
网关:192.168.122.255
3.编辑Ubuntu24的网络配置文件,路径:/etc/netplan/
[/] cd /etc/netplan/
[netplan] ls
50-cloud-init.yaml
[netplan] vim 50-cloud-init.yaml
[netplan] sudo su
[sudo] password for planz:
zooz# vim /etc/netplan/50-cloud-init.yaml
切换到root用户,编辑网络配置文件
[~] sudo su
[sudo] password for planz:
zooz# vim /etc/netplan/50-cloud-init.yaml
4.编辑完成保存文件后,执行重启网络
zooz# sudo netplan apply
至此测试新的地址是否能连通即可...