routing traffic with netplan

curious877

New Member
Joined
Oct 4, 2022
Messages
1
Reaction score
0
Credits
13
Hi there.

i have 2 virtual machines both ubuntu 22.04. All network interfaces are private.

first vm has two private lan:

172.16.0.2
192.168.100.2

second vm has two private lan:

192.168.100.4
192.168.102.4

using netplan how can i redirect traffic from vm1 192.168.100.2 to vm2 192.168.102.4 ? as far i got i need to use address 192.168.100.4 ?

vm1 yaml
Code:
---
network:
  version: 2
  renderer: networkd
  ethernets:
    eth1:
      dhcp4: true
    eth2:
      addresses:
      - 172.16.0.2/24
    eth3:
      addresses:
      - 192.168.100.2/24
      routes:
      - to: 192.168.102.4/24
        via: 192.168.100.4/24
        on-link: true

vm2 yaml

Code:
---
network:
  version: 2
  renderer: networkd
  ethernets:
    eth1:
      addresses:
      - 192.168.100.4/24
      routes:
      - to: 192.168.102.4/24
        via: 192.168.100.4/24


    eth2:
      addresses:
      - 192.168.102.4/24
      routes:
      - to: 192.168.100.2/24
        via: 192.168.102.4/24
 
Last edited:


Latest posts

Top