I am trying to configure the wifi and ethernet ports on a linux box in a non-standard way. I have never touched this kind of stuff before, so please excuse my naivety. I have basically just YOLO'd my way into the documentation head first and have made it pretty far and got it to work. But there is still some oddities and I don't fully understand why it works. So if I could, I would like to describe this fully, then anyone more knowledge please correct me and explain where I did something wrong.
I have a mini pc that has 2 ethernet ports and 1 wifi. I am trying to configure it so that internet comes in on one ethernet port, then is broadcast out on both WIFI and the other ethernet port. Basically configuring it to work like a wifi router.
So.
Here is my /etc/netplan/01-network-manager-all.yaml
network:
version: 2
renderer: networkd
ethernets:
enp0s31f6:
dhcp4: true
enp1s0:
addresses:
- 192.168.2.1/24
dhcp4: false
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
search: []
wlp2s0:
addresses:
- 10.42.0.1/24
dhcp4: false
nameservers:
addresses:
- 8.8.8.8
- 8.8.4.4
search: []
bridges:
br0:
interfaces: [enp0s31f6, enp1s0, wlp2s0]
dhcp4: true
addresses:
- 100.80.0.1/24
parameters:
stp: false
forward-delay: 0
Here is my /etc/default/dhcpd.conf
INTERFACES="enp1s0 wlp2s0"
Here is my /etc/dhcp/dhcpd.conf
option domain-name "whatever.you.want";
option domain-name-servers 8.8.8.8, 8.8.4.4;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
log-facility local7;
subnet 10.42.0.1 netmask 255.255.255.0 {
range 10.42.0.101 10.42.0.200;
option subnet-mask 255.255.255.0;
option routers 10.42.0.1;
option broadcast-address 10.42.0.255;
}
subnet 100.80.0.1 netmask 255.255.255.0 {
range 100.80.0.101 100.80.0.200;
option subnet-mask 255.255.255.0;
option routers 100.80.0.1;
option broadcast-address 100.80.0.255;
}
subnet 192.168.2.1 netmask 255.255.255.0 {
range 192.168.2.101 192.168.2.200;
option subnet-mask 255.255.255.0;
option routers 192.168.2.1;
option broadcast-address 192.168.2.255;
}
I have run all the correct commands (I think)
sudo netplan --debug generate
sudo netplan apply
sudo systemctl restart isc-dhcp-server
sudo systemctl enable isc-dhcp-server
sudo systemctl status isc-dhcp-server
So this works. However I know I probably did something wrong. It also has quirks. Randomly seemed to break a few times with an error popping up that said nothing. Also when I try to plug it into a certain 4G hotspot it just does not work, however that 4G hotspot successfully delivers internet to other devices, it also receives internet just fine from other ethernet sources.
So is this configured correctly? How would I change these files to configure it correctly?
Also for good measure my ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 100.80.0.1 netmask 255.255.255.0 broadcast 100.80.0.255
inet6 fe80::14a8:83ff:fe5b:a89c prefixlen 64 scopeid 0x20<link>
ether 16:a8:83:5b:a8:9c txqueuelen 1000 (Ethernet)
RX packets 666051 bytes 252795968 (252.7 MB)
RX errors 0 dropped 59 overruns 0 frame 0
TX packets 127129 bytes 14963222 (14.9 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:01:2e:84:6a:13 txqueuelen 1000 (Ethernet)
RX packets 691307 bytes 261567317 (261.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 242102 bytes 38886894 (38.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16 memory 0xdf300000-df320000
enp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.255
ether 00:01:2e:84:6a:14 txqueuelen 1000 (Ethernet)
RX packets 111556 bytes 21621626 (21.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 523333 bytes 80568249 (80.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 11909999 bytes 4519986237 (4.5 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11909999 bytes 4519986237 (4.5 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.42.0.1 netmask 255.255.255.0 broadcast 10.42.0.255
ether 00:24:d6:fc:f5:e9 txqueuelen 1000 (Ethernet)
RX packets 87180 bytes 10348796 (10.3 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 134948 bytes 148087795 (148.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0