Static Ip results in no internet connection in CentOS 6.5 (Basic Server)

Posted on

QUESTION :

I am unable to get an internet connection with my static IP setup.

Here’s my relevant files:

/etc/sysconfig/network

NETWORKING=yes
HOSTNAME=localhost.myserver
GATEWAY=192.168.1.1

/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=none
HWADDR=XX:XX:XX:XX:XX:XX
TYPE=Ethernet
UUID=xxxxxxx-xxxxxx-xxxx-xxxx-xxxxxxxx
BROADCAST=192.168.1.255
IPADDR=192.168.1.44
NETMASK=255.255.255.0
NETWORK=192.168.1.0
ONBOOT=yes  

/etc/resolve.conf

search myserver
nameserver 192.168.1.1
nameserver 8.8.8.8

ifconfig shows 192,168.1.44 (just like it should)

route -n shows:

Destination       Gateway           genmask                 flag     Metric           Ref    Use    Iface
192.168.1.0      0.0.0.0            255.255.255.0           U        0                0      0      eth0
169.254.0.0      0.0.0.0            255.255.0.0             U        1002             0      0      eth0
0.0.0.0          192.168.1.1        0.0.0.0.                UG       0                0      0      eth0

When I ping the gateway I get:

PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
From 192.168.1.44 icmp_seq=1 Destination Host Unreachable
From 192.168.1.44 icmp_seq=2 Destination Host Unreachable
From 192.168.1.44 icmp_seq=3 Destination Host Unreachable

When I ping google, it just hangs until finally saying unknown host.

What’s wrong?

ANSWER :

You still need to add:

GATEWAY=192.168.1.1
DNS1=8.8.8.8
DNS2=192.168.1.1

to your /etc/sysconfig/network-scripts/ifcfg-eth0 file. It worked for me!

In virtualBox, the static ip does not work with a NAT connection. Switching to “Bridged Adapter” fixed this.

Try using the Intel PRO/1000 MT Server on a NAT Network (NatNetwork) first using dhclient to get a DHCP address, Fiddle with hostname, static IP, host, etc. Reboot. Test ifconfig eth0, route -n, hostname, ping, etc. You should not have to switch to Promiscuous mode, however.

Leave a Reply

Your email address will not be published.