0

I have just installed a fresh copy of CentOs 6.4 on a dedicated server. I'm new to linux and trying to learn it. The dedicated server has no network connectivity (I can't ping any hostnames or IP addresses).

If I run route it is empty.

My /ifcfg-eth0 contains the following:

DEVICE=eth0
TYPE=Ethernet
UUID=c3100ae4-7059-4307-bc40-dc37e989792e
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
HWADDR=00:25:90:D3:1A
IPADDR=76.164.xxx.xxx(This is set at the IP I was given as the main server IP. Should this be the block rather than the single IP I was given?)
PREFIX=29
GATEWAY=76.164.xxx.xxx (This was given to me by the host)
NETMASK = 255.255.255.248
DNS1=8.8.8.8.
DNS2=8.8.4.4
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"

ifconfig eth0 outputs the following:

Link Encap: Ethernet HWaddr 00:25:90:D3:1A:AC
inet 6 addr: f e80::225:90ff:fed3:1aac/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Rx Packets:56 errors:0 dropped:0 overruns:0 frame:0
Tx Packets: 12 error:0 dropped: 0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3360 (3.2KiB) Tx bytes:2520 (2.4 KiB)
Memory: f7200000-f7280000

What do I do now to get the network working? Any help would be appreciated :)

Okay. No idea what changed but on restart the network service I can now ping google. My route looks like this: Is this as it should be?

Destination     Gateway     Genmask     Flags     Metric     Ref     Use     Iface
76.164.xxx.xxx     *   255.255.255.248    U         0         0       0       eth0
link-local         *     255.255.0.0      U        1002       0       0       eth0
3
  • Please, try service network restart and ping the gateway. Add the output to your question.
    – dawud
    Aug 14, 2013 at 10:54
  • you are missing a default gateway
    – dawud
    Aug 14, 2013 at 10:55
  • It all seems to be working now. I haven't added anything new though apart from doing the restart. I'm able to SSH in to it and ping. Do I need to do something else still though?
    – Tenatious
    Aug 14, 2013 at 11:14

1 Answer 1

2
Ethernet HWaddr 00:25:90:D3:1A:AC

ahem...

HWADDR=00:25:90:D3:1A

just comment this line

Link Encap: Ethernet HWaddr 00:25:90:D3:1A:AC
inet 6 addr: f e80::225:90ff:fed3:1aac/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Rx Packets:56 errors:0 dropped:0 overruns:0 frame:0
Tx Packets: 12 error:0 dropped: 0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3360 (3.2KiB) Tx bytes:2520 (2.4 KiB)
Memory: f7200000-f7280000

there is no ipv4 address, so, that's why you don't have any routes. but i see same network in routes :) you are just missing GW. Really hard to say why it happened.

Brief:

when service network restart is run, it will go through all configuration files under /etc/sysconfig/network-scripts/ and run appropriate scripts for bringing down and then bringing up interfaces from there (if onboot=yes is set). In case of eth0, it will run /etc/sysconfg/network-scripts/ifup-eth, ifdown eth0, then ifup eth0 will do the same. That's what must be done when networking configuration is changed for interface. About the same is for routes (ifcfg-routex), ppp connections vpn etc

I don't know how did you configure the interface, maybe you've created files manually, maybe with system-config-network, but in case of any of these two - you will need to restart interfaces as specified above.

p.s. HWADDR field in ifcfg-eth0 file is not necessary, it's used to bind configuration to the interface which has this specific MAC address. If you will change this field in file - this configuration will be ignored and not set. ethx/emx etc naming is set via udev, which "tracks" for changes and stores naming/mac binding configuration permanently to /etc/udev/rules.d/.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .