Vmware + Vagrant 실패기

VMware 실패기: 온프레미스 환경에서의 IaC 도전과 좌절 😅

안녕하세요! 오늘은 베어메탈 환경에서 VMware와 Vagrant를 사용한 IaC(Infrastructure as Code) 경험에 대해 이야기해 볼까 합니다. 결론부터 말하자면… 생각보다 너무 힘들었어요. 🥲

클라우드가 아닌 온프레미스 환경에서의 IaC는 천국과 지옥 사이 📊

이번 물뮤(MoolMeow) 프로젝트를 위해 Mac Mini에 k3s 쿠버네티스 클러스터를 구축하려고 VMware와 Vagrant를 조합하여 사용했는데요. 생각보다 가상화 도구들과 IaC 도구 간의 호환성이 좋지 않다는 사실을 뼈저리게 느꼈습니다.

클라우드는 해당 직원들이 열심히 노력해서 이런 노력을 안해 도 된다는게.. 장점이겠죠.?… 온프레미스는 제가 직접 해야죠.. 😭

VMware와의 사투, 그리고 배움 🔄

VMware와 Vagrant 조합에서 겪은 문제들은 주로 네트워크 관련 이슈였습니다.

1. VMware의 독특한 네트워크 설정 방식 🌐

VMware는 MAC 주소를 통해 내부 IP 주소를 설정하는 방식을 사용합니다. 처음에는 이해하기 어려웠지만, 계속 건드리다 보니 감이 오기 시작했어요.

# VMware 고정 IP 설정 예시
v.vmx["ethernet1.present"] = "TRUE"
v.vmx["ethernet1.connectionType"] = "custom"
v.vmx["ethernet1.virtualDev"] = "vmxnet3"
v.vmx["ethernet1.addressType"] = "static"
v.vmx["ethernet1.address"] = "00:50:56:01:00:10"  # MAC 주소
v.vmx["ethernet1.subnetMask"] = "255.255.255.0"
v.vmx["ethernet1.vnet"] = "vmnet3"

여기서 ethernet1.address는 MAC 주소인데, 이게 나중에 DHCP 서버에 의해 IP 주소로 매핑됩니다.

게다가 vmxnet2와 vmxnet3 등 새로운 네트워크 인터페이스를 등록해도 Vmware 와 Vagrant 간 명확하게 일치하지 않는 문제가 생겨 상당히 애를 먹었습니다.

2. IP 충돌 문제 😱

설정했던 IP 주소(192.168.100.x)가 이미 제 host pc에서 사용 중이었습니다. 이런 상황이 발생했을 때 어떻게 해야 하는지 배웠습니다.

# 네트워크 정보 확인
netstat -rn

# 이미 사용 중인 네트워크 확인 결과
192.168.100        link#29            UC              bridge101      !

이런 상황에서는 다른 IP 대역(예: 192.168.200.x)을 사용하도록 모든 설정을 변경해야 했습니다.

3. 고정 IP가 유지되지 않는 문제 🔄

가장 답답했던 것은 설정을 완벽하게 마친 VM도 맥을 재부팅하면 Vagrant가 설정한 고정 IP가 아닌 임의의 IP를 부여한다는 점이었습니다.

➜ vagrant ssh-config
Host k8s-master
  HostName 100.10.10.128  # 원래는 192.168.200.10이어야 했음

이런 일이 발생하면 SSH 접속이 안 되고, 클러스터가 제대로 작동하지 않게 됩니다. 😫

ssh: connect to host 192.168.200.10 port 22: No route to host

VMware 네트워크 설정의 이해 🧠

VMware 네트워크 설정을 이해하기 위해 많은 시간을 투자했습니다. 특히 networking 파일을 직접 수정하는 방법을 배웠습니다.

# VMware 네트워킹 파일 예시
answer VNET_3_DHCP yes
answer VNET_3_DHCP_CFG_HASH 11C111FE2DFAE11111D1BC11DC1111167F1587C4
answer VNET_3_HOSTONLY_NETMASK 255.255.255.0
answer VNET_3_HOSTONLY_SUBNET 192.168.200.0
answer VNET_3_HOSTONLY_UUID A01111AA-A1A1-1111-A111-1A1A11AC1A11
answer VNET_3_VIRTUAL_ADAPTER yes

그리고 네트워크 서비스를 재시작하는 방법도 익혔습니다.

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --start

결국 VirtualBox로 전환 🔄

Claude AI 가 그렇게 VirtualBox로 바꾸라고 10번은 말했던 것 같은데, 제가 계속 무시했던 게 문제였습니다. 결국 이틀간의 고통 끝에 VMware를 포기하고 VirtualBox로 넘어가기로 결정했습니다.

VirtualBox는 네트워크 설정이 더 직관적이고, 훨씬 안정적으로 동작합니다:

# VirtualBox에서의 네트워크 설정 - 훨씬 간단합니다!
master.vm.network "private_network", ip: "192.168.56.10", netmask: "255.255.255.0"

물론 VirtualBox에서도 Guest Additions 설치 실패 같은 문제가 있었지만, 적어도 IP 주소 문제는 없었습니다.

이번 경험을 통해 배운 점 🧐

VMware와의 사투는 힘들었지만, 덕분에 네트워크에 대한 이해도가 크게 향상되었습니다:

  1. 가상 네트워크의 이해: vmnet, vboxnet 등 가상 네트워크 인터페이스의 작동 방식
  2. DHCP 서버 구성: 고정 IP를 할당하기 위한 DHCP 서버 설정 방법
  3. 네트워크 문제 해결: IP 충돌, 라우팅 문제 등을 진단하고 해결하는 방법
  4. MAC 주소와 IP 주소의 관계: 네트워크에서 MAC 주소와 IP 주소가 어떻게 매핑되는지

이번 경험을 통해 “네트워크는 기본을 모르면 참 힘든 영역”이라는 사실을 다시 한번 깨닫게 되었습니다.

결론: IaC는 좋지만 호환성이 관건 🎯

IaC(Infrastructure as Code)는 분명 좋은 개념이지만, 온프레미스 환경에서는 호환성 문제로 인해 생각보다 많은 어려움이 있습니다. 특히 VMware와 Vagrant의 조합은 네트워크 구성에서 예측 불가능한 행동을 보일 수 있습니다.

다음에 비슷한 프로젝트를 진행한다면, 아마도:

  1. VirtualBox + Vagrant
  2. 직접 VM 수동 설정

이런 옵션을 더 진지하게 고려할 것 같습니다.

여러분도 온프레미스 환경에서 IaC를 도입할 때는 호환성 문제를 미리 테스트해보고 시작하는 것을 추천합니다! 😊

또한 실제 Dev Ops 업무를 하시는 분들은 이런 방향성의 문제가 생겼을 경우. 어떻게 의사결정을 진행하는지 매우 궁금하네요.

어느정도의 테스트를 거쳐서 호환성을 판별해서 다른 것으로 넘어가는 지, 누가 무엇을 근거로 결정하는 지 등 시간이 오래 걸린 것 같아 드는 생각이었습니다. 

그럼 다음 글에서는 VirtualBox로 성공적으로 구축한 k3s 클러스터 이야기로 찾아오겠습니다. 관심 있으신 분들은 계속 지켜봐 주세요! 👋

VMware Failure Story: IaC Challenges in On-Premises Environments 😅

Hello everyone! Today I want to share my experience with using VMware and Vagrant for Infrastructure as Code (IaC) in a bare metal environment. Spoiler alert: it was much harder than expected! 🥲

IaC in On-Premises vs. Cloud: Heaven and Hell 📊

For my MoolMeow project, I tried to set up a k3s Kubernetes cluster on a Mac Mini using VMware and Vagrant. What I quickly discovered was that the compatibility between virtualization tools and IaC tools isn’t nearly as seamless as I had hoped.

Everything seems to work fine in the cloud… why is on-premises so difficult? 😭

My Battle with VMware and What I Learned 🔄

The issues I faced with the VMware and Vagrant combination were primarily network-related.

1. VMware’s Unique Network Configuration Approach 🌐

VMware uses MAC addresses to configure internal IP addresses. This was confusing at first, but I started to understand it after spending hours troubleshooting.

# VMware static IP configuration example
v.vmx["ethernet1.present"] = "TRUE"
v.vmx["ethernet1.connectionType"] = "custom"
v.vmx["ethernet1.virtualDev"] = "vmxnet3"
v.vmx["ethernet1.addressType"] = "static"
v.vmx["ethernet1.address"] = "00:50:56:01:00:10"  # MAC address
v.vmx["ethernet1.subnetMask"] = "255.255.255.0"
v.vmx["ethernet1.vnet"] = "vmnet3"

Here, ethernet1.address is a MAC address, which later gets mapped to an IP address by the DHCP server. This approach was very confusing initially.

2. IP Address Conflict Issues 😱

The IP range I configured (192.168.100.x) was already in use on my MacBook. I learned how to handle such situations through this experience.

# Checking network information
netstat -rn

# Result showing the network already in use
192.168.100        link#29            UC              bridge101      !

In such situations, I had to change all configurations to use a different IP range (e.g., 192.168.200.x).

3. Static IP Not Persisting 🔄

The most frustrating issue was that even with perfect VM configurations, after rebooting my Mac, Vagrant would assign random IPs instead of the static IPs I had configured.

➜ vagrant ssh-config
Host k8s-master
  HostName 111.11.11.111  # Should have been 192.168.200.10

When this happens, SSH connections fail and the cluster doesn’t work properly. 😫

ssh: connect to host 192.168.200.10 port 22: No route to host

Understanding VMware Network Configuration 🧠

I invested significant time understanding VMware network configuration, especially learning how to modify the networking file directly.

# VMware networking file example
answer VNET_3_DHCP yes
answer VNET_3_DHCP_CFG_HASH 111111111111111111111111111111111111111
answer VNET_3_HOSTONLY_NETMASK 255.255.255.0
answer VNET_3_HOSTONLY_SUBNET 192.168.200.0
answer VNET_3_HOSTONLY_UUID A111111-1111-1111-1111-111111111111
answer VNET_3_VIRTUAL_ADAPTER yes

I also learned how to restart network services:

sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop
sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --start

Eventually Switching to VirtualBox 🔄

Claude had suggested switching to VirtualBox about 10 times, but I kept ignoring the advice. After two days of struggle, I finally decided to abandon VMware and switch to VirtualBox.

VirtualBox has more intuitive network configuration and works much more reliably:

# Network configuration in VirtualBox - much simpler!
master.vm.network "private_network", ip: "192.168.56.10", netmask: "255.255.255.0"

Although VirtualBox had its own issues like Guest Additions installation failures, at least the IP address problems were nonexistent.

Lessons Learned from This Experience 🧐

Despite the struggles with VMware, my understanding of networking improved significantly:

  1. Understanding Virtual Networks: How virtual network interfaces like vmnet and vboxnet work
  2. DHCP Server Configuration: How to configure DHCP servers for static IP allocation
  3. Network Troubleshooting: How to diagnose and resolve IP conflicts and routing issues
  4. MAC and IP Address Relationship: How MAC addresses and IP addresses are mapped in networks

This experience reinforced the fact that “networking is a difficult domain if you don’t understand the basics.”

Conclusion: IaC is Great but Compatibility is Key 🎯

Infrastructure as Code is certainly a valuable concept, but in on-premises environments, compatibility issues can create significant challenges. The VMware and Vagrant combination, in particular, can exhibit unpredictable behavior in network configuration.

For future similar projects, I would more seriously consider:

  1. VirtualBox + Vagrant
  2. Manual VM configuration

If you’re planning to implement IaC in an on-premises environment, I recommend testing compatibility issues beforehand!

In my next post, I’ll share how I successfully built a k3s cluster using VirtualBox. Stay tuned for more updates! 👋

답글 남기기