Azure:使用 iproute2 命令更改接口地址
Azure: Change interface addresses with iproute2 command
我想创建一个虚拟专用网络,我可以在其中管理虚拟机与 iproute2 的接口。
比如我用AZ CLI在172.16.1.0/24子网创建了两台虚拟机,每台机器有一个接口:
az network vnet create -g test -n net --address-prefix 172.16.0.0/16 --ddos-protection false --vm-protection false
az network vnet subnet create -g test --vnet-name net -n subnet1 --address-prefixes 172.16.1.0/24 --network-security-group test
az network nic create -g test -n vm1-nic --vnet-name net --subnet subnet1 --private-ip-address 172.16.1.10 --public-ip-address vm1-pub
az network nic create -g test -n vm2-nic --vnet-name net --subnet subnet1 --private-ip-address 172.16.1.11 --public-ip-address vm2-pub
az vm create -g test -n vm1 --image rhel --size Standard_F4 --generate-ssh-keys --nics vm1-nic
az vm create -g test -n vm2 --image rhel --size Standard_F4 --generate-ssh-keys --nics vm2-nic
然后我用 ssh 连接 vm1,ping 172.16.1.11 应该可以。
是否可以使用 iproute2 命令更改 vm 的网络接口 ip 地址?就像我使用 iprout2 命令将 10.100.0.1/24 放在 vm1 的接口上,将 10.100.0.2/24 放在 vm2 的接口上,然后我从 10.100.0.1.
ping 到 10.100.0.2
我想了解虚拟机是如何连接的,连接模拟为有线连接,我们可以配置网络接口吗?
查看静态IP地址的说明here:
If you manually set the private IP address within the operating
system, make sure it matches the private IP address assigned to the
Azure network interface. Otherwise, you can lose connectivity to the
VM.
也就是说,如果要更改虚拟机内的IP地址,首先需要在Azure中更改虚拟机网卡的配置,然后才能使用命令更改虚拟机内的IP地址。如果不是,则无法更改。一般VM的所有东西都是Azure配置的。
我想创建一个虚拟专用网络,我可以在其中管理虚拟机与 iproute2 的接口。
比如我用AZ CLI在172.16.1.0/24子网创建了两台虚拟机,每台机器有一个接口:
az network vnet create -g test -n net --address-prefix 172.16.0.0/16 --ddos-protection false --vm-protection false
az network vnet subnet create -g test --vnet-name net -n subnet1 --address-prefixes 172.16.1.0/24 --network-security-group test
az network nic create -g test -n vm1-nic --vnet-name net --subnet subnet1 --private-ip-address 172.16.1.10 --public-ip-address vm1-pub
az network nic create -g test -n vm2-nic --vnet-name net --subnet subnet1 --private-ip-address 172.16.1.11 --public-ip-address vm2-pub
az vm create -g test -n vm1 --image rhel --size Standard_F4 --generate-ssh-keys --nics vm1-nic
az vm create -g test -n vm2 --image rhel --size Standard_F4 --generate-ssh-keys --nics vm2-nic
然后我用 ssh 连接 vm1,ping 172.16.1.11 应该可以。
是否可以使用 iproute2 命令更改 vm 的网络接口 ip 地址?就像我使用 iprout2 命令将 10.100.0.1/24 放在 vm1 的接口上,将 10.100.0.2/24 放在 vm2 的接口上,然后我从 10.100.0.1.
ping 到 10.100.0.2我想了解虚拟机是如何连接的,连接模拟为有线连接,我们可以配置网络接口吗?
查看静态IP地址的说明here:
If you manually set the private IP address within the operating system, make sure it matches the private IP address assigned to the Azure network interface. Otherwise, you can lose connectivity to the VM.
也就是说,如果要更改虚拟机内的IP地址,首先需要在Azure中更改虚拟机网卡的配置,然后才能使用命令更改虚拟机内的IP地址。如果不是,则无法更改。一般VM的所有东西都是Azure配置的。