Re: (Arch)Linux source routing help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi,

On 09.11.22 16:35, Pascal wrote:
>               \                     /
>       +--------\-------+   +-------/-------+
>       |free GW         |   |corporate GW   |
>       |192.168.144.254 |   |10.10.10.254/24|
>       +--------|-------+   +-------|-------+
>                \                  /
> +---------------|-----------------|------+
> |HOST  |wlan0           |  |eth0         |
> |      |192.168.144.1/24|  |10.10.10.1/24|
> |      +----------------+  +-------------|
> |                                        |
> |      +-----------------+               |
> |      |tap0             |               |
> |      |192.168.11.254/24|               |
> |      +--------|--------+               |
> |               |                        |
> | +-------------|--------+               |
> | |VM  |eth0             |               |
> | |    |192.168.11.1/24  |               |
> | |    +-----------------|               |
> | +----------------------+               |
> +----------------------------------------+

you're going to need source policy routing.

I.e. create a new routing table with the default route going through
your free GW:

ip route add default via 192.168.144.254 table 10

To check if it's in place:

ip route show table 10

And then to direct your VM traffic through that, you need a routing
rule:

ip rule add from 192.168.11.0/24 lookup 10 priority 10

To check if it's in place:

ip rule show

The main routing table usually has a priority of 32766 and to place
overrides you need to insert rules with a lower priority number, they
are processed from low to high.

For a permanent setting, you can add your additional routing tables to
/etc/iproute2/rt_tables and even give them a name there.
The routes and routing rules themselves need to be inserted separately,
I don't know from the top of my head if systemd-networkd can do that for you,
otherwise you're going to need some sort of Oneshot post-boot service
that sets it up.

For more details you might want to consult the ip-rule and ip-route
man pages.


Cheers

-- 
Thore "foxxx0" Bödecker

GPG ID: 0xD622431AF8DB80F3
GPG FP: 0F96 559D 3556 24FC 2226  A864 D622 431A F8DB 80F3

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux