Routing WIFI and LAN for specific traffic
- by jakebird451
I have two network devices aboard my macbook pro:
WIFI (en1): Used for general traffic. Connects to an ip of 192.168.19.* via DHCP
LAN (en0): Used for specific traffic. Connects to an ip of 192.168.2.10 as a static IP. Does not connect to a router, only a switch for direct routing connection.
I have 4 IP addresses I need to access on the LAN:
192.168.2.1
192.168.2.21
192.168.2.20
192.168.2.30
The rest of the traffic needs to go to WIFI. I have tried setting up a routing table for the specific ip addresses, but I only managed to mess up my network. I do not venture out into the world of networking too often, but this was the latest command I have been trying:
sudo route add -host 192.168.2.30 -interface en0
This command killed my ability to use ping. It told me that ping could not allocate memory (is that even possible)? It also killed my wifi access. Logging out and back in fixed the issue. I really do not mind to make this solution permanent, so I am fine with a temporary routing.
EDIT:
If I currently have been trying:
sudo route flush
sudo route add default 192.168.19.1
This gets everything to work for about a minute. But after such minute it "forgets" the routing to WiFi while retaining LAN's (en0) routing. If I unplug and replug my LAN (en0) cable, the process works for another minute.