vmware / photon

Minimal Linux container host
https://vmware.github.io/photon
Other
3.06k stars 697 forks source link

How to set static networking settings at deploy time? #664

Closed ipetkov7 closed 6 years ago

ipetkov7 commented 7 years ago

What is the best approach to have the networking settings of a Photon machine being set on deploy time (OVF on vSphere)? What we need is static IP and hostname. The best option is to be able to do this with cloud-config.

jtauke commented 7 years ago

I've also been wondering this as well. My initial thought was to just run a bash script using the Invoke-VMScript powercli command.

However, it appears that invoke-vmscript is broken with Photon. After running the following:

Invoke-VMScript -ScriptText 'ifconfig' -VM $PhotonVM -GuestUser $PhotonUser -GuestPassword $PhotonPassword

All I get are repeated guest authentication errors and the following produced in /var/log/vmware-vmsvc.log:

[Jul 29 18:37:15.154] [ message] [vix] VixTools_ProcessVixCommand: command 181
[Jul 29 18:37:17.235] [ warning] [VCGA] PAM error: Authentication failure (7)
[Jul 29 18:37:17.238] [ warning] [vix] VixToolsImpersonateUser: impersonation failed (3050)
[Jul 29 18:37:17.238] [ message] [vix] VixToolsCreateTempFile: opcode 181 returning 3050

As well as this output in Powershell:

Invoke-VMScript : 7/29/2017 1:53:10 PM  Invoke-VMScript         Failed to authenticate with the guest operating system using the supplied credentials.
At line:1 char:1
+ Invoke-VMScript -ScriptText 'ifconfig' -VM $PhotonVM -GuestUser $Phot ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-VMScript], InvalidGuestLogin
    + FullyQualifiedErrorId : Client20_VmGuestServiceImpl_RunScriptInGuest_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript
CollinChaffin commented 7 years ago

I agree this is absolutely absurd. I have seen the docs and well aware of how to do it.....but the mere ~20 steps required to edit big config file blocks, etc. in 2017 sure seems light years behind the 1-3 steps and < 30 seconds required friggin ~30 yrs ago. Is there really a reason that in 2017 a simple setup script doesn't exist with the distro? Knowing the ~20 steps does not mean it's appropriate to expect that admins take the 10+ minutes on a new build just to set a static ip address - I don't even think another distro of linux exists that requires as much work for initial build basic setup.

casualjim commented 7 years ago

every single linux distro requires this much work if you don't make use of cloud-init to configure it.

Outrage is pretty disrespectful to the people who are working on these projects that are made available to you free of charge. It's sad you're having trouble but instead of outrage, perhaps describe what you'd like to see as a solution.

what's so hard about doing:

mkdir -p /etc/systemd/network
echo '[Match]
Name=eth0

[Network]
DHCP=no
Address=192.168.112.3/24
` > /etc/systemd/network/10-static.network
chmod 644 /etc/systemd/network/10-static.network
systemctl restart systemd-networkd
dthaluru commented 6 years ago

Please use cloud-init.