Linux centos network is unreachable

How To Fix CentOS Network Is Unreachable & Could Not Retrieve MirrorList Could Not Resolve Host mirrorlist.centos.org Unknown Error

Recently I installed CentOS 7.7 on Oracle VirtualBox. After installation, when I run command yum update, it shows could not retrieve mirrorlist could not resolve host mirrorlist.centos.org unknown error.

When I run the command ping www.google.com, it shows the network is unreachable error. When I run the below command to see the network configuration, it all shows incorrect information.

cat /etc/resolv.conf cat /etc/sysconfig/network cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 cat /etc/sysconfig/network-scripts/route-enp0s3

1. Fix CentOS 7 Network Is Unreachable & Could Not Retrieve MirrorList Error Steps.

  1. The reason for this error is because I do not turn on the ethernet network card when installing CentOS, so I should reinstall CentOS and turn on the ethernet network card follow the below steps.
  2. When installing CentOS, in the Name and operation system window, you should select Red Hat ( 64-bit ) in the Version drop-down list.
  3. In the INSTALLATION SUMMARY window, NETWORK & HOST NAME section, you can see a smaller text Not connected under NETWORK & HOST NAME, click it to edit network settings.
  4. When you click above NETWORK & HOST NAME item, it will display the NETWORK & HOST NAME detail configuration window, select the Ethernet(enp0s3) in the left list, turn on the toggle button behind the Ethernet ( enp0s3 ) on the right side, then you can see the Ethernet status is Connected , and you can see related IP address, DNS server IP address below it.
  5. You can also click the Configure… button in the above window bottom right corner to customize the network settings, when you click the Configure… button, it will popup the Editing enp0s3 window.
  6. In the Editing enp0s3 window, click the General tab, then check the checkbox Automatically connect to this network when it is available.
  7. Click the IPv4 Settings tab, you can input your own DNS server IP in the Additional DNS servers input text box.
  8. Save the above settings, and begin installing the CentOS until success, after that you can find the network is available. You can run the command $ ip address to get the current os IP address.
Читайте также:  Все виды дистрибутив linux

Источник

CentOS

I am trying to set up a static route on my centos box so that traffic is pointed to a different gateway, but I am getting the error above. My set up is below. I have tried several different methods but I cannot get it to work.

IP address: 192.168.250.98/24
gateway:192.168.250.1 ==> default on switch, connected to MPLS router 1.1.1.1

We also have a firewall connected to the network with a LAN IP of 192.168.250.250 and WAN IP of 2.2.2.2.

when I try to connect to our AWS server via ssh with a custom port of 1234 on the primary connection (MPLS) it will not connect despite being allowed on AWS. (this also happened on a a windows instance and I added a static route with problem) so I added a static route on this Centos box:

ip route via 192.168.250.250 to which I receive network is unreachable. reading around I see the issue is caused by the next hop being on the same subnet as the default gateway and /or not being directly connected. So I tried adding the WAN IP of the firewall which I can ping but I get the same.

I have never come across something that was simple to do on Windows and not on Linux, this is a first. I would appreciate some help.

TrevorH Site Admin Posts: 32853 Joined: 2009/09/24 10:40:56 Location: Brighton, UK

Re: Network is unreachable

Post by TrevorH » 2017/06/19 17:08:50

It’s possible to add a more specific route to the system — e.g you can have default via 192.168.250.1 and 8.8.8.8 via 192.168.250.250. The only time you would get a network is unreachable is if you tried to create a route that was not accessible directly from your subnet. So with your interface having 192.168.250.98/24

ip ro add default via 192.168.250.1 ip ro add 8.8.8.8 via 192.168.250.250 ip ro add 8.8.8.9 via 192.168.251.1

The future appears to be RHEL or Debian. I think I’m going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Re: Network is unreachable

Post by jamesy281 » 2017/06/19 17:49:07

I am adding a more specific route by saying aws-ip via 192.168.250.250. It is reachable via that path as I have added the same route to the windows box.

TrevorH Site Admin Posts: 32853 Joined: 2009/09/24 10:40:56 Location: Brighton, UK

Re: Network is unreachable

Post by TrevorH » 2017/06/19 18:28:05

Without more specific information I think it’s going to be difficult to help. Can you share the output from ip ro sh and the ip ro add that fails? It would be best if you showed us exactly what you’re running in case you are obscuring some unnoticed typo by changing them before you post it.

The future appears to be RHEL or Debian. I think I’m going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Re: Network is unreachable

Post by jamesy281 » 2017/06/20 09:40:59

Читайте также:  Qualcomm atheros ar9485 wireless network adapter driver linux

The routing table is really simple:

default via 192.168.250.1 dev ens160 proto static metric 100
192.168.250.1 dev ens160 proto static scope link metric 100
192.168.250.98 dev ens160 proto kernel scope link src 192.168.250.98 metric 100

ip route add via 192.168.250.250 and the result is:

RTNETLINK answers: Network is unreachable

192.168.250.250 is reachable from this interface as it is on the same subnet as is the public IP

[Solved] Re: Network is unreachable

Post by jamesy281 » 2017/06/20 18:30:20

So my colleague gave me a second set of eyes and spotted pretty quickly that the net mask of the centos box was wrong. I’m not sure how (or how it worked) but the prefix in the ifcfg-eth0 was 32 instead of 24.

  • CentOS General Purpose
  • ↳ CentOS — FAQ & Readme First
  • ↳ Announcements
  • ↳ CentOS Social
  • ↳ User Comments
  • ↳ Website Problems
  • CentOS 8 / 8-Stream / 9-Stream
  • ↳ 8 /8-Stream / 9-Stream — General Support
  • ↳ 8 /8-Stream / 9-Stream — Hardware Support
  • ↳ 8 /8-Stream / 9-Stream — Networking Support
  • ↳ 8 /8-Stream / 9-Stream — Security Support
  • CentOS 7
  • ↳ CentOS 7 — General Support
  • ↳ CentOS 7 — Software Support
  • ↳ CentOS 7 — Hardware Support
  • ↳ CentOS 7 — Networking Support
  • ↳ CentOS 7 — Security Support
  • CentOS Legacy Versions
  • ↳ CentOS 5
  • ↳ CentOS 5 — General Support
  • ↳ CentOS 5 — Software Support
  • ↳ CentOS 5 — Hardware Support
  • ↳ CentOS 5 — Networking Support
  • ↳ CentOS 5 — Server Support
  • ↳ CentOS 5 — Security Support
  • ↳ CentOS 5 — Oracle Installation and Support
  • ↳ CentOS 5 — Miscellaneous Questions
  • ↳ CentOS 6
  • ↳ CentOS 6 — General Support
  • ↳ CentOS 6 — Software Support
  • ↳ CentOS 6 — Hardware Support
  • ↳ CentOS 6 — Networking Support
  • ↳ CentOS 6 — Security Support

Powered by phpBB® Forum Software © phpBB Limited

Источник

CentOS

What can I give you of information to help you to understand what is wrong ?

gerald_clark Posts: 10642 Joined: 2005/08/05 15:19:54 Location: Northern Illinois, USA

[CentOS 6.4 x86_64] Network is unreachable

Post by gerald_clark » 2013/10/03 20:31:23

Welcome to CentOS.
New members need to read http://www.centos.org/modules/newbb/viewforum.php?forum=47

Your answer is here -> http://wiki.centos.org/FAQ/CentOS6

Re: [CentOS 6.4 x86_64] Network is unreachable

Post by wyzer » 2013/10/03 21:48:50

I’ve read your link but it doesn’t solved my issue 🙁

[code]DEVICE=»eth0″
BOOTPROTO=static
HWADDR=»00:XX:XX:XX:XX:e3″
NM_CONTROLLED=no
ONBOOT=»yes»
IPADDR=212.XX.XX.142
NETMASK=255.255.255.0
GATEWAY=62.XX.XX.1
[/code]

gerald_clark Posts: 10642 Joined: 2005/08/05 15:19:54 Location: Northern Illinois, USA

Re: [CentOS 6.4 x86_64] Network is unreachable

Post by gerald_clark » 2013/10/03 22:09:58

Re: [CentOS 6.4 x86_64] Network is unreachable

Post by wyzer » 2013/10/03 22:40:48

But I used this configuration while the installation of CentOS

gerald_clark Posts: 10642 Joined: 2005/08/05 15:19:54 Location: Northern Illinois, USA

Re: [CentOS 6.4 x86_64] Network is unreachable

Post by gerald_clark » 2013/10/03 23:32:56

Re: [CentOS 6.4 x86_64] Network is unreachable

Post by wyzer » 2013/10/04 08:06:45

[code][root@google ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:XX:XX:XX:XX:E3
inet addr:212.XX.XXX.142 Bcast:212.XX.XX.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe00:1ae3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:80936 errors:0 dropped:0 overruns:0 frame:0
TX packets:2383 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5759492 (5.4 MiB) TX bytes:393253 (384.0 KiB)

Читайте также:  Logitech linux keyboard driver

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:108 errors:0 dropped:0 overruns:0 frame:0
TX packets:108 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:10044 (9.8 KiB) TX bytes:10044 (9.8 KiB)
[/code]

gerald_clark Posts: 10642 Joined: 2005/08/05 15:19:54 Location: Northern Illinois, USA

Re: [CentOS 6.4 x86_64] Network is unreachable

Post by gerald_clark » 2013/10/04 13:00:05

That interface is working.
Your gateway is incorrect.
You probably have no nameservers in /rtc/rsolv.conf.

Re: [CentOS 6.4 x86_64] Network is unreachable

Post by wyzer » 2013/10/04 13:49:20

I’ve checked «/etc/resolv.conf» and there is nameserver (8.8.8.8 and 8.8.4.4)

I think I must change the settings of the network adapter on VMware (may be I can put another Gateway)

Because when I install a Virtual Machine, I allaws put the IP of the server on Gateway (and I change the last group of number to «1»)

Example : If my server’s IP is : 62.144.55.33, my Gateway on the Virtual Machine is 62.144.55.1

The thing that I don’t understand, it’s when I install a Desktop version of CentOS (LiveDVD), and I change my settings with the NetworkManager it works 😕

TrevorH Site Admin Posts: 32853 Joined: 2009/09/24 10:40:56 Location: Brighton, UK

Re: [CentOS 6.4 x86_64] Network is unreachable

Post by TrevorH » 2013/10/04 14:20:02

[quote]
Example : If my server’s IP is : 62.144.55.33, my Gateway on the Virtual Machine is 62.144.55.1
[/quote]

Yes, exactly. But in this one you have an IP address that start with 212 and a gateway in 62 and the subnet mask doesn’t put them in the same subnet. You either need to have your gateway within the same subnet as your IP address or you need to add an explicit route to the gateway via the device itself (which gets tricky).

  • CentOS General Purpose
  • ↳ CentOS — FAQ & Readme First
  • ↳ Announcements
  • ↳ CentOS Social
  • ↳ User Comments
  • ↳ Website Problems
  • CentOS 8 / 8-Stream / 9-Stream
  • ↳ 8 /8-Stream / 9-Stream — General Support
  • ↳ 8 /8-Stream / 9-Stream — Hardware Support
  • ↳ 8 /8-Stream / 9-Stream — Networking Support
  • ↳ 8 /8-Stream / 9-Stream — Security Support
  • CentOS 7
  • ↳ CentOS 7 — General Support
  • ↳ CentOS 7 — Software Support
  • ↳ CentOS 7 — Hardware Support
  • ↳ CentOS 7 — Networking Support
  • ↳ CentOS 7 — Security Support
  • CentOS Legacy Versions
  • ↳ CentOS 5
  • ↳ CentOS 5 — General Support
  • ↳ CentOS 5 — Software Support
  • ↳ CentOS 5 — Hardware Support
  • ↳ CentOS 5 — Networking Support
  • ↳ CentOS 5 — Server Support
  • ↳ CentOS 5 — Security Support
  • ↳ CentOS 5 — Oracle Installation and Support
  • ↳ CentOS 5 — Miscellaneous Questions
  • ↳ CentOS 6
  • ↳ CentOS 6 — General Support
  • ↳ CentOS 6 — Software Support
  • ↳ CentOS 6 — Hardware Support
  • ↳ CentOS 6 — Networking Support
  • ↳ CentOS 6 — Security Support

Powered by phpBB® Forum Software © phpBB Limited

Источник

Оцените статью
Adblock
detector