I'm fairly new to Linux networking, so excuse me if this is a trivial question. I'm trying to setup a local network with a (WiFi) router that is connected via an USB-Ethernet adapter. Simultaneously I want to use the inbuild-ethernet interface for normal internet activity. The setup is something like this:
+------------+ +-----------+ +------------+
| | | | | Router/ |
| Office-DHCP+<----->+ Local +<-------->+ Local DHCP |
| | | | | |
+------------+ +-----------+ +-----+------+
| | ^
| Apache | |
| Ser^er | ^
| | +-----+------+
+-----------+ | |
| Smartphone |
| |
+------------+
My idea is, that the local network (everything connected to the Router, either Wifi or ethernet) can connect to an apache webserver running on my local machine. Yet the normal internet traffic of my local machine should be routed via the inbuild ethernet interface.
My problem is, that most tutorials that I found for a similar setup all use static IPs for their interfaces [e.g. this( in german)]
I did manage to follow this tutorial and configure the routing table accordingly. ip route list
gives the following output:
default via 10.xxx.xxx.1 dev enp1s0
10.xxx.xxx.0/22 dev enp1s0 proto kernel scope link src 10.xxx.xxx.83
192.168.0.0/24 via 192.168.0.1 dev enx00116b664965
192.168.0.0/24 dev enx00116b664965 proto kernel scope link src 192.168.0.100 metric 100
And while ping 8.8.8.8
and ping 192.168.0.101
(IP of a Wifi connected smartphone to the local router) as well as ip route get 192.168.0.101
/ip route get 8.8.8.8
worked with the correct interface, i cannot establish a connection to the internet via firefox. When checked with wireshark on which interface the http request is send, I could see that it used the local interface, instead of the inbuild one.
Also, route -n
shows this information:
name@host:~/$ sudo route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.xxx.xxx.1 0.0.0.0 UG 0 0 0 enp1s0
10.xxx.xxx.0 0.0.0.0 255.255.252.0 U 0 0 0 enp1s0
192.168.0.0 0.0.0.0 255.255.255.0 U 100 0 0 enx00116b664965
Can anybody point me in the right direction, how to configure my setup correctly, so that both, the local and the internet work properly. I would highly appreciate any help to setup the routing in this setup. Thanks in advance!