it-artikel:linux:how-to-configure-or-add-a-static-ipv6-address-to-your-ipv4-ubuntu-server-with-bridged-interfaces

How to configure or add a static IPv6 address to your IPv4 Ubuntu Server with bridged interfaces?

I ran a UBUNTU Server 14.04/16.04 LTS on a computer on a small SOHO as an router/firewall, using two network interfaces. One is towards the internet, one for internal (LAN) use.

[PCs]==(LAN)==>[UBUNTU Server/Router]==(DMZ)==>[ISP Router]===>((Internet))
               ^                    ^
               |                    |
               |                    +-- external ethernet interface "enp5s8" or eth1
               |                    
               +-- internal (bridged) ethernet interface "br0" on "enp1s0" or eth0

On Servers in general, especially on the internal interface (enp1s0) i prefer a static IP configuration for IPv4 and IPv6 using private IP adresses / ULA (unique local address).

On the WAN/Internet-Side Interface i need to use DHCP, since in 2020 lots of ISPs often wont allow static IP anymore. Neither IPv4 nor IPv6 (like cheap arse Vodafone/Unitymedia, which I REALLY DONT RECOMMEND!). These ISP often just offer you “DS lite” or “dual stack lite” these days. This often means, you'll only receive a dynamic IPv6 address and NO IPv4 ADDRESS at all (on the WAN side of the ISP router).

Of course, on the LAN Side of the ISP Router (i call it DMZ in this scenario) we'll often still receive unrouteable dynamic private IPv4 addresses and a (supposedly routeable) dynamic IPv6 address for every connected device.

However often these ISPs wont offer us enough control over our own LAN, over how we want to manage the IP adresses, the assignment, the DNS, hostnames etc, so this one of many reasons why i prefer my own Linux Server/Router/Gateway/Firewall between the LAN and the ISP. This is of course way more complex, but THIS IS MY HOUSE! THESE ARE MY RULES! Keep your ISP out of your private LAN.

So to achieve all that, we start with configuring the network interfaces on our Linux Server, using UBUNTU 16.04 LTS in this example.

DEPRECATED: Since UBUNTU 18.04 LTS the way to configure the network through configuration files was switched to “netplan”. /etc/network/interfaces is no longer supported! see man netplan or one of my more modern UBUNTU Server installation manual to learn how its done there.

Network Configuration:

My ISPs routers LAN Interface has 192.192.178.1 as a fixed IPv4 address.

My Servers external ethernet interface “enp5s8” is supposed to be set to DHCP. However in this case i use a fixed IPv4 address of 192.192.178.20. Because i can.

The LAN Interface of the Linux Server i defined to get 192.192.0.7 and fd00:dead:beef:affe::7 , both as fixed/manualy configured using the /etc/network/interfaces configuration file.

NOTE the weird looking br0:0 configurations! Since just yet the networking configuration scripts/tools in Debian/Ubuntu seem not to support dual stack (ipv4 and ipv6 configurations) i was required to use “an alias” interface name instead. Strangely enough, this will NOT create the virtual br0:0 interface, but will bind the IPv6 address to the existing br0 interface as well, what we wanted in the first place.

This is how the file looks like for this case:

/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
 
source /etc/network/interfaces.d/*
 
# The loopback network interface
auto lo
iface lo inet loopback
 
###############################
# Internal LAN NIC - onboard - enp1s0
#
iface enp1s0 inet manual
 
###############################
# USB tethered emergency phone Internet NIC - enp0s19f2u3i and enp0s19f2u4
#
auto enp0s19f2u3
auto enp0s19f2u4 
iface enp0s19f2u3 inet dhcp
iface enp0s19f2u4 inet dhcp
 
 
###############################
# Internet NIC - 1gbps realtek pci - enp5s8
#
auto enp5s8
#iface enp5s8 inet dhcp
iface enp5s8 inet static
	address 192.168.178.20
	gateway 192.168.178.1
 
#	dns-nameservers 8.8.8.8
#	dns-nameservers 1.1.1.1
	dns-search lan transfer
 
 
###############################
# Internal LAN Bridge Interface on enp1s0
#
auto br0
#iface br0 inet dhcp
iface br0 inet static
	address 192.168.0.7
	network 192.168.0.0
	netmask 255.255.255.0
	#gateway 192.168.0.1
	bridge_ports enp1s0
        bridge_stp off
        bridge_fd 0
        bridge_maxwait 0
 
	dns-nameservers 192.168.0.7
	dns-search lan transfer
 
auto br0:0
iface br0:0 inet6 static
	address fd00:dead:beef:affe::7
	netmask 64
 
	dns-nameservers fd00:dead:beef:affe::7
###############################

I hope this helps someone.

it-artikel/linux/how-to-configure-or-add-a-static-ipv6-address-to-your-ipv4-ubuntu-server-with-bridged-interfaces.txt · Last modified: 2022-08-31 12:30 by 127.0.0.1