Results 1 to 8 of 8

Thread: Configuring Netplan

  1. #1
    Join Date
    Sep 2020
    Beans
    2

    Configuring Netplan

    Hi there,

    Just upgraded to 20.04 having had the server running 18.04 - I did a clean install. I also changed my router which came with a new subnet and I was hoping someone might be able to help me configure the Netplan to set a static IP.

    The router IP is 192.168.3.1, with its WAN IP being 192.168.1.200 with the overall networks default gateway being 192.168.1.1

    Realise this is probably more of a networking rather than Ubuntu specific question, but hope someone might be able to tell me if I need to use routing etc

    Code:
    # This file is generated from information provided by
    # the datasource.  Changes to it will not persist across an instance.
    # To disable cloud-init's network configuration capabilities, write a file
    # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
    # network: {config: disabled}
    network:    
    ethernets:        
    enp0s3:            
    dhcp4: false            
    addresses: [192.168.3.10/24]            
    gateway4: 192.168.1.1            
    nameservers:              
    addresses: [8.8.8.8,8.8.4.4]            
    routes:            
    - to: 192.168.1.1/24              
    via: 192.168.1.200
    Last edited by jarnold231; September 17th, 2020 at 10:40 AM.

  2. #2
    Join Date
    Aug 2020
    Location
    Denmark
    Beans
    29
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Configuring Netplan

    I think you need to specifiy how you would like the setup to be.

    Normally, your router would also be your default gateway - is there any reason this should not be the case here?

    The netplan site has a number of examples of routing configurations that you could also have a look at.

    Also, a generic remark is that the netplan .yaml file needs proper indentation, which you do not have in the codeblock in your post (but maybe your file is ok).
    Last edited by ameinild; September 17th, 2020 at 11:47 AM.
    Supermicro Server :: Atom C3558 (4) @ 2.2 GHz :: 32 GB DDR4-2400 :: 512 GB NVMe :: 4x 2 TB SSD @ RAID-Z
    Raspberry Pi 4 Server :: BCM2711 (4) @ 1.5 GHz :: 4 GB DDR4-3200 :: 32 GB MicroSD

  3. #3
    Join Date
    Sep 2020
    Beans
    2

    Re: Configuring Netplan

    Hi ameinild

    Structure should be:

    server [192.168.3.10] > router [192.168.3.1] > wanIP [192.168.1.200] > external unifi router [192.168.1.1] > internet

    understood and aware of proper indentation, my bad on editing my post.

  4. #4
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,392
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Configuring Netplan

    YAML is the config file format for netplan. If you don't post using "code tags", we cannot help.
    https://ubuntuforums.org/showthread....8#post12776168 explains code tags for this forum.

    Please just edit the original post, OP, to use code tags. Looks like you have, but had already screwed the formatting. Code tags are simple select/paste operations on Unix X/Windows systems. No need to touch fonts, sizes, colors, bold, or anything else, just wrap the code just like a "quote" or "bold" or "italics" tags. The Advanced Editor has a button, if you need it, but most of the time, I just use the 'quote' button and manually change 'quote' into 'code'.

  5. #5
    Join Date
    Aug 2020
    Location
    Denmark
    Beans
    29
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Configuring Netplan

    Quote Originally Posted by jarnold231 View Post
    server [192.168.3.10] > router [192.168.3.1] > wanIP [192.168.1.200] > external unifi router [192.168.1.1] > internet
    I still need to understand this setup, and why it has to be like this.

    Is this at home? A school? A company? Please provide a little more context.

    Also, what is the reason you can't connect directly to the subnet provided by the Unifi router at 192.168.1.1 - what is the reason you want another router in between?

    Again, normally you would "just" connect to your router (192.168.3.1) which is also your gateway/"default route", and this router will forward (NAT) the traffic to the next network and on to the internet.

    However, this looks like a "double NAT" setup, which might not be very efficient and cause problems. This is also why I ask the reason you need it this way? Thanks.
    Last edited by ameinild; September 17th, 2020 at 06:09 PM.
    Supermicro Server :: Atom C3558 (4) @ 2.2 GHz :: 32 GB DDR4-2400 :: 512 GB NVMe :: 4x 2 TB SSD @ RAID-Z
    Raspberry Pi 4 Server :: BCM2711 (4) @ 1.5 GHz :: 4 GB DDR4-3200 :: 32 GB MicroSD

  6. #6
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,392
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Configuring Netplan

    192.168.3.10 doesn't need to know anything more than to use the gateway 192.168.3.1.
    The router at 192.168.3.1 would have a gateway set to 192.168.1.1.

    That's the outbound NAT stuff.

    Simple. No need for any extra netplan route additions.

    It is any inbound connections that could get ugly, but that would only be due to routers usually having firewalls.
    Last edited by TheFu; September 17th, 2020 at 06:42 PM. Reason: s/so/set/

  7. #7
    Join Date
    Aug 2020
    Location
    Denmark
    Beans
    29
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Configuring Netplan

    Agree, so the netplan config in this case would be pretty textbook:

    Code:
    network:
      version: 2
      renderer: networkd
      ethernets:
        enp3s0:
          dhcp4: false
          addresses: [192.168.3.10/24]
          gateway4: 192.168.3.1
          nameservers:
            addresses: [8.8.8.8, 8.4.4.8]
    Also for future reference, I believe the statements 'gateway4:' and 'routes:' are mutually exclusive, since your 'gateway4' is the default route.
    Still, be aware of the possible inherent problems in a double NAT setup like this.
    Last edited by ameinild; September 17th, 2020 at 06:32 PM.
    Supermicro Server :: Atom C3558 (4) @ 2.2 GHz :: 32 GB DDR4-2400 :: 512 GB NVMe :: 4x 2 TB SSD @ RAID-Z
    Raspberry Pi 4 Server :: BCM2711 (4) @ 1.5 GHz :: 4 GB DDR4-3200 :: 32 GB MicroSD

  8. #8
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,392
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: Configuring Netplan

    I'd add:
    Code:
    dhcp6: false
    and disable IPv6 networking via grub too. IPv6 is a huge security failure if your infrastructure doesn't know how to properly firewall and secure those connections.

    Inside: /etc/default/grub
    Code:
    GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"
    Run sudo update-grub and reboot the box. Too bad the old /etc/sysctl.conf methods don't work anymore. Just more things that systemd broke besides name resolution, the fstab, and easy ways to for an fsck on the root file system without console access.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •