How to bridge two interfaces with netplan

5,451

https://netplan.io/examples

Sample of two interfaces :

            ethernets:
            eth0:
            addresses:
                - 192.168.2.2/24
            routes:
            - to: 0.0.0.0/0
                via: 192.168.2.1
                metric: 100
                table: 101
            routing-policy:
            - from: 192.168.2.0/24
                table: 101
            eth1:
            addresses:
                - 192.168.22.2/24
            gateway4: 192.168.22.1
            nameservers:
                addresses: [192.168.22.1]
Share:
5,451

Related videos on Youtube

Amir Dallal
Author by

Amir Dallal

Updated on September 18, 2022

Comments

  • Amir Dallal
    Amir Dallal over 1 year

    I want to setup a gateway on an Ubuntu 18.04 machine with 2 eth ports - ETH1 - WAN connection, connected to my corporate network with DHCP ETH0 - LAN connection, connected to my laptop statically

    I need to use netplan.

    Please assist with sample configuration. thank you!

    • Doug Smythies
      Doug Smythies over 5 years
      does this help?
    • Amir Dallal
      Amir Dallal over 5 years
      Thanks Doug. I am just not sure how to route my LAN traffic thru my WAN interface. What are the routing rules and iptables, and how do I configure it using netplan? Thanks again!
    • Doug Smythies
      Doug Smythies over 5 years
      I don't know that any special routing rules are required, I don't have any. A simple router iptables rules set (no firewall stuff) example is here.