https://rancher.com/ logo
b

blue-jelly-47972

12/09/2022, 1:08 AM
Hello all! Has anyone had success using Network Configuration Profiles with vCenter 7? I've setup a network profile using David's instructions here: https://www.virtualthoughts.co.uk/2020/03/29/rancher-vsphere-network-protocol-profiles-and-static-ip-addresses-for-k8s-nodes/ Rancher (2.7 & 2.6.9) deploys the VM, but at power on, errors. Out of IP addresses on network x
a

agreeable-oil-87482

12/10/2022, 6:06 PM
Obvious question - are you out of assigned ips in that pool? What is shown when you hover your mouse over the red exclamation point?
b

blue-jelly-47972

12/10/2022, 9:28 PM
Yes, this is a fresh setup...no IPs have been allocated yet. I have a case open with VMware to hopefully figure out what the issue is. Getting a similar issue in vCenter deploying a VM directly in vCenter and enabling vApp Options to use the pool. There are ips in the pool, but vCenter does not "see" them.
s

steep-furniture-72588

12/11/2022, 8:30 AM
@blue-jelly-47972 Another question, what does your ip address assignment look like in the network profile? Not looking at the numbers but more the syntax at the end.
b

blue-jelly-47972

12/11/2022, 9:26 PM
Not sure what you mean by "syntax at the end", but here's the Profile
Template Config
Copy code
write_files:
  - path: /tmp/configure-network.sh
    content: |
        #!/bin/bash
        vmtoolsd --cmd 'info-get guestinfo.ovfEnv' > /tmp/ovfenv
        IPAddress=$(sed -n 's/.*Property oe:key="guestinfo.interface.0.ip.0.address" oe:value="\([^"]*\).*/\1/p' /tmp/ovfenv)
        SubnetMask=$(sed -n 's/.*Property oe:key="guestinfo.interface.0.ip.0.netmask" oe:value="\([^"]*\).*/\1/p' /tmp/ovfenv)
        Gateway=$(sed -n 's/.*Property oe:key="guestinfo.interface.0.route.0.gateway" oe:value="\([^"]*\).*/\1/p' /tmp/ovfenv)
        DNS=$(sed -n 's/.*Property oe:key="guestinfo.dns.servers" oe:value="\([^"]*\).*/\1/p' /tmp/ovfenv)

        echo 'Creating network config'
        cat > /etc/sysconfig/network-scripts/ifcfg-eth0 <<EOF
        # Generated by Cloud-init for Rancher
        NAME=eth0
        GATEWAY=$Gateway
        DNS1=$DNS
        DOMAIN="domain.com"
        DEVICE=eth0
        ONBOOT=yes
        USERCTL=no
        BOOTPROTO=static
        NETMASK=$SubnetMask
        IPADDR=$IPAddress
        PEERDNS=no

        check_link_down() {
         return 1;
        }
        EOF
        
        cat > /etc/sysconfig/network-scripts/route-eth0 <<EOF
        # Generated by Cloud-init for Rancher
        10.7.8.0/21 via 10.7.15.254 dev eth0
        EOF

        echo 'Reload network config'
        sudo systemctl restart NetworkManager
        sudo hostnamectl set-hostname $IPAddress2
runcmd:
  - bash /tmp/configure-network.sh
s

steep-furniture-72588

12/11/2022, 9:42 PM
Ip address looks wrong
In the vapp
b

blue-jelly-47972

12/11/2022, 9:43 PM
ah yeah, I see that -- should be the portgroup name. I was testing by network profile name vs the portgroup name
same thing
s

steep-furniture-72588

12/11/2022, 9:44 PM
No the formatting is wrong
Where are the braces
b

blue-jelly-47972

12/11/2022, 9:44 PM
${netmask:rck3237trunk}
s

steep-furniture-72588

12/11/2022, 9:44 PM
The ip address one
b

blue-jelly-47972

12/11/2022, 9:45 PM
David's blog doesnt show curly brackets in the IP value
a

agreeable-oil-87482

12/11/2022, 9:46 PM
For the IP address it's not required
👍 1
s

steep-furniture-72588

12/11/2022, 9:49 PM
i have used this and it works for me: ${autoIp:internal} internal here is the network name. works for me, so up to you @blue-jelly-47972. just sharing what i did
b

blue-jelly-47972

12/11/2022, 9:50 PM
i will give that a shot!
Much appreciated! 🙂
same thing unfortunately....
s

steep-furniture-72588

12/11/2022, 10:08 PM
Ip range is different from subnet?
b

blue-jelly-47972

12/11/2022, 10:09 PM
ip range is a /21 so 10.7.8.0-10.7.15.254
s

steep-furniture-72588

12/11/2022, 10:17 PM
Ok. Sounds like a vmware thing. Let's see what they come back with. What version of vcentre and esxi do you have
b

blue-jelly-47972

12/11/2022, 10:17 PM
7.0.3 -- mix of f and g on the hosts.
thank you for your input... really do appreciate your time! 🙂
s

steep-furniture-72588

12/11/2022, 10:19 PM
Interesting. At work and home I have vcentre 7 and 6.5 esxi and they both work.
If it was me for troubleshooting purposes I would try with 24, instead of 21 and the ip address pools on the same range as the subnet mask
If that works Then troubleshoot from there as a base. Because for me I know that this approach works. I have implemented it on two sites
7 Views