Hey all! I am currently using a spare PC I had lying around as a homeserver that was working phenomenally for me so far. Recently, I came up with an idea: if I’m already using a PC as a server, why not use the PC as a router as well? I’m living alone, so I don’t think I would overload the computer at all, and I think it’d make a fun experiment. So far, I’ve been trying to do it using this guide, but it’s outdated and doesn’t work anymore (I have issues with the DNS). Also, I believe it’s a bit opinionated. The ones that are up-to-date are not targetting Fedora, but Ubuntu, Debian, or other options. So far I believe these are the steps I’d have to follow:
- Create a ppoe interface (not sure what for).
- Set up the firewall.
- Set up the DHCP server.
- Set up the DNS server.
- Set up the Wifi AP.
Given that Fedora ships with a Firewall already, I believe I can skip step 2. For the rest of the steps, though, I’m having trouble finding a proper guide. Is there any material for this?
Edit: I’d prefer it to be targetting Fedora Server.
Edit 2: I have opened a new thread here as suggested by the great @vgaetera. In the meanwhile, let me post (for anyone else who might find it useful) the instructions posted before.
Edit 3: Updated the instructions. Got it to work except for the firewall!
Edit 4: Full instructions. It works beautifully except for accessing the Cockpit (and maybe other internal services, I haven’t touched the firewall at all except for what is written here):
Direct PPPoE, no VLAN:
# WAN
WAN_DEV="enp0s31f6"
WAN_NAME="wanDIGIvlan20"
PPPOE_USER="test"
PPPOE_PASS="12345678"
sudo dnf install NetworkManager-ppp NetworkManager-adsl
sudo nmcli connection add \
type pppoe \
ifname "${WAN_NAME}" \
pppoe.parent "${WAN_DEV}$" \
username "${PPPOE_USER}" \
password "${PPPOE_PASS}" \
connection.zone external
sudo nmcli connection up "${WAN_NAME}" #this takes a few tries.
# WLAN5G
WIFI_SSID="test"
WIFI_PSK="12345678"
WIFI_DEV="wlp4s0"
sudo nmcli connection delete wlan
sudo nmcli connection add \
type wifi \
ifname "${WIFI_DEV}" \
con-name wifi-"${WIFI_DEV}-5G" \
wifi.mode ap \
wifi.band a \
wifi.ssid "${WIFI_SSID}" \
wifi-sec.group ccmp \
wifi-sec.pairwise ccmp \
wifi-sec.proto rsn \
wifi-sec.key-mgmt wpa-psk \
wifi-sec.psk "${WIFI_PSK}" \
ipv4.method shared \
ipv4.addresses 192.168.1.1/24 \
ipv6.method shared \
ipv6.addresses 2001:db8:1::1/64 \
connection.zone internal
sudo nmcli connection up wifi-"${WIFI_DEV}-5G"
# WLAN
WIFI_SSID="test"
WIFI_PSK="12345678"
WIFI_DEV="wlp4s0"
sudo nmcli connection delete wlan
sudo nmcli connection add \
type wifi \
ifname "${WIFI_DEV}" \
con-name wifi-"${WIFI_DEV}" \
wifi.mode ap \
wifi.band bg \
wifi.ssid "${WIFI_SSID}" \
wifi-sec.group ccmp \
wifi-sec.pairwise ccmp \
wifi-sec.proto rsn \
wifi-sec.key-mgmt wpa-psk \
wifi-sec.psk "${WIFI_PSK}" \
ipv4.method shared \
ipv4.addresses 192.168.1.1/24 \
ipv6.method shared \
ipv6.addresses 2001:db8:1::1/64 \
connection.zone internal
sudo nmcli connection up wifi-"${WIFI_DEV}"
PPPoE over VLAN:
# WAN
VLAN_DEV="enp0s31f6"
VLAN_NAME="vlanDIGI20"
WAN_NAME="wanDIGIvlan20"
VLAN_VID="20"
PPPOE_USER="test"
PPPOE_PASS="12345678"
sudo dnf install NetworkManager-ppp NetworkManager-adsl
sudo nmcli connection add \
type vlan \
ifname "${VLAN_NAME}" \
vlan.parent "${VLAN_DEV}" \
vlan.id "${VLAN_VID}" \
sudo nmcli connection add \
type pppoe \
ifname "${WAN_NAME}" \
pppoe.parent "${VLAN_NAME}$" \
username "${PPPOE_USER}" \
password "${PPPOE_PASS}" \
connection.zone external
#unneeded: sudo nmcli connection up "${VLAN_NAME}"
sudo nmcli connection up "${WAN_NAME}" #this takes a few tries.
# WLAN5G
WIFI_SSID="test"
WIFI_PSK="12345678"
WIFI_DEV="wlp4s0"
sudo nmcli connection delete wlan
sudo nmcli connection add \
type wifi \
ifname "${WIFI_DEV}" \
con-name wifi-"${WIFI_DEV}-5G" \
wifi.mode ap \
wifi.band a \
wifi.ssid "${WIFI_SSID}" \
wifi-sec.group ccmp \
wifi-sec.pairwise ccmp \
wifi-sec.proto rsn \
wifi-sec.key-mgmt wpa-psk \
wifi-sec.psk "${WIFI_PSK}" \
ipv4.method shared \
ipv4.addresses 192.168.1.1/24 \
ipv6.method shared \
ipv6.addresses 2001:db8:1::1/64 \
connection.zone internal
sudo nmcli connection up wifi-"${WIFI_DEV}-5G"
# WLAN
WIFI_SSID="test"
WIFI_PSK="12345678"
WIFI_DEV="wlp4s0"
sudo nmcli connection delete wlan
sudo nmcli connection add \
type wifi \
ifname "${WIFI_DEV}" \
con-name wifi-"${WIFI_DEV}" \
wifi.mode ap \
wifi.band bg \
wifi.ssid "${WIFI_SSID}" \
wifi-sec.group ccmp \
wifi-sec.pairwise ccmp \
wifi-sec.proto rsn \
wifi-sec.key-mgmt wpa-psk \
wifi-sec.psk "${WIFI_PSK}" \
ipv4.method shared \
ipv4.addresses 192.168.1.1/24 \
ipv6.method shared \
ipv6.addresses 2001:db8:1::1/64 \
connection.zone internal
sudo nmcli connection up wifi-"${WIFI_DEV}"
Firewall:
Doesn’t give me access to the Fedora Cockpit for some reason…
# Firewall
sudo tee /etc/NetworkManager/conf.d/99-local.conf << EOF > /dev/null
[main]
firewall-backend=none
EOF
sudo systemctl restart NetworkManager.service
sudo firewall-cmd --permanent --zone=internal --add-service=dhcp
sudo firewall-cmd --permanent --zone=internal --add-service=dns
sudo firewall-cmd --permanent --new-policy=internal-external
sudo firewall-cmd --permanent --policy=internal-external --set-target=ACCEPT
sudo firewall-cmd --permanent --policy=internal-external --add-ingress-zone=internal
sudo firewall-cmd --permanent --policy=internal-external --add-egress-zone=external
sudo firewall-cmd --permanent --policy=internal-external --add-rich-rule="rule tcp-mss-clamp value=pmtu"
sudo firewall-cmd --permanent --policy=internal-external --add-rich-rule="rule family=ipv4 masquerade"
sudo firewall-cmd --permanent --policy=internal-external --add-rich-rule="rule family=ipv6 masquerade"
sudo firewall-cmd --reload