Network configuration

varadarajan

Member
May 12, 2016
16
0
21
64
Everything works fine when the vms are configured for DHCP. But when we try to assign staic IP to VMs ,

ipv4 CIDR : 192.168.0.122/32
gateway ipv4 : 192.168.0.1
dns 8.8.8.8

the network configurtion shows up like this,
# cat /etc/network/interfaces
auto lo
iface lo inet loopback auto eth0
iface eth0 inet static
address 192.168.0.122
netmask 255.255.255.255
post-up ip route add 192.168.0.1 dev eth0
post-up ip route add default via 192.168.0.1 dev eth0
pre-down ip route del default via 192.168.0.1 dev eth0
pre-down ip route del 192.168.0.1 dev eth0
bridge_ports eth0
bridge_fd 0
Vm has internet connection. Vm can ping other vms. Vm can ping host .
But host can not ping VM . Other machines in the network can not ping VM.

Obviously I am doing something wrong . Even if I change anything in /etc/network/interfaces , it puts back the above when I reboot.
So how to set a static IP address for the VM. ?

Cheers

Rad
 
Everything works fine when the vms are configured for DHCP. But when we try to assign staic IP to VMs ,

ipv4 CIDR : 192.168.0.122/32
gateway ipv4 : 192.168.0.1
dns 8.8.8.8

the network configurtion shows up like this,
# cat /etc/network/interfaces
auto lo
iface lo inet loopback auto eth0
iface eth0 inet static
address 192.168.0.122
netmask 255.255.255.255
post-up ip route add 192.168.0.1 dev eth0
post-up ip route add default via 192.168.0.1 dev eth0
pre-down ip route del default via 192.168.0.1 dev eth0
pre-down ip route del 192.168.0.1 dev eth0
bridge_ports eth0
bridge_fd 0
Vm has internet connection. Vm can ping other vms. Vm can ping host .
But host can not ping VM . Other machines in the network can not ping VM.

Obviously I am doing something wrong . Even if I change anything in /etc/network/interfaces , it puts back the above when I reboot.
So how to set a static IP address for the VM. ?

Cheers

Rad
with netmask /32 it is incorrect to use gateway.

set netmask to /24 (255.255.255.0) and should work
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!