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