root@kolla02:~/dev-env# ip r s
default via 192.168.1.101 dev eno1
10.0.0.0/16 dev eno2 proto kernel scope link src 10.0.0.1
10.1.0.0/16 dev virbr2 proto kernel scope link src 10.1.0.1
10.230.0.0/16 dev virbr3 proto kernel scope link src 10.230.0.1
192.168.0.0/16 dev eno1 proto kernel scope link src 192.168.20.11
192.168.1.101 dev eno1 proto dhcp scope link src 192.168.20.11 metric 100
192.168.121.0/24 dev virbr1 proto kernel scope link src 192.168.121.1
root@kolla02:~/dev-env# curl google.com
curl: (7) Failed to connect to <proxy> port <port>: No route to host
root@kolla02:~/dev-env# curl google.com --interface eno1
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
I need the curl to work without specifying the interface every time. The default route is set so not sure why it does not work without the interface. How is this fixed?
OS --> Ubuntu 20.04
If all the extra routes get removed to leave this:
default via 192.168.1.101 dev eno1 proto dhcp src 192.168.20.11 metric 100
192.168.0.0/16 dev eno1 proto kernel scope link src 192.168.20.11
192.168.1.101 dev eno1 proto dhcp scope link src 192.168.20.11 metric 100
The default route starts to work again:
root@kolla02:~/dev-env# curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML
But those routes are needed for vagrant and is not a solution in this case.
UPDATE:
seems like the conflicting entry is:
10.1.0.0/16 dev virbr2 proto kernel scope link src 10.1.0.1
as soon as this is removed, everything works fine. But this route is needed for vagrant to work.
root@kolla02:~/dev-env# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether a4:bf:01:55:f6:28 brd ff:ff:ff:ff:ff:ff
inet 192.168.20.11/16 brd 192.168.255.255 scope global eno1
valid_lft forever preferred_lft forever
inet6 fe80::a6bf:1ff:fe55:f628/64 scope link
valid_lft forever preferred_lft forever
3: eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether a4:bf:01:55:f6:29 brd ff:ff:ff:ff:ff:ff
inet6 fe80::a6bf:1ff:fe55:f629/64 scope link
valid_lft forever preferred_lft forever
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:0b:2d:4f:ee brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
5: virbr1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 52:54:00:07:f9:55 brd ff:ff:ff:ff:ff:ff
inet 192.168.121.1/24 brd 192.168.121.255 scope global virbr1
valid_lft forever preferred_lft forever
6: virbr1-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr1 state DOWN group default qlen 1000
link/ether 52:54:00:07:f9:55 brd ff:ff:ff:ff:ff:ff
7: virbr2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 52:54:00:9c:15:16 brd ff:ff:ff:ff:ff:ff
inet 10.1.0.1/16 brd 10.1.255.255 scope global virbr2
valid_lft forever preferred_lft forever
8: virbr2-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr2 state DOWN group default qlen 1000
link/ether 52:54:00:9c:15:16 brd ff:ff:ff:ff:ff:ff
9: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr1 state UNKNOWN group default qlen 1000
link/ether fe:54:00:99:a4:2f brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe99:a42f/64 scope link
valid_lft forever preferred_lft forever
10: macvtap0@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 52:54:00:2e:82:8b brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe2e:828b/64 scope link
valid_lft forever preferred_lft forever
11: macvtap1@eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 52:54:00:ff:40:a0 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:feff:40a0/64 scope link
valid_lft forever preferred_lft forever
12: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr2 state UNKNOWN group default qlen 1000
link/ether fe:54:00:44:07:25 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe44:725/64 scope link
valid_lft forever preferred_lft forever
13: vnet2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr1 state UNKNOWN group default qlen 1000
link/ether fe:54:00:55:fc:18 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe55:fc18/64 scope link
valid_lft forever preferred_lft forever
14: macvtap2@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 52:54:00:ee:cf:c6 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:feee:cfc6/64 scope link
valid_lft forever preferred_lft forever
15: macvtap3@eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 52:54:00:b9:1a:e0 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:feb9:1ae0/64 scope link
valid_lft forever preferred_lft forever
16: vnet3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr2 state UNKNOWN group default qlen 1000
link/ether fe:54:00:65:ab:6f brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe65:ab6f/64 scope link
valid_lft forever preferred_lft forever
17: vnet4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr1 state UNKNOWN group default qlen 1000
link/ether fe:54:00:0f:8e:63 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe0f:8e63/64 scope link
valid_lft forever preferred_lft forever
18: macvtap4@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 52:54:00:2c:39:9f brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe2c:399f/64 scope link
valid_lft forever preferred_lft forever
19: macvtap5@eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 52:54:00:78:8b:e2 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe78:8be2/64 scope link
valid_lft forever preferred_lft forever
20: vnet5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr2 state UNKNOWN group default qlen 1000
link/ether fe:54:00:3d:c3:28 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe3d:c328/64 scope link
valid_lft forever preferred_lft forever
21: vnet6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr1 state UNKNOWN group default qlen 1000
link/ether fe:54:00:bd:b4:dd brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:febd:b4dd/64 scope link
valid_lft forever preferred_lft forever
22: macvtap6@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 52:54:00:a3:7a:db brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fea3:7adb/64 scope link
valid_lft forever preferred_lft forever
23: macvtap7@eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 52:54:00:9a:31:0f brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe9a:310f/64 scope link
valid_lft forever preferred_lft forever
24: vnet7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr2 state UNKNOWN group default qlen 1000
link/ether fe:54:00:78:db:b6 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe78:dbb6/64 scope link
valid_lft forever preferred_lft forever
25: vnet8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr1 state UNKNOWN group default qlen 1000
link/ether fe:54:00:93:71:45 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe93:7145/64 scope link
valid_lft forever preferred_lft forever
26: macvtap8@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 52:54:00:99:c1:9c brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe99:c19c/64 scope link
valid_lft forever preferred_lft forever
27: macvtap9@eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 52:54:00:11:a9:ab brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe11:a9ab/64 scope link
valid_lft forever preferred_lft forever
28: vnet9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr2 state UNKNOWN group default qlen 1000
link/ether fe:54:00:37:be:e0 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe37:bee0/64 scope link
valid_lft forever preferred_lft forever
29: vnet10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr1 state UNKNOWN group default qlen 1000
link/ether fe:54:00:78:6f:36 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe78:6f36/64 scope link
valid_lft forever preferred_lft forever
30: macvtap10@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 52:54:00:51:1e:a4 brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe51:1ea4/64 scope link
valid_lft forever preferred_lft forever
31: macvtap11@eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 52:54:00:7f:f8:6e brd ff:ff:ff:ff:ff:ff
inet6 fe80::5054:ff:fe7f:f86e/64 scope link
valid_lft forever preferred_lft forever
32: vnet11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr2 state UNKNOWN group default qlen 1000
link/ether fe:54:00:98:1d:35 brd ff:ff:ff:ff:ff:ff
inet6 fe80::fc54:ff:fe98:1d35/64 scope link
valid_lft forever preferred_lft forever
UPDATE2: I changed the vagrant private network from 10.1.0.0/16 to a private range 172.16.0.0/16 and it started to work. @Michael Hampton gave this hint of conflicting routes. The http proxy was rerouted to the internal vagrant private network instead of going out.
Vagrant.configure('2') do |config|
(1..6).each do |i|
config.vm.define "vm-#{i}" do |node|
config.vm.box = 'generic/ubuntu2004'
node.vm.network 'public_network',
:dev => 'eno1',
:mode => 'bridge',
:netmask => '255.255.0.0',
:ip => "192.168.20.#{50 + i}"
node.vm.network 'public_network',
:dev => 'eno2',
:bridge => 'eno2',
:netmask => '255.255.0.0',
:ip => "10.0.87.#{i}"
node.vm.network 'private_network',
:forward_mode => 'nat',
:forward_device => 'eno1',
:ip => "172.16.0.#{10+i}",
:netmask => '255.255.0.0'
node.vm.provider 'libvirt' do |v| # docs -> https://github.com/vagrant-libvirt/vagrant-libvirt
# memory in MBytes
v.memory = $mem
# number of virtual cpus.
v.cpus = $cpus
# nested virtualization
v.nested = true
# boot image size in GB
v.machine_virtual_size = 150
v.storage :file,
:size => 100,
:allow_existing => true,
:path => "vm-#{i}-data.img"
node.vm.provision "shell", inline: $script
end
end
end
end
0 Answers