LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-29-2017, 01:20 PM   #16
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,900

Rep: Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050

Quote:
Originally Posted by abga View Post
If you're looking for routers to substitute your two systems, OpenWRT (LEDE) might be a good/advanced enough/flexible/reliable alternative loaded on some cheap of-the-shelf Wireless Access Points, they have plenty of docs / forum support / multi WAN guides:
https://wiki.openwrt.org/doc/uci/multiwan
https://wiki.openwrt.org/doc/howto/mwan3
https://wiki.openwrt.org/doc/recipes/high-availability
I would also like to point out that DD-WRT, Tomato, or your preferred Linux distro are all options as well.

I recently replaced my off the shelf router with a Raspberry Pi 3 running CentOS (I suppose you could do it with Slackware too, but I want SELinux and auditd). While I do not have a multi WAN link I think it wouldn't take much more effort to replicate. The Rpi3 has a built in Ethernet NIC limited to 100Mbps so I disabled that and I used two 1Gbps USB to Ethernet NICS for the WAN and the wired LAN. The built in wireless NIC has a very weak range, so I disabled/replaced that with a better USB WiFi dongle. This could also be done using a Rpi2 but the Rpi3 has better processing power. The house is wired with Cat6E and connected to the Pi using a few cheap TrendNET switches.

The router cost me around $60 to create because I already owned the network switches. I have 14 devices, between WiFi and wired, 4 of which are Samsung smart televisions. Every night we stream Netflix from all TVs at once, along with a torrent box, and several other devices browsing the web. We eat up quite a bit of bandwidth without issue. I have been quite happy with this set up and thought I would share the possibility.

Last edited by mralk3; 11-29-2017 at 01:21 PM.
 
Old 11-29-2017, 03:01 PM   #17
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
@mfoley
You're welcome!

Richard Cranium's suggestion added another NAT and DHCP server in your network, a third redundancy if you will. You could get the two switches out and rename the "New Router" to Host C and you'll have a copy of Host A or B only with the public IP 100.100.0.7 and the private IP 192.168.0.1, private IP which is also the gateway for the private LAN hosts connected to it, that's the ones that got their configuration from the DHCP server running on the New Router.
You haven't mentioned the need for port forwarding until now but only high availability. I'm afraid that this is complicating your setup a little bit since you use 3 (originally 2) dhcp servers and 3 different gateways (originally 2) for your LAN, all this under static routing and no (at least) VRRP.
https://en.wikipedia.org/wiki/Vrrp
You should have control (based on MAC) over which of these DHCP servers will provide the host 192.168.0.58 with its IP configuration just to make sure that it uses the LAN gateway from host A (192.168.0.2) where you defined your port forwarding.
I don't have your whole firewall rules set but you should be aware that you are expecting new connections on Host's A 100.100.0.5 port 1453 (have a listening service on 192.168.0.58:9595) and you need to allow them to get in and get DNAT-ed.
Code:
iptables -A INPUT -i eth0 -m state --state NEW -p tcp --dport 1453 -j ACCEPT
iptables -A FORWARD -p tcp -d 192.168.0.58 --dport 1453 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 1453 -j DNAT --to-destination 192.168.0.58:9595
If you want to always be able to connect to your public Host's A 100.100.0.5:1234 from outside then your easiest option is to run a DNS server on your own and do the "public" failover through DNS, use my suggested setup with the third NIC card.
EDIT>
Use your port forwarding DNAT rule on host A together with another DNAT for the time this host has no connectivity to the Modem and fails over on host B:
Code:
iptables -A INPUT -i eth2 -m state --state NEW -p tcp --dport 1453 -j ACCEPT
iptables -t nat -A PREROUTING -i eth2 -p tcp --dport 1453 -j DNAT --to-destination 192.168.0.58:9595
Then on host B add:
Code:
iptables -A INPUT -i eth0 -m state --state NEW -p tcp --dport 1453 -j ACCEPT
iptables -A FORWARD -p tcp -d 10.0.0.2 --dport 1453 -j ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 1453 -j DNAT --to-destination 10.0.0.2:9595
Finally, define and use a public hostname (your own registered domain name) for covering/switching your public IPs and accessing your service on port 1453 from outside. But then again, you only have one link with the same gateway connected to your only ISP, there's no redundancy there. Try getting a second contract with a second ISP if you want to have true redundancy and your service/setup is that important.
Additionally, if you want to access the service on 192.168.0.58:9595 that bad, you shouldn't have got it on LAN (private network) under NAT in the first place, I regard this as a conceptual problem.

You see, this is getting a little bit over Slackware and more into Firewalling and Advanced Routing, you definitely need to master these for your not that simple anymore setup

Last edited by abga; 11-29-2017 at 05:17 PM. Reason: bad formatting + 2 typo + conceptual mistake - EDIT> section
 
Old 11-29-2017, 03:15 PM   #18
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
@mralk3
Quote:
The Rpi3 has a built in Ethernet NIC limited to 100Mbps so I disabled that and I used two 1Gbps USB to Ethernet NICS for the WAN and the wired LAN.
I'm also using Rpi2 (Rpi3 is just overheating and throttling too much, especially on VPNs) to substitute OpenWRT for some more advanced stuff (vpn included - since OpenWRT & co have their packages really crippled by the need to fit in a 4-8MB Flash and low RAM system) and running Slackware on it. The 100Mbps NIC speed is an issue but an external Gigabit NIC will also get bottleneck-ed by the USB 2.0 limited bandwidth, so I'm using multiple 100Mbit NICs and I'm fine with them.

Last edited by abga; 11-29-2017 at 03:53 PM. Reason: typo
 
1 members found this post helpful.
Old 11-29-2017, 11:01 PM   #19
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by abga View Post
Richard Cranium's suggestion added another NAT and DHCP server in your network, a third redundancy if you will.
That's not what I gleaned from his network description nor was it what I thought I had described.

In my diagram, he has one and only one NAT and perhaps DHCP server and that would be "New Router".

Host A and Host B have fixed IP addresses on the cable modem side. My goal was to not use Host A and Host B as gateways at all for the rest of the LAN, since they appeared to have other functions that could interfere with their secondary jobs as being gateways to the outside world. With that in mind, those two servers should not be providing NAT and DHCP services to anyone else.

While I did not mention it, I would not have configured Host A and Host B to obtain their routing from the "New Router" DHCP server. I viewed the LAN side interfaces for those servers as a way for servers within the LAN to access those two servers versus being the primary route for those servers to contact the rest of the world.

I will admit that moves the nearest single point of failure from Host A to "New Router". As you mentioned, his ISP is the next single point of failure and your comments about that are absolutely on point.

I'll also agree that the OP's setup is not simple and that there are perhaps better ways to provide the services he needs to be exposed to the outside world than the manipulation of iptables rules.

And, as you stated, this is less of a Slackware issue than a networking one.
 
1 members found this post helpful.
Old 11-30-2017, 09:36 AM   #20
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
@Richard Cranium

My short and only sentence referring to your advice was to help the OP understand how his actual setup works and aid him to understand why his port forwarding is not doing what he expected, the packets from his LAN host 192.168.0.58 might not reach host A after all.
I do appreciate your inputs trying to help by the time I was still trying to understand the actual setup and what is looked to be achieved - define the problem. The OP specifically mentioned a "New Router" and you provided an answer for that.

On the DHCP part, in the post #7 the OP mentions the use of DHCP:
Quote:
Then, in 100.100.0.5's dhcpd.conf I point the routers to 192.168.0.1.
And then again in post #15 after trying your suggestion:
Quote:
I tried Richard Cranium's suggestion using what he called "New Router" with a LAN IP of 192.168.0.1. I configures the "routers" setting in Host A's dhcpd.conf to be 192.168.0.1, restarted dhcpd, and /renew'd all workstation network connections. This almost totally worked. All workstations got the gateway address of 192.168.0.1 and all were still able to connect to the Internet.
I've used the adjective pseudo for both the actual setup and the desired solution from the very beginning, because there is no full redundancy even on the LAN side, but only service availability. The connectivity redundancy is not guaranteed due to the fact that the hosts in the LAN only receive one gateway (out of the original 2) and if that gateway goes down then the hosts that were using it need to renew their IP configuration and use the second available gateway. You can do that through DHCP but you need to restart the LAN host (client) or manually renew the configuration. Another possible solution would be to manually define alternate IP configuration on the LAN hosts - even Windows supports that nowadays. However, none of these are serious redundancy approaches and VRRP should be used instead.

More on multiple gateways on LAN:
https://howdoesinternetwork.com/2014...eway-solutions

@mfoley
Again, this guide / inspiration should get your desired setup:
http://backreference.org/2013/04/03/...nd-keepalived/
On the WAN side look for a second line with a different ISP, in order to have true redundancy

Alternatively you can go through the "dirty" way that I suggested in my posts #14 and continued with the port forwarding in #17 but you'll need to care about your LAN redundancy manually (define alternative IP configurations on your LAN hosts).
 
Old 11-30-2017, 10:56 PM   #21
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
I'm not irritated about it; my goals with my advice were to move any firewall work to a dedicated device which would do just that and leave the two servers with fixed addresses that were visible to the outside world to do whatever their jobs were and not provide gateway services as well.

As it turned out, one of those two hosts would still be forwarding work to an otherwise unknown server within the LAN; a small piece of the problem that would have been nice to know earlier.

I believe that you have a better grasp of how to handle complex networking issues than I do and will leave you to support the OP at whatever level you can tolerate. (I'll probably go back and re-read your comments to the OP to glean any nuggets of information that I can use for later.)

Thank you for the information you've provided in this thread!
 
  


Reply

Tags
iptables, routing



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I use iptables to limit bandwidth to certain IP addresses and MAC addresses baronobeefdip Linux - Networking 2 01-07-2014 07:36 PM
How can I forward multiple public addresses with iptables? Revenge282 Linux - Networking 27 06-19-2011 02:04 PM
Forward multiple public addresses with iptables Revenge282 Linux - Networking 3 06-12-2011 06:12 PM
Multiple Public IP addresses daveginorge Linux - Networking 3 12-07-2008 06:18 AM
Public IP Addresses daveginorge Linux - Server 2 06-30-2008 01:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration