User Tools

Home Server Networking setup

I assume you have already figured out how many network connections you need on your home server, and which IP address to assign to them.

You will need at least two network connections on your home server. I mean at least two physical network Ethernet card. You could use one WiFi link, but i strongly advise against such choice for stability and bandwith reasons.

Depending on your setup, you might have more than two NICs (Nework Interface Cards) and they might be PCI/Express or USB-3/C.

For more information on your network setup, refer to this page and this page.

The Simple Approach

This setup is provided according to the simple approach.

I will assume you have the following network assets:

  • One internal NIC on the LAN, called eno1
  • One internal NIC on the main ISP, wired point-to-point to your main ISP, called enp2s0
  • One USB NIC for additional failsafe remote access, directly wired to the failback ISP, called enp0s20f0u9u4c2

Without commenting on the weird naming of the ethernet devices, let's see the IP assignments (you can list all your network devices under /sys/class/net):

  • LAN is 10.20.30.0/24. Home server IP on LAN is 10.20.30.1
  • Main ISP is 192.168.0/24, and you will want a static IP like 192.168.0.10, default gateway to 192.168.0.1
  • Failback ISP is 192.168.1.0/24, and you will want a static IP like 192.168.1.10 and gateway is 192.168.1.254 (not set as default)

The Advanced Approach

This setup is provided according to the advanced approach.

I will assume you have the following network assets:

  • One internal NIC on the LAN (default gateway to the main ISP), called eno1
  • One internal NIC on the DMZ, wired point-to-point to your opnSense, called enp2s0
  • One USB NIC for additional failsafe remote access, directly wired to the failback ISP, called enp0s20f0u9u4c2

Without commenting on the weird naming of the ethernet devices, let's see the IP assignments (you can list all your network devices under /sys/class/net):

  • LAN is 10.20.30.0/24. Home server IP on LAN is 10.20.30.1, default gateway&DNS 10.20.30.254
  • DMZ is 10.20.254/24. Home server IP on DMZ is 10.20.254.1
  • Failback ISP is 192.168.1.0/24, and you will want a static IP like 192.168.1.10 and gateway is 192.168.1.254 (not set as default)

Gentoo Network Configuration

Since i am going all static on the home server, network setup is simple and traightforward. I will be using the basic Netifrc scripts from Gentoo, you should check this page for additional details. You will not need NetworkManager for the home server.

If you plan to use WiFi with WPA or more complex setups (PPP or such) please refer to the Gentoo Handbook.

You should double check the actual names of your network devices under /sys/class/net of course and identify them properly or the following will not work for you.

The choice to go fully static instead of using DHCP to get IP addresses on the ISPs side of network is to enable SNAT instead of MASQUERADING later on.

The first step is to populate your /etc/conf.d/net configuration file, follow this example and adapt to your needs:

net
# LAN on eno1
config_eno1="10.20.30.1/24"
routes_eno1="default via 10.20.30.254" # default route here only for advanced approach!

# The following ONLY for advanced approach!
# DMZ on eno1
config_enp2s0="10.20.254.1/24"
routes_enp2s0=""

# The following ONLY for simple approach!
# Main ISP on eno1
#config_enp2s0="192.168.1.10/24"
#routes_enp2s0="default via 192.168.1.1"

# Failback ISP on enp0s20f0u9u4c2
config_enp0s20f0u9u4c2="192.168.1.10/24"

Now, create the needed symlinks and start the networks:

for i in eno1 enp2s0 enp0s20f0u9u4c2
do
    ln -s /etc/init.d/net.lo /etc/init.d/net.$i
    rc-upate add net.$i default
done

Now you need to tell Gentoo that only one of these needs to be up for networking to be ready. If you don't do this, then all your services will fail as soon as one goes down. Edit the file /etc/rc.conf and change the following line to “NO”:

rc_depend_strict="NO"

Reboot your home server and ensure all networks are up and running by pinging the ISP gateways and some internal network host.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information