当前位置:网站首页>VirtualBox如何修改“网络地址转换(NAT)”网络模式下分配给虚拟机的IP网段
VirtualBox如何修改“网络地址转换(NAT)”网络模式下分配给虚拟机的IP网段
2022-04-23 06:01:00 【洒满阳光的午后】
在NAT模式下,给虚拟机分配的IP地址默认为 10.0.x.0/24。其中 x 为网卡号+1,例如第1块网卡启用了NAT模式,则默认分配给虚拟机的IP地址为 10.0.2.15,网关为 10.0.2.2。
如果需要修改默认网段,可以使用如下命令:
cd "C:\Program Files\Oracle\VirtualBox"
.\VBoxManage.exe list vms
"k8s-master" {bdd664c6-4292-4c05-89ff-c09219bf0bfa}
"k8s-worker1" {6e83cf63-597b-4c03-8836-11311deb04ac}
"k8s-worker2" {8b2e1124-84fc-47a6-8466-e6adc57bf82e}
"k8s-worker3" {b2fd6bc9-01c0-4873-bd87-ca9183de6edd}
#修改k8s-worker3第一块网卡的NAT子网段
.\VBoxManage modifyvm "k8s-worker3" --natnet1 "172.0.0.0/24"
#修改k8s-worker3第二块网卡的NAT子网段,以此类推
.\VBoxManage modifyvm "k8s-worker3" --natnet2 "172.0.0.0/24"
修改完成后重启虚拟机,可以看到网卡地址已经变为我们定义的网段:
enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.0.0.15 netmask 255.255.255.0 broadcast 172.0.0.255
inet6 fe80::8758:99e2:303e:7f4 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:af:ed:37 txqueuelen 1000 (Ethernet)
RX packets 130 bytes 13622 (13.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 162 bytes 20843 (20.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
如果需要重置为默认值,则再次指定网段为default即可:
.\VBoxManage modifyvm "k8s-worker3" --natnet1 default
.\VBoxManage modifyvm "k8s-worker3" --natnet2 default
版权声明
本文为[洒满阳光的午后]所创,转载请带上原文链接,感谢
https://zhangrongjie.blog.csdn.net/article/details/120194078
边栏推荐
猜你喜欢

【OSS文件上传快速入门】

MySQL【sql性能分析+sql调优】

Decentralized Collaborative Learning Framework for Next POI Recommendation

JS implementation of web page rotation map

Installing redis using a small leather panel in the window environment

Prometheus Cortex多租户读写的实现

rdma 编程详解
![[Lombok quick start]](/img/30/92251e7e12ce6e1c3f1084caade4d3.png)
[Lombok quick start]

LeetCode刷题|13罗马数字转整数

JS performance optimization
随机推荐
tc ebpf 实践
PHP background parsing after JQ serialization
ovs与ovs+dpdk架构分析
The arithmetic square root of X in leetcode
virtio 与vhost_net介绍
redis 常见问题
Prometheus Thanos与Cortex组件比较
A website that directly downloads PNG icons without logging in
Tensorflow&&Pytorch常见报错
异常记录-22
TP5中的getField()方法变化,tp5获取单个字段值
异常记录-15
JS regular matching first assertion and last assertion
Passerelle haute performance pour l'interconnexion entre VPC et IDC basée sur dpdk
[MySQL basics] startup options, system variables and status variables
异常记录-11
TP5 uses redis
Binary sum of leetcode questions
【不积跬步无以至千里】Oracle应用导数Ora-01455报错处理
异常记录-10