root@kolla02:~/dev-env# ip r s
implicit prin 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) Nu s-a putut conecta la portul <proxy> <port>: Nicio rută către gazdă
root@kolla02:~/dev-env# curl google.com --interface eno1
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 mutat</TITLE></HEAD><BODY>
<H1>301 mutat</H1>
Documentul s-a mutat
<A HREF="http://www.google.com/">aici</A>.
</BODY></HTML>
Am nevoie ca bucla să funcționeze fără a specifica interfața de fiecare dată. Ruta implicită este setată, așa că nu sunt sigur de ce nu funcționează fără interfață. Cum se rezolvă asta?
OS --> Ubuntu 20.04
Dacă toate rutele suplimentare sunt eliminate pentru a lăsa asta:
implicit prin 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
Ruta implicită începe să funcționeze din nou:
root@kolla02:~/dev-env# curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 mutat</TITLE></HEAD><BODY>
<H1>301 mutat</H1>
Documentul s-a mutat
<A HREF="http://www.google.com/">aici</A>.
</BODY></HTML
Dar acele rute sunt necesare pentru vagabond și nu este o soluție în acest caz.
ACTUALIZAȚI:
se pare că intrarea în conflict este:
10.1.0.0/16 dev virbr2 proto kernel scope link src 10.1.0.1
de îndată ce acesta este îndepărtat, totul funcționează bine. Dar acest traseu este necesar pentru ca vagabondul să funcționeze.
root@kolla02:~/dev-env# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue stare UNKNOWN grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
inet6 ::1/128 scope host
valid_lft pentru totdeauna preferred_lft pentru totdeauna
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq stare UP grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
inet6 fe80::a6bf:1ff:fe55:f628/64 scope link
valid_lft pentru totdeauna preferred_lft pentru totdeauna
3: eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq stare UP grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
4: docker0: <NO-CARRIER, BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN grup implicit
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 pentru totdeauna preferred_lft pentru totdeauna
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 pentru totdeauna preferred_lft pentru totdeauna
6: virbr1-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr1 stare JOS grup implicit 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 stare UP grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
8: virbr2-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr2 stare JOS grup implicit 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 stare NECUNOSCUT grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
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 pentru totdeauna preferred_lft pentru totdeauna
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 pentru totdeauna preferred_lft pentru totdeauna
12: vnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr2 stare NECUNOSCUT grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
13: vnet2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr1 stare NECUNOSCUT grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
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 pentru totdeauna preferred_lft pentru totdeauna
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 pentru totdeauna preferred_lft pentru totdeauna
16: vnet3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr2 stare NECUNOSCUT grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
17: vnet4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr1 stare NECUNOSCUT grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
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 pentru totdeauna preferred_lft pentru totdeauna
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 pentru totdeauna preferred_lft pentru totdeauna
20: vnet5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr2 stare NECUNOSCUT grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
21: vnet6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr1 stare NECUNOSCUT grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
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 pentru totdeauna preferred_lft pentru totdeauna
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 pentru totdeauna preferred_lft pentru totdeauna
24: vnet7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr2 stare NECUNOSCUT grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
25: vnet8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr1 stare NECUNOSCUT grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
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 pentru totdeauna preferred_lft pentru totdeauna
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 pentru totdeauna preferred_lft pentru totdeauna
28: vnet9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr2 stare NECUNOSCUT grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
29: vnet10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr1 stare NECUNOSCUT grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
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 pentru totdeauna preferred_lft pentru totdeauna
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 pentru totdeauna preferred_lft pentru totdeauna
32: vnet11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr2 stare NECUNOSCUT grup implicit 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 pentru totdeauna preferred_lft pentru totdeauna
UPDATE2:
Am schimbat rețeaua privată vagabondă de la 10.1.0.0/16 la o gamă privată 172.16.0.0/16 și a început să funcționeze. @Michael Hampton a dat acest indiciu de rute conflictuale. Proxy-ul http a fost redirecționat către rețeaua privată internă vagabondă în loc să iasă.
Vagrant.configure('2') face |config|
(1..6).fiecare face |i|
config.vm.define „vm-#{i}” face |node|
config.vm.box = 'generic/ubuntu2004'
node.vm.network „public_network”,
:dev => 'eno1',
:mode => 'pod',
: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” face |v| # documente -> https://github.com/vagrant-libvirt/vagrant-libvirt
# memorie în MBytes
v.memorie = $mem
# număr de CPU virtuale.
v.cpus = $cpus
# virtualizare imbricată
v.neted = adevărat
# dimensiunea imaginii de pornire în GB
v.machine_virtual_size = 150
v.storage :fișier,
:size => 100,
:allow_existing => adevărat,
:path => "vm-#{i}-data.img"
node.vm.provision „shell”, inline: $script
Sfârşit
Sfârşit
Sfârşit
Sfârşit