Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 ?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Your static IP configuration is missing a gateway address.

For instance:

GATEWAY=10.1.1.1
share|improve this answer
    
That was indeed the issue. Thanks! –  Ahmad Oct 5 '13 at 17:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.