LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   3rd nic in a Suse Box running as a router (https://www.linuxquestions.org/questions/linux-networking-3/3rd-nic-in-a-suse-box-running-as-a-router-343331/)

dasbooter 07-15-2005 01:28 AM

3rd nic in a Suse Box running as a router
 
I understand this configuration is common:
Code:

internet<--(1rst nic)Suse router box(2nd nic)<--switch<--2 computers
however I have and extra nic available instead of the switch so I wondered if it were possible to get this configuration working and if you could dumb it down for me that would be great more of a Suse newbie than a Debian guru if you know what I mean:
Code:

internet<--(1rst nic)Suse router box(2nd nic)<---1rst computer
                                    (3rd nic)<----2nd computer

Thanks in advance

fouldsy 07-15-2005 06:19 AM

Theoretically, yes, you should be able to, as I had a Shuttle acting as a router as a temporary measure setup by our ISP that was just a Linux box with two internal nic's for a curriculum and admin networks to be fed in separately and then one external connection to the fibre.

Why do you want to remove the switch though? I'm not sure about the exact details but shouldn't be too hard - give the 2nd + 3rd IP addresses that point through to the first nic as default gateway and the routing table to handle the two machines on the other side should be done automatically, though you might need to stick a route in telling the SuSE box which device to use.
You'd also then need different network cables (crossover rather than straight-through) from your 2nd+3rd nic's to the computers, so may well be more hassle than it's worth. If you need to an extra machine for some reason in the future you couldn't simply plug into the switch so you limit further expansion too.

Maybe someone can recommend the exact config for you routing table and ip tables for the masquearding + forwarding...

dasbooter 07-16-2005 02:52 PM

Well you see I acutally dont own a switch but do own an extra nic and so I was trying to be frugal and actually use what was on hand. My attempts so far have been unsuccesful with only one box being able to connect to the suse router box and not both at the same time. I have tried troubleshooting in various manners but I am sort of coming to the conclusion that in fact my ignorance of networking is the problem. I think perhaps that I will require a network bridge in the suse router between the two nics that are connected to the 2 internal systems.

eantoranz 07-16-2005 02:59 PM

That's like shooting the floor, man.

The simplest way:

Set two different networks for the inner interfaces. say:
eth1 network: 192.168.1.x
eth2 network: 192.168.2.x

Set two IPs for both interfaces... say:
eth1: 192.168.1.1
eth2: 192.168.2.1

Set the IPs of the client machines
Machine connected to eth1: 192.168.1.2 netmask 255.255.255.0 gw 192.168.1.1
Machine connected to eth2: 192.168.2.2 netmask 255.255.255.0 gw 192.168.2.1

That will make it possible for both mahcines to reach the router and viceversa /try pinging).

To make it possible to reach both clients from themselves, you have to maek sureforward is enabled in the router... and the firewall stuff.
Try pinging between them.

Make sure the netmasks are right... otherwise, it won't work.

The other simple way is bridging... but I have never tried.. maybe you could give it a shot.

Darin 07-17-2005 09:54 AM

Like eantoranz suggested, to use the two network cards you either need to assign them different IP subnets (the 192.168.1.x and 192.168.2.x, also the Internet connection needs to be unique to both of these, so make sure if you have a DSL or Cable router, it is on a different IP range also) or bridge the two connections. If you put them on different subnets, you basically need one full set of IPTABLES rules for each interface and then more rules if you want to open connections between the two.

FYI in Oregon, USA I can find stores that sell cheapo $5.00US switches, which isn't much considering cables are a couple dollars apiece anyhow and you will need special crossover cables if you connect NIC to NIC.

Aside from that, you mentioned you had one working so if it's still not all going it may help to post more info like what IP addresses and/or firewall script you are using now.

dasbooter 07-20-2005 11:29 AM

Well I finally accomplished this task via a bridge.
The network was not functional eg. IP masquerading etc for the two boxes that were attaced to the two nics in the router box. The configuration that was suggested that simply assigns two different IPs and the same netmask allowed one box and not the other to connect to and use the router box to contact the internet.

Just to review the Suse router box has three network interface cards one connected to the external (hostile/internet) and two others (internal/friendly), these are each connected to another box/system each with its own nic(onboard the MOBOS in this cae).

I used bride-util available thru Yast add remove software and then again thru Yast assigned each of the internal cards an ip of 0.0.0.0
.Make sure under Security---> Firewall that the two cards in the Suse router box that will be connected to your 2 other systems are assigned to internal interfaces.

Now open your terminal program of choice as root and do :
Code:

dasbooter@fatman:~>brctl addbr br0
builds the bridge
Code:

dasbooter@fatman:~>brctl addif br0 eth0
Code:

dasbooter@fatman:~>brctl addif br0 eth1
adds the two intenal network cards to be bridged to the bridge
then do this:
Code:

dasbooter@fatman:~>ifconfig eth0 down
dasbooter@fatman:~> ifconfig eth1 down
dasbooter@fatman:~> ifconfig eth0 0.0.0.0 up
dasbooter@fatman:~> ifconfig eth1 0.0.0.0 up

just makes sure but you probably dont have to do this
then finally
Code:

dasbooter@fatman:~>ifconfig br0 192.168.0.1 up
Now try pinging the router box and pinging the 2 internal machines from the router box if that doesnt work that drop the firewalls for a moment and try again. If that doesnt work then your screwed cause I am fresh out of ideas :) Make sure IP masquerading is checked in Yast firewall and you should now have access to the internet from the 2 internal machines. Now to make it permanent?
which exposes another weakness of mine scripting and run level knowledge :)

Good resources http://www.tldp.org/HOWTO/Ethernet-B...O-3.html#ss3.1 http://bridge.sourceforge.net/
**** I did this because I had all the materials on hand cables and nic cards and wanted to save a couple of bucks and learn something in the process. I dont doubt that there are others who collect computer junk just like me :) ****


All times are GMT -5. The time now is 05:04 AM.