Rtnetlink answers network is unreachable

Im пытается настроить тестовую сеть с виртуальными машинами, чтобы практиковать, как работает статическая маршрутизация, поэтому я подумал, что нужно сделать, это настроить две внутренние сети и одну коробку с двумя интерфейсами для работы в качестве маршрутизатора, вот настройка с IPs:

Я настроил статические IP-адреса в каждом поле, а также добавил шлюз по умолчанию adapter1 для vm-client-1 и adapter2 для vm-client-2.

Теперь, я на последнем шаге, чтобы создать ip маршрут, выполненный в vm-клиенте-1:

sudo ip route add 192.168.102.0/24 via 192.168.101.1 dev enp0s3

и я получаю эту ошибку как вывод:

RTNETLINK answers: Network is unreachable.

Примечание: я очистил все правила iptables с iptables -F Так, что брандмауэр не будет проблемой. Кроме того, vm-client может пинговать 192.168.102.1 (шлюз vm-client-2), поэтому я не знаю, почему он говорит, что сеть недоступна, помощь приветствуется.

здесь информации vm-client-1:

1 ответов

Я вижу проблему.

вы пытаетесь подключиться из vm-client1, который имеет только один интерфейс с подключенной сетью 192.168.101.0 / 24, но вы пытаетесь добавить шлюз в сеть 192.168.102.0 / 24, который фактически недоступен на этом интерфейсе, следовательно, вы получаете сообщение "сеть недоступна".

пожалуйста, имейте в виду, что любой шлюз (ip-адрес за словом" via") должен быть доступен непосредственно на подключенных интерфейсах (и это не ваш случай.)

кроме того, нет необходимости настраивать маршрутизацию на vm-client1, потому что все будет идти к шлюзу по умолчанию vm-router, который отвечает за маршрутизацию.

на самом деле есть только одна вещь, которую вам нужно сделать-включить переадресацию IP (https://askubuntu.com/questions/311053/how-to-make-ip-forwarding-permanent) на VM-роутере и ваши пакеты будут переадресованы автоматически.

вам не нужно вносить изменения в маршруты по умолчанию в этом сценарии. Просто включите IP переадресацию на vm-роутере и все будет в порядке.

Читайте также:  Juggernaut wars секреты игры

On an Ubuntu 14.04 server (3.16.0-30) I’m trying to add a default route and getting error as follows:

This box has address 192.168.11.23 on bond0.11 . I have the following routes configured statically (edited down to relevant subset):

I can ping 172.16.111.99 and here is traceroute ‘s output:

Why is the default route addition being rejected when I clearly have access to that network/host? I’m obviously doing something wrong.

A CentOS 7 host needs to install a CentOS 7 guest operating system using virt-install and a kickstart file. Then BOTH the HOST and the GUEST need to be accessible via ssh using separate public static IP addresses across the internet.

What specific commands and config need to be typed in order to enable ssh access to both the guest and the host via static public IP addresses?

My understanding is that setting this up includes the following steps:

1.) Configuring bridged networking on the host, to replace the default NAT
2.) Configuring static networking on the guest

But how should this be set up? Do we replace virbr0 with a new br0 as shown below, or do we just modify virbr0 ?

Note that this setup has the following PUBLIC static IP addresses (obscured/anonymized here for security reasons):

Current Error:

Using the methods outlined below, the terminal output during the installation includes the following lines relevant to this networking connectivity problem:

First Attempt To Configure the HOST:

The HOST’s public networking (which works perfectly), was set up with the following commands:

Then the HOST’s bridge (which DOES NOT yet work) was set up with the following commands:

Note that the preceding commands try to enslave both eth0 and eno because eth0 is defined inside the GUEST, while eno1 is defined in the HOST. Not clear what the scope of visibility is for these names, so am trying both here, but without success.

Читайте также:  Ps4 инструкция по применению

How The Guest Is Created:

The following are the specifics of how the guest is created:

The kickstart file on the HOST is:

The virt-install command run from the HOST is:

HOST config information:

On the host, the nmcli details are:

GUEST knows its Static Public IP, but cannot get out:

The following are the results of ping and curl commands run from inside the GUEST. As you can see, both programs run, but yet neither is able to get out of the VM to the outside world:

Config inside the GUEST:

Accessed from inside the GUEST, the auto-generated ifcfg-eth0 file is:

The following are the results of nmcli commands run inside the GUEST:

@garethTheRed’s Suggestions:

After entering @garethTheRed’s 4 nmcli commands and re-running the virt-install command with —network br > to create a new virtual machine, the firewall setting on the HOST are now:

Then, on the GUEST, the firewall settings are:

Similarly, the following results seem to indicate that routing is TURNED ON on the HOST:

While the following results seem to indicate that routing is TURNED OFF on the GUEST:

ip addr show on the HOST gives the following:

I notice that eno1 and br0 have the same IP address. Does this mean it is safe to remove the IP from eno1 and have the outside world still be able to communicate with the machine’s same IP address via br0 ? I am still learning how this works.

On the GUEST, ip addr show gives the following:

Though I prefer to use nmcli and NetworkManager for everything, I am including virsh diagnostic information below as follows. Note that the HOST only sees the default network.

Читайте также:  Ven 8086 dev 109a

All of the following were run on the HOST:

I then created a second network on the HOST with the following commands:

After creating the new test-bridge , the outside world is now able to successfully ping 12.34.567.8cc . But the GUEST is still not able to get a response from the outside world with ping 8.8.8.8 .

In the GUEST, I checked to see if the route was defined, and it gave the following:

Where 12.34.567.8bb is the physical router’s correct gateway, 12.34.567.8cc is the correct/expected static public IP for the GUEST, and 12.34.567.8mm is NOT ONE OF THE STATIC PUBLIC IP ADDRESSES THAT IS ALLOCATED TO US. However, 12.34.567.8mm is equal to 12.34.567.(8aa-1) , which means it may have been programatically derived from one of our 5 public IP addresses.

When I ask virsh on the HOST to show the GUEST’s interface and ip, virsh is able to show the interface, but not the ip, as follows:

Adding firewall —disabled and selinux —disabled to the kickstart file and then re-installing with the same virt-install command did not result in being able to successfully ping 8.8.8.8 to the outside world from inside a newly-created VM.

Rate this post

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *