04 January 2026
vagrant
virtualization
linux
sles
devops
Vagrant: Bridged Networking with Password SSH (No NAT)
Quick one-liner: Replace Vagrant's default NAT networking with bridged networking and enable standard SSH with password auth — so your VMs behave like real servers.
🤔 Why This Matters
By default, Vagrant creates VMs behind NAT with port forwarding and key-based SSH. That's fine for quick testing, but if you need VMs to communicate with each other directly, or you want to SSH in with a standard username and password, the defaults get in the way.
This setup bridges the VMs to your physical network, gives them real IP addresses, and enables password-based SSH so you can connect with any SSH client — not just vagrant ssh.
🔧 The Vagrantfile
Create a directory for your VM:
mkdir node01 && cd node01
Create a Vagrantfile:
Vagrant.configure("2") do |config|
# Use openSUSE Leap 15
config.vm.box = "opensuse/openSUSE-15.0-x86_64"
# Hostname and bridged IP
config.vm.hostname = "node01"
config.vm.network "public_network", bridge: "eth0", ip: "192.168.100.51"
# VM resources
config.vm.provider "virtualbox" do |vb|
vb.memory = "4096"
vb.cpus = "2"
end
config.vm.provision "shell", inline: <<-SHELL
# Set default route (adjust to your router)
echo "default 192.168.100.254 - eth1" > /etc/sysconfig/network/routes
# Disable the default NAT interface — this disables vagrant ssh too
sed -i "s/STARTMODE=.*/STARTMODE=off/" /etc/sysconfig/network/ifcfg-eth0
# Set DNS
echo "search fosstech.biz" > /etc/resolv.conf
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf
# Enable password-based SSH
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
systemctl restart sshd
systemctl restart network &
SHELL
end
🔧 Bring It Up
vagrant up
Once the VM is ready, SSH in with standard credentials:
ssh [email protected]
# Password: vagrant
✅ What Changed
| Vagrant Default | This Setup |
|---|---|
| NAT with port forwarding | Bridged to your physical network |
Key-based vagrant ssh only |
Standard SSH with password auth |
| Auto-assigned 10.0.2.15 | Static IP you choose (192.168.100.51) |
| VMs isolated from each other | VMs on the same network, can talk directly |