公共虚拟服务器的静态IP地址分配 [英] static ip address allocation for public virtual server

查看:72
本文介绍了公共虚拟服务器的静态IP地址分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Image image = new Image();
image.setCapacity(50L);

Guest guest = new Guest();
guest.setHostname("hostname1");
guest.setDomain("softlayer.com");
guest.setStartCpus(1l);
guest.setMaxMemory(1024l);
guest.setDatacenter(new Location());
guest.getDatacenter().setName("che01");

guest.setLocalDiskFlag(false);
guest.setHourlyBillingFlag(true);

guest.setOperatingSystemReferenceCode("UBUNTU_LATEST");

Component privateComponent = new Component();
Component publicComponent = new Component();

Vlan privateVlan = new Vlan();
privateVlan.setVlanNumber(1365L);
privateVlan.setId(2117919L);

Subnet privateSubnet = new Subnet();
privateSubnet.setId(1059121L);

privateComponent.setNetworkVlan(privateVlan);
privateComponent.setPrimarySubnet(privateSubnet);
guest.setPrimaryBackendNetworkComponent(privateComponent);

Vlan publicVlan = new Vlan();
publicVlan.setId(2117917L);
publicVlan.setVlanNumber(1290L);

Subnet primarySubnetVersion4 = new Subnet();
primarySubnetVersion4.setVersion(4L);
primarySubnetVersion4.setId(1547547L);
publicVlan.setPrimarySubnet(primarySubnetVersion4);

publicComponent.setNetworkVlan(publicVlan);
publicComponent.setPrimaryIpAddress("169.38.101.156");
guest.setPrimaryNetworkComponent(publicComponent);

Guest.service(client).createObject(guest);

如何在创建虚拟服务器时配置静态IP地址,而不是分配动态IP地址.我使用了上面的代码,但对我不起作用.请提出一种配置静态IP地址的最佳方法.

How to configure a static ip address while creating a virtual server instead of assigning the dynamic IP address. I used the above code but its not working for me. please suggest a best way to configure the static ip address.

推荐答案

不幸的是,您在创建VSI时将无法配置ip地址.设置过程会在子网中查找可用的IP地址并将其分配给VSI,该IP地址是静态的,因此每次打开/关闭VSI时都不会更改.

Unfortunately you won't be able to configure the ip address while creating the VSI. The provisioning process looks for an available ip address in the subnet an it is assigned to the VSI, this ip address is static so it will not change each time you turn on/off the VSI.

可以在文档中找到更多信息,例如,在我可以移动我的IP地址到另一个服务器吗?说:

More info can be find in the documentation, for example in can-i-move-my-ip-address-one-server-another? says:

每个客户将收到一个主要IP地址的初始路由块.主IP地址绑定到每个单独的服务器,除非将其取消并用现有VLAN上的新服务器替换,否则无法移动主IP地址.

Each customer will receive an initial routed block of one primary IP address. Primary IP addresses are bound to each individual server and cannot be moved unless the server is cancelled and replaced by a new server on the existing VLAN.

下面是一些您可以查看的有关子网和IP地址的链接.

Below are some links that you can review about subnets and ip addresses.

http://knowledgelayer .softlayer.com/faq/can-i-move-my-ip-address-one-server-another

http://knowledgelayer.softlayer .com/faq/how-are-server-ip-addresses-assigned-softlayer-network

http://knowledgelayer.softlayer.com /faq/can-i-pick-my-servers-private-ip

http://knowledgelayer.softlayer.com/learning/virtual-machine -network-setup

http://knowledgelayer.softlayer.com/learning/utilizing-subnets -and-ips

http://knowledgelayer.softlayer.com/faq /how-do-i-use-public-network

这篇关于公共虚拟服务器的静态IP地址分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆