Quantcast
Channel: Active questions tagged 22.04 - Ask Ubuntu
Viewing all articles
Browse latest Browse all 4489

How to set up netplan with two network cards with different static ip/gateway

$
0
0

our IT guy has set up the network for our Ubuntu 22.04 server with:

  • enp1so: the card to be used for the outer world.
    • it has its own static IP (147.100.157.194 subnet mask 255.255.255.248 /29) and GTW (147.100.157.193)
    • it should deal outgoing traffic too (like e.g. for apt updates)
  • enp69s0: the card for the "management" of the server (SSH, restricted in VPN)
    • it has its own IP (147.100.157.202 subnet mask 255.255.255.248 /29) and GTW (147.100.157.201)
    • only used to connect to the server

The problem is that our IT guy doesn't speak Linux and I don't speak networking.

I have tried a lot to understand "routes", "tables", "routing-policy", "from" and "to".. but it goes well above my understanding...

I just understood I need to set up a yaml file on /etc/netplan but all my efforts resulted in some problems (if not the loss of the server).

How should I set a minimal yaml file that serve the purposes above?

Would this one work or break my server connection again?

network:  version: 2  renderer: networkd  ethernets:    enp1s0:      # PROD card/IP (https and NFS only)      dhcp4: no      addresses:        - 147.100.157.194/29      routes:        - to: default          via: 147.100.157.193      nameservers:          search: [inra.local]          addresses: [147.100.157.242, 147.100.166.31]    enp69s0:      # MGM card/ip (SSH from VPN only)      dhcp4: no      addresses:        - 147.100.157.202/29

Currently we have the following broken configuration. "Broken" because the server can be reached, but it can't start a connection with the outer world (e.g. for the apt updates):

Broken configuration:
network:  version: 2  renderer: networkd  ethernets:    enp1s0:# PROD card/IP (https only)      dhcp4: no      addresses:        - 147.100.157.194/29#      gateway4: 147.100.157.193      routes:        - to: 0.0.0.0/0#        - to: 147.100.157.192/29          via: 147.100.157.193          table: 100        - to: 147.100.157.224/29          via: 147.100.157.193          table: 100        - to: default          via: 147.100.157.193          table: 100      routing-policy:        - from: 147.100.157.194/29          table: 100      nameservers:          search: [inra.local]          addresses: [147.100.157.242, 147.100.166.31]    enp69s0:# MGM card/ip (SSH from VPN only)#      activation-mode: off      dhcp4: no      addresses:        - 147.100.157.202/29#      gateway4: 147.100.157.201      routes:#        - to: 147.100.157.200/29        - to: 0.0.0.0/0          via: 147.100.157.201          table: 200      routing-policy:        - from: 147.100.157.202/29          table: 200      nameservers:          search: [inra.local]          addresses: [147.100.157.242, 147.100.166.31]

[EDIT]

Or perhaps this other option (from this page where it is written "This enables clients on either network to connect to the other and allow the response to come from the correct interface." that scared me a bit) :

network:  version: 2  renderer: networkd  ethernets:    enp1s0:      # PROD card/IP (https only)      dhcp4: no      addresses:        - 147.100.157.194/29      routes:        - to: default          via: 147.100.157.193        - to: 147.100.157.0/29          via: 147.100.157.193          table: 100      routing-policy:        - from: 147.100.157.0/29          table: 100                nameservers:          search: [inra.local]          addresses: [147.100.157.242, 147.100.166.31]    enp69s0:      # MGM card/ip (SSH from VPN only)      dhcp4: no      addresses:        - 147.100.157.202/29      routes:        - to: 147.100.157.0/29          via: 147.100.157.201          table: 200      routing-policy:        - from: 147.100.157.0/29          table: 200

Viewing all articles
Browse latest Browse all 4489

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>