CentOS - Internet connection does not work

I am just hit by a stupid trouble:

One of my test CentOS server lost Internet connectivity while the gateway computer was re-installed (moved from Ubuntu to Windows)

It (my server) can still ping the gateway computer, but there is no Internet connectivity then after.

What can I do on the CentOS to make the intenet connection again?

I am just a basic linux user. And, this system does not have X server installed.

Check the IP settings on the machine are correct - ifconfig

Should list eth0 etc with an IP and Gateway, is it possible that when the machine came back up after losing connectivity it didn’t get an IP address correctly or it changed?

Have you tried the obvious, and restarted the machine? :smiley:

The IP address static in /etc/sysconfig/network-scripts/ifcfg-eth0:


DEVICE=eth0
BOOTPROTO=none
HWADDR=6c:62:6d:08:eb:39
IPV6INIT=yes
IPV6_AUTOCONF=yes
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=192.168.0.5
GATEWAY=192.168.0.1
TYPE=Ethernet

And the ifconfig shows:

eth0      Link encap:Ethernet  HWaddr 6C:62:6D:08:EB:39
          inet addr:192.168.0.5  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::6e62:6dff:fe08:eb39/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:50574 errors:0 dropped:0 overruns:0 frame:0
          TX packets:29811 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9402503 (8.9 MiB)  TX bytes:10977942 (10.4 MiB)
          Interrupt:233 Base address:0xc000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:353 errors:0 dropped:0 overruns:0 frame:0
          TX packets:353 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:46791 (45.6 KiB)  TX bytes:46791 (45.6 KiB)

Other Widows computers that use the same gateway have internet connection.

How are the Windows machines negotiating through to the internet via the gateway? Internet Connection Sharing (ICS) or some proxy or some other means?

Are other Centos machines unaffected?

All other computers too use their own static IP, with the gateway IP: 192.168.0.1. No proxy at all. There is a network connection with the gateway (it is pingable).

Other computers too can access the centos server, and transfer the files.
But it cannot still access the internet. Particularly, when I try to send emails using the test server, it fails.

I want to update svn server on this machine. But without internet connection, it is not possible. Is there any special command that I can run to reset the network connection?

/etc/init.d/networking restart

will restart all networking - restarting the pc would do the same.

Do not run this command over SSH, ever.

I learned that the hard way :x

Running it over ssh is fine - i do it quite often when adding new IP addresses to our servers (I have no direct console access)

Really? When I ran it (few years ago, so maybe things have changed), my SSH got disconnected because the network went down, and because there was no SSH connection anymore the networking command stopped running so the network never came back up.
Somebody had to get to the physical server to restart networking from there.

Yep, it does it fine…


[root@redhat ~]# /etc/init.d/network restart
Shutting down interface eth1:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Disabling IPv4 packet forwarding:  net.ipv4.ip_forward = 0
                                                           [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth1:                                [  OK  ]
[root@redhat ~]#

That was done on the dev machine here at work via ssh.

Makes me wonder what happened way back then…

Anyway, seems I was wrong. Thanks :slight_smile:

changes in network config can cause breakage, but simple restarts should happen without causing problems (by design) so you can do them remotely.

I think, the new DNS does not resolve. Possibly, static IP set but no DNS.
A person here recently did the change and it is now working.

[root@localhost ~]# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search localdomain
nameserver 8.8.8.8
nameserver 4.2.2.2

Probably, new name server is set to Google?

Compare the nameserver to the ones from a working machine? What happens if you try to ping out to the outside world via a direct IP?

209.85.143.99 as one of googles for example

[root@redhat ~]# ping google.com
PING google.com (209.85.143.99) 56(84) bytes of data.