How to route to home network and global network
Hello,
This problem has probably been asked and answered 1,000 times already, I just can't find the right search terms. So please just point me in the right direction. I will RTFM. I wanted to create an intranet (home net), and have a second connection go to the internet (global net). I can setup routing for the local router to assign addresses on the intranet just fine. What I have trouble with is telling Linux to send packets for other addresses than 192.168.1.XXX to the global network interface, and vice versa. It seems Linux just chooses one or the other interface and puts every packet onto it assuming they will reach their destination -- when they will not. I also need to know how, if one link goes down, to make Linux NOT send all the packets for that interface out the other one. Linux appears to assume that the links are a redundancy measure by default, not 2 different networks. Thanks! |
From your post it appears you want to build a router. A quick search here and the Internet will find many guides.
Basically to route traffic from one interface to another you need to enable ip_forward which is a kernel parameter i.e. echo 1 > /proc/sys/net/ipv4/ip_forward and can be set permanently in your sysctl.conf. There is a similar configuration for IPV6 if needed. Using masquerade firewall rules you can setup a NAT router. |
You might be able to do this with iptables. A web search for "iptables route network packets" turns up a number of articles that might be helpful.
This one might be a good place to start: https://serverfault.com/questions/34...ific-interface Full Disclosure: I've never done anything like this myself. |
I forgot to mention for DHCP clients your DHCP server also needs to set gateway IP address which is the LAN IP address and DNS name server options.
|
Quote:
To be clear, I'm not trying to create a nat router -- I intend to in the future, but I can find docs on that pretty easily. |
Quote:
For NFTables, look at their Wiki: https://wiki.nftables.org/ https://wiki.nftables.org/wiki-nftab..._in_10_minutes |
Quote:
https://ebpf.io/what-is-ebpf/ https://www.kernel.org/doc/html/latest/bpf/index.html |
Granted, there's not going to be any examples of how to get eBPF to do what I want, but then NFTables isn't much better according to the above.
|
All times are GMT -5. The time now is 04:30 AM. |