Score:0

Netplan with Two Gateway Subnets on Same Port

zm flag

Trying to configure an Ubuntu 18.04 machine with two IP addresses on different subnets on one ethernet port, each with a gateway so port forwarding works from different routers.

This was based on the Netplan documentation. The two IPs work, but no inbound or outbound internet access.

network:
  version: 2
  renderer: networkd
  ethernets:
    enp6s0:
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]
      addresses:
        - 192.168.13.200/24
        - 192.168.1.100/24
      routes:
        - to: 0.0.0.0/0
          via: 192.168.13.1
          metric: 200
        - to: 0.0.0.0/0
          via: 192.168.1.1
          metric: 300
    enp8s0:
      addresses: [192.168.2.100/24]
      dhcp4: false
      dhcp6: false

This next attempt was based on another answer, but when I try this I get an error: "ERROR: enp6s0: NetworkManager does not support non-default routing tables"

network:
  version: 2
  renderer: networkd
  ethernets:
    enp8s0:
      addresses: [192.168.2.100/24]
      dhcp4: false
      dhcp6: false
    enp6s0:
      dhcp4: no
      dhcp6: no
      addresses: 
        - 192.168.1.100/24
        - 192.168.13.200/24
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]
      routes:
        - to: 0.0.0.0/0
          via: 192.168.1.1
          metric: 150
        - to: 0.0.0.0/0
          via: 192.168.13.1
          metric: 150
          table: 102
      routing-policy:
        - from: 192.168.13.0/24
          table: 102
        - to: 192.168.13.0/24
          table: 102
    enp7s0:
      dhcp4: yes
guiverc avatar
cn flag
Please clarify your release; you mention two different products. Ubuntu releases using the *year* format (eg. Ubuntu Core 18 Server) are different to those using the *year.month* format (eg. Ubuntu 18.04 LTS Server). Which are you using? the 18 you mention in your question, or the 18.04 you tagged? 18 != 18.04
us flag
Both of these netplan configurations should work to give you Internet access, with some differences in behavior. How have you established that the two IPs "work"? Are you able to ping the router IPs? Also, in your second example you show an error message about NetworkManager but nothing in the configuration you're pasting uses the NetworkManager backend. Are there other files under /etc/netplan not shown in your question?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.