I have a network like this:
network structure picture
I need to configure the Kylin laptop to let other clients(PC, phones) access internet. I have 3 USB ethernet adapter (enx000ec6c5afc1, enx00e04c68009b, enx00e04ca01003) pluged in the Kylin. I want all the clients to be in the same subnet (to use RPI as second gateway).
So I tried to bridge the 3 USB eth adapter together as br-lan, and configure dhcp and iptables to it.
This is my configuration:
# /etc/network/interfaces
auto br-lan
iface br-lan inet static
bridge_ports enx000ec6c5afc1 enx00e04c68009b enx00e04ca01003
address 192.168.1.1/24
# /etc/dhcp/dhcpd.conf
# I already bind the MACs of AP, PC, RPI to static IPs
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.5 192.168.1.240;
option domain-name-servers 8.8.8.8;
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
option broadcast-address 192.168.1.255;
default-lease-time 86400;
max-lease-time 259200;
}
iptables -A FORWARD -i enp1s0 -o br-lan -j ACCEPT
iptables -A FORWARD -i br-lan -o enp1s0 -j ACCEPT
iptables -A POSTROUTING -o enp1s0 -j MASQUERADE
The dhcpd seems working fine, all the clients can get correct IPs. But either PC or RPI cannot access internet. Any client behind AP seems always fine.
Before all this I just use different subnets for different USB adapters (PC: 192.168.2.X, AP: 192.168.1.X, RPI: 192.168.4.X), then configure dhcp/iptables for each subnet/adapter. It works fine.
Is there anything I configured wrong?
Lee-7723 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.