Q: Hello everyone. Ubuntu 20.04 Server I’m asking for help setting up Netplan.
You need to configure the Netplan settings so that all responses go through the network connection through which the requests came.
2 Internet providers.
2nd network cards.
Each one accesses the Internet through its own router (its own provider).
Cards with static IP:
eth1 – 192.168.1.11 gate1 – 192.168.1.1
eth2 – 192.168.100.12 gate2 – 192.168.100.1
Did you ask? We answer!
You need to make sure that the package iproute2 is installed on your system.
apt install iproute2
Edit /etc/iproute2/rt_tables, add these lines
101 101 102 102
Then edit /etc/netplan/ in my case it’s a file 99-netplan.yaml
network: version: 2 renderer: networkd ethernets: eth1: addresses: - 192.168.1.11/24 dhcp4: no nameservers: addresses: - 192.168.1.1 - 8.8.8.8 routes: - to: default via: 192.168.1.1 - to: 192.168.1.11/24 via: 192.168.1.1 table: 101 routing-policy: - from: 192.168.1.11/24 table: 101 eth2: addresses: - 192.168.100.12/24 dhcp4: no nameservers: addresses: - 192.168.100.1 - 8.8.4.4 routes: - to: 192.168.100.0/24 via: 192.168.100.1 table: 102 routing-policy: - from: 192.168.100.0/24 table: 102
Check config of netplan
netplan generate
If there are no errors, then enter the command
netplan apply
That’s all. Policy based routing is configured.
Similar Posts:
- how to setup source based (policy based) routing on debian / ubuntu
- How to change static ip address on Ubuntu server 18.04
- CSF: disable icmp ping
- How to use netstat command
- How to block SASL login attacks in zimbra using csf
301