Multiple ip on an interface with netplan

5,125

Your netplan config refers to an interface prox, which doesn't exist on your system.

Replace it with eno3 - the actual interface name on the system - and then reapply your netplan configs.

Share:
5,125

Related videos on Youtube

leyou
Author by

leyou

abc

Updated on September 18, 2022

Comments

  • leyou
    leyou over 1 year

    I have a server that uses multiple ip for proxies with Squid.

    I'm setting it up on a new server, but with Ubuntu 18 I need to rewrite /etc/network/interfaces for netplan.

    On the old server /etc/network/interfaces is like this:

    auto lo
    iface lo inet loopback
    
    auto eth0
    iface eth0 inet static
        address 1.2.3.4
        netmask 255.255.255.0
        network 1.2.3.0
        broadcast 1.2.3.255
        gateway 1.2.3.254
    
    auto eth0:0
    iface eth0:0 inet static
            address 5.6.7.8
            netmask 255.255.255.255
            broadcast 5.6.7.8
    

    It has eth0:1, eth0:2, etc.

    Which gives this in ifconfig -a:

    eth0      Link encap:Ethernet  HWaddr 0c:c4:7a:79:37:54
              inet addr:1.2.3.4  Bcast:1.2.3.255  Mask:255.255.255.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:3149890977 errors:0 dropped:0 overruns:0 frame:0
              TX packets:6290843324 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:1281967559959 (1.2 TB)  TX bytes:7746334018193 (7.7 TB)
    
    eth0:0    Link encap:Ethernet  HWaddr 0c:c4:7a:79:37:54
              inet addr:5.6.7.8  Bcast:5.6.7.8  Mask:255.255.255.255
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    

    I tried rewriting it different ways in /etc/netplan/conf.yaml, for example like this:

    network:
      version: 2
      renderer: networkd
      ethernets:
        prox:
          addresses:
            - 1.2.3.4/24
            - 5.6.7.8/32
          gateway4: 1.2.3.254
    

    then run "netplan try" but only 1.2.3.4 appears in ifconfig.

    ip -4 addr list shows:

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
    4: eno3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
        inet 1.2.3.4/24 brd 1.2.3.255 scope global eno3
           valid_lft forever preferred_lft forever
    
    • Thomas Ward
      Thomas Ward over 5 years
      Is prox an actual interface name? It looks like the interface name you need to use in your yaml is eno3... Try adjusting the yaml config to use eno3 instead of prox and try again.
    • leyou
      leyou over 5 years
      Annnnnnd... I feel stupid. Thank you for the help.