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
Best Answer
ahem...
just comment this line
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 (ifonboot=yes
is set). In case of eth0, it will run/etc/sysconfg/network-scripts/ifup-eth
,ifdown eth0
, thenifup 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 etcI 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 viaudev
, which "tracks" for changes and stores naming/mac binding configuration permanently to/etc/udev/rules.d/
.