/srv/irclogs.ubuntu.com/2021/03/04/#netplan.txt

=== timeless_ is now known as timeless
=== npgm_ is now known as npgm
=== ]42[ is now known as [42]
slyonPeGaSuS: If you remove any gateway6 the IP addresses still stay the same. This settings is only about where outgoing packages are being send09:47
neo7530Hi11:19
neo7530maybe someone can help me with an issue ?11:19
neo7530i have set up netplan with one physical nw-adapter and defined some virtual ip-addresses for a reverse proxy11:20
neo7530this works so far, but: when i request the website via the virtual ip, the proxy sents the request to the backend via an other ip, as i have requested11:22
neo7530eg: client => 192.168.0.2 => rev. proxy to 192.168.0.10 but the request to the backend will be via ip-address 192.168.0.111:23
kjetilhowhat do you mean by virtual ip-address?  probably best to put your netplan in a pastebin/gist11:27
neo7530network:11:28
neo7530  ethernets:11:28
neo7530    enp0s3:11:28
neo7530      dhcp4: no11:28
neo7530      addresses: [10.24.10.30/24,10.24.10.31/24,10.24.10.33/24]11:28
neo7530      gateway4: 10.24.10.5011:28
neo7530      nameservers:11:28
neo7530        addresses: [10.24.10.50]11:28
neo7530i have 3 addresses on one physical interface11:29
neo7530i make a request to 10.24.10.31 this will be forwarded via reverse-proxy to a backend-server11:30
neo7530but the request to the backend will be made via 10.24.10.3011:30
neo7530and not via 10.24.10.31 as requested11:30
PeGaSuSslyon: right. I've just tested and this seems to work: https://termbin.com/dm0711:31
kjetilhoneo7530: I think you mean, not via, but with source address?11:31
kjetilho(via implies a hop via a router)11:32
neo7530yep11:32
neo7530the request to the backend should be the same as my client sent the request to11:32
neo7530same ip, i mean11:33
kjetilhoright - you need source routing to enable this.  ie. a route where you specify from: and table:11:34
kjetilhotable is just some integer to separate the routing from the default route table11:34
kjetilhobtw, one of my favourite commands when checking stuff like this is "ip route get A.B.C.D" - it will tell you what src address the kernel will use for a new connection there11:35
neo7530and how should i do this? i'm fairly new to netplan11:44
kjetilhoroutes:12:08
kjetilho  -12:08
kjetilho    from: 10.24.10.3112:08
kjetilho    to: 10.24.10.3112:08
kjetilho    via: 10.24.10.3112:08
kjetilho    table: 1712:08
kjetilhoehhh12:08
kjetilhocut and paste error of your addresses12:09
kjetilhoto: 192.168.0.1012:09
kjetilhoI think is what you wanted?12:09
neo7530hmmm12:10
neo7530local 10.24.10.31 dev lo table local src 10.24.10.30 uid 012:10
neo7530doesn't work12:15
kjetilhoyou need to explain what you want again12:17
kjetilhothe components are not clear12:17
neo7530okay. client = 10.24.10.xxx                reverse-proxy 10.24.10.31                    backend 10.24.10.1012:19
neo7530client request goes to *3112:20
neo7530reverse-proxy talks to the backend via *30 but should use the *31 for communication12:21
neo7530same address outgoing as ingoing12:21
neo7530*30 *31 *33 are on the same physical interface12:22
kjetilhoso backend is your value for to12:29
kjetilhoand reverse-proxy your values for from and via12:29
kjetilhothere might be a better method to make .31 preferred generally - you don't really need a specific exception rule here, it seems12:31
neo7530ip route get 10.24.10.1012:35
neo753010.24.10.10 dev enp0s3 src 10.24.10.30 uid 012:35
neo7530makes no difference12:35
neo7530      routes:12:35
neo7530        - to: 10.24.10.1012:35
neo7530          from: 10.24.10.3112:35
neo7530          via: 10.24.10.3112:35
neo7530          table: 10112:35
kjetilhooh.  I thought netplan added the ip rule automatically  :-(12:44
kjetilho"15:01 <kjetilho> btw, I just set up source based routing with Netplan - so simple I hardly could believe it :)"  - it was too good to be true ...12:44
neo7530maybe i should use iptables for this12:46
neo7530:/12:46
kjetilhoahhh - I need to add routing-policy!12:48
kjetilhoyou, too.12:48
kjetilhorouting-policy:12:48
kjetilho  - from: 10.24.10.3112:48
kjetilho    table: 10112:49
neo7530ahh, i try this12:49
kjetilhothe from: in the routes is probably superfluous, then12:50
neo7530nope, makes no difference12:52
neo7530this is odd :/12:52
kjetilhohrm, no ip rules installed here either12:57
kjetilhohrm, it does work for me though - but I don't understand how, since ip rule does not list any new rules13:54
kjetilhoslyon: ^ how does routing-policy work behind the scenes?13:54
kjetilhonow I'm not sure if routing-policy is needed for my case after all.  it's a bit awkward to test since a reboot is required.13:56
kjetilho(I mean, applying config will not clean up random stuff added earlier)13:56
slyonkjetilho: behind the scenes netplan generates a [RoutingPolicyRule] section inside a .network file for systemd14:04
kjetilhosorry for being a n00b, but I can't find anything like this (I'm on Ubuntu Focal)14:08
kjetilhothat is, no units of type network at all.14:09
kjetilhoright, they end up in /run/systemd/network14:16
kjetilhoand right², the from-parameter in a route ends up as PreferredSource in the .network file14:16
slyoncorrect, /run/systemd/networkd/10-netplan-*.network14:17
kjetilhoperhaps my netplan version is too old - 0.10114:18
kjetilhogrep -i policy /run/systemd/network/* → nada14:18
slyon0.101 is the latest version. But the "from" parameter should end up as "From=...", see https://paste.ubuntu.com/p/ydTWpBq9yS/14:18
kjetilhothe from in a route, not routing policy14:19
slyonah yes, then you're right14:20
slyondid you run 'netplan generate' before? to produce the latest files. Also this only applies only if using the 'networkd' renderer (the default). Do you use NetworkManager renderer?14:20
kjetilhodoh.  I was running netplan apply ~kjetilho/login-osl2.yaml14:20
kjetilhothat really should cause an error14:20
kjetilho(or preferably - work)14:21
kjetilhothere we go, I got ip rules :)14:22
slyonnice!14:22
kjetilho(after copying my file to /etc/netplan14:22
kjetilhoI do wonder if PreferredSource is sufficient for me14:23

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!