Networking

Learn how networking works in Noid microVMs and how to configure network access.

Overview

Each Noid VM gets its own network interface and IP address, allowing isolated network access while maintaining connectivity to the host and other VMs.

IP Address Assignment

When a VM is created, it automatically receives an IP address:

noid list
# Output shows VM with assigned IP

Key Points:

  • IP addresses are assigned automatically via DHCP
  • Each VM gets a unique IP in the private network range
  • IPs may change after VM restarts or checkpoint restores
  • Use DNS or service discovery instead of hardcoded IPs

Accessing VMs from Host

You can access services running in VMs from your host machine:

# Start a web server in the VM
noid exec my-vm -- python3 -m http.server 8080

# Access from host using the VM's IP
curl http://<vm-ip>:8080

VM to VM Communication

VMs can communicate with each other using their assigned IP addresses:

# From VM 1, ping VM 2
noid exec vm-1 -- ping <vm-2-ip>

# Make HTTP request from VM 1 to VM 2
noid exec vm-1 -- curl http://<vm-2-ip>:3000

Port Forwarding

Forward ports from host to VM for external access:

# Forward host port 8080 to VM port 80
noid create my-vm --port 8080:80

# Access VM's port 80 via localhost:8080
curl http://localhost:8080

Multiple Port Mappings:

noid create my-vm \
  --port 8080:80 \
  --port 5432:5432 \
  --port 6379:6379

DNS Resolution

VMs have DNS resolution configured automatically:

# Test DNS resolution
noid exec my-vm -- nslookup google.com
noid exec my-vm -- dig example.com

Firewall Rules

By default, VMs have unrestricted outbound access and can accept inbound connections from the host network.

Configure VM firewall:

# Install iptables in VM
noid exec my-vm -- apt-get install -y iptables

# Allow only HTTP/HTTPS
noid exec my-vm -- iptables -A INPUT -p tcp --dport 80 -j ACCEPT
noid exec my-vm -- iptables -A INPUT -p tcp --dport 443 -j ACCEPT
noid exec my-vm -- iptables -A INPUT -j DROP

Network Isolation

VMs are isolated by default but can communicate within the same network namespace:

# Create isolated network namespace
noid create vm-1 --network isolated

# VMs in different namespaces cannot communicate
noid create vm-2 --network isolated

Static IP Assignment

For production deployments, you can assign static IPs:

# Assign static IP to VM
noid create my-vm --ip 192.168.100.10

Troubleshooting

VM Cannot Access Internet

# Check VM's network interface
noid exec my-vm -- ip addr show

# Test connectivity
noid exec my-vm -- ping 8.8.8.8

# Check DNS
noid exec my-vm -- cat /etc/resolv.conf

Cannot Connect to VM Service

# Verify service is running
noid exec my-vm -- netstat -tlnp

# Check VM firewall
noid exec my-vm -- iptables -L

# Verify VM IP address
noid list

Network Performance Issues

# Test network throughput
noid exec my-vm -- apt-get install -y iperf3
noid exec vm-1 -- iperf3 -s
noid exec vm-2 -- iperf3 -c <vm-1-ip>

Network Configuration Files

Key network configuration files in the VM:

FilePurpose
/etc/network/interfacesNetwork interface configuration
/etc/resolv.confDNS resolver configuration
/etc/hostsStatic hostname mappings
/etc/hostnameVM hostname

Best Practices

  1. Use DNS names instead of hardcoded IP addresses
  2. Implement health checks for services running in VMs
  3. Configure firewalls to restrict unnecessary access
  4. Monitor network usage to detect anomalies
  5. Use load balancers for production deployments

Advanced Topics

Service Mesh Integration

Integrate VMs with service mesh solutions like Istio or Linkerd for advanced networking features.

VPN Access

Configure VPN access for secure remote connectivity to VMs.

Network Policies

Implement network policies to control traffic flow between VMs.


Next Steps