You are not logged in.

#1 2011-02-09 20:23:33

Kosmonavt
Member
Registered: 2010-02-15
Posts: 100

[solved] Setting up PC as switch

Hello everyone.

I have an ordinary PC that acts as server with 3 network cards. Also there are 2 laptops, and I need to 1) route internet into these; 2) make that both lappies see server with the same IP address.

I tried IMO most obvious solution - routing via iptables FORWARD rules between these 3 interfaces. 1st goal is achieved, but 2nd isn't - I needed to set different IPs for server from laptop point of view.

So how to achieve both goals?

Last edited by Kosmonavt (2011-02-11 22:16:34)

Offline

#2 2011-02-09 20:34:55

metzengerstein
Member
Registered: 2010-06-04
Posts: 60

Re: [solved] Setting up PC as switch

Maybe this is what you seek: http://www.cyberciti.biz/howto/question … -howto.php
See following post.

Last edited by metzengerstein (2011-02-09 21:59:32)

Offline

#3 2011-02-09 21:08:28

ghen
Member
From: Belgium
Registered: 2010-08-31
Posts: 121

Re: [solved] Setting up PC as switch

Do you actually require each laptop to be connected to a different NIC of your pc?
If not, simply connect a switch or hub to one NIC, together with both laptops.

Otherwise, you want ethernet bridging (using bridge-utils).

Interface bonding, as suggested above, is not relevant here.

Offline

#4 2011-02-10 15:03:00

Kosmonavt
Member
Registered: 2010-02-15
Posts: 100

Re: [solved] Setting up PC as switch

Thank you for an advice! Bridge is working, but there are some more issues.

I've set up bridging on 2 interfaces of 3 on "server" machine according to http://www.linuxfoundation.org/collabor … ing/bridge . Assume bridged ones are eth0 and eth1, unbridged eth2. I want eth2 to look into WAN, so I raised bridge br0 (192.168.15.1) between "local" interfaces and set up forwarding from eth2 to br0 and vice versa. Temporarily eth2 isn't connected to WAN, but simply have some address (192.168.15.3).

Problem is the following - when laptops (192.168.15.10, 192.168.15.20) are connected to eth0 & eth1, they perfectly see each other, but bridge address is unpingable and SSH is inaccessible. When one laptop is plugged into eth2, SSH works, but the other laptop is unreachable.

# ip route list
192.168.15.0/24 dev eth0  proto kernel  scope link  src 192.168.15.3

How this can be solved?

Offline

#5 2011-02-10 15:31:02

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: [solved] Setting up PC as switch

what you are trying to accomplish is done at the link layer. aka a switch.

you will be better off buying a cheap switch than trying to convolute your network with routing configurations.
if you are worried about throughput you can bond your server's ethernet ports toguether to the switch.

another solution would be to have different ips in your server. i dont see why this is an issue.

to accomplish this, you will actually need two differnet subnets. and add some static routes on your server so that it can forward packets between them.

Offline

#6 2011-02-11 22:16:13

Kosmonavt
Member
Registered: 2010-02-15
Posts: 100

Re: [solved] Setting up PC as switch

Thanks to all. I have succeeded configuring machine as a switch. Fail was that unbridged interface was in the same subnet with bridge. Now it works flawlessly.

Offline

Board footer

Powered by FluxBB