1

I have a Centos 6.4 based VM, and I'm running Virtualmin on it to host my personal site.

The problem is that by default, the OS is using DHCP, even though at router level (virtual router defined inside my hosting) it always assigns this VM the same internal IP everytime. But still, technically, at Centos, DHCP is being used.

Now I tried switching to a Static IP scheme within Centos (through Webmin), but when I did this, I could not connect to Webmin's web-console, or my website, or even through putty. I had to connect to the VM through my hosting provider's hardwired console.

I then switched back to DHCP, by modifying /etc/sysconfig/network-scripts/ifcfg-eth0, and everything started working again.

So what's the issue here ? Switching to a static IP is a very basic thing, so I don't know what's the problem.

Do note though that when I was on static IP scheme, I did ifconfig, and the etho did have the static IP assigned to it that I wanted. I didn't try pinging anything, but still.

Anyways, below are the contents of /etc/sysconfig/network-scripts/ifcfg-eth0 when STATIC IP was being used (i.e. when nothing connected to the VM):

IPV6INIT=yes
HWADDR=02:00:2D:D9:00:01
BROADCAST=""
UUID=91470e79-0e03-442c-b58f-f0b101a7cfd3
BOOTPROTO=none
NAME=""
NM_CONTROLLED=yes
MACADDR=""
TYPE=Ethernet
DEVICE=eth0
IPV6_AUTOCONF=yes
NETMASK=255.255.255.0
MTU=""
IPADDR=10.1.1.217
NETWORK=10.1.1.0
ONBOOT=yes

And below now are the contents of /etc/sysconfig/network-scripts/ifcfg-eth0 when I switched to DHCP IP again after the problem (and things connected again):

IPV6INIT=yes
HWADDR=02:00:2D:D9:00:01
BROADCAST=""
UUID=91470e79-0e03-442c-b58f-f0b101a7cfd3
BOOTPROTO="dhcp"
NAME=""
NM_CONTROLLED=yes
MACADDR=""
TYPE=Ethernet
DEVICE=eth0
IPV6_AUTOCONF=yes
MTU=""
NETWORK=10.1.1.0
ONBOOT=yes

So what's the problem ?

Ahmad
  • 133
  • 2
  • 5

1 Answers1

2

Your static IP configuration is missing a gateway address.

For instance:

GATEWAY=10.1.1.1
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940