If it returns to a prompt without any errors, your file is readable. It works just fine with numbers, and you can always put a comment in the yaml file to document which interface is which, if you want to.Īfter you save your changes, you can run ‘sudo netplan generate’ to test the config. Then you can set the ‘table’ variable to ‘ispA’ instead of ‘1’. # Define your new/custom routing tables here: If you want to make the ‘table’ variable more readable, you can define them in the /etc/iproute2/rt_tables file like this: The ‘table’ variable (It’s in two places above) must be incremented for each publicly routed interface you set up. All networking changes will be made in this file. Note that changing the ‘renderer’ variable to ‘networkd’ will mean that Network Manager no longer has control of your configuration. #gateway4: # unset, since we configure the route below Renderer: networkd # change this from 'NetworkManager' if it's set. You can leave the backup in the /etc/netplan directory if you add a different extension to it like this:Ĭp 01-network-manager-all.yaml Yaml is a markup language “human friendly data serialization standard for all programming languages.” Make sure you backup your existing *.yaml file before you edit it. Be sure to follow the formatting exactly. This is the file I’ll be editing, but it doesn’t really matter what your file is called as long as it ends in. On my Ubuntu 18.04 system, there is a file in /etc/netplan named 01-network-manager-all.yaml. It’s possible to set up multiple interfaces exactly the same, but that is left as an exercise for the reader. We do this via the /etc/netplan/*.yaml files. If you don’t do this, incoming connections are never answered. This makes sure that requests hitting the IP address of the interface are replied to via that address, rather then through the default route (aka: the LAN). YMMV) in order to set up a separate routing table for the second interface. We use the iproute2 extensions built into Ubuntu (And Debian. Whatever you want to serve on the public IP address, this is how you can do it. Or maybe you just want to be able to ssh directly to your workstation from home, without forwarding a port on the main firewall. You’d like to run some services, perhaps the Apache web server, and serve them via the public IP address you have directly on your NIC, but still use the LAN connection for everything else. Your workstation/server has both a network connection to the local network with internet access, and a public IP address (or a second, different LAN/WAN/DMZ) on a separate interface. Warning: If you have a public IP address on your workstation, be sure to apply the proper firewall and security measures! Your workstation will be directly accessible from the Internet! If your workstation is compromised, an attacker will have a vector to your internal LAN though it.
In newer versions of Ubuntu (I’m using 18.04 LTS) the interfaces file and the ifup/ifdown scripts have been replaced with the new and shiny Netplan! The bad news is my previous method won’t work any more.
UBUNTU 14.04.2 DEFAULT INETRFACES FILE HOW TO
In my previous article on the subject, I showed you how to configure multiple default routes in Ubuntu by using the /etc/network/interfaces file.