PDA

View Full Version : SEQ With a *SWITCH* (solution)



UnGod
01-03-2004, 08:58 PM
Ok, This will be a bit long, so be forewarned, this also isn't for the faint of heart. I can only point you in the right direction, from there on your on your own.

I recently purchased a Wireless switch+router (all in one), and decided to finally put all my machines behind it. I have 2 switches (the router included) and a true hub (this plays NO part).

I was trying to think of a way to fit the hub in there without sacrificing too much performance from the switches and just fiddling of course, when it came to me how to get past this issue.

It's quite simple actually concept wise. My EQ Machine uses the linux machine as it's default gateway (though the linux machine does NO NAT)

First step was getting the tools, and kernel setup correctly. You need to do a bit of advanced routing with the linux machine, so you must have iproute2 installed (many distros come with this pre installed, or available as an RPM/package/etc), alternativly you can find the source at: ftp://ftp.sunet.se/pub/Linux/ip-routing/ (the file you want is "iproute2-2.4.7-now-ss020116-try.tar.gz") (or just click HERE (ftp://ftp.sunet.se/pub/Linux/ip-routing/iproute2-2.4.7-now-ss020116-try.tar.gz))

Next, you must have the two options: "IP: advanced router" and "IP: policy routing" enabled in your kernel compile (some if not all distributions will require a recompile of the kernel for this one, slackware does not have it enabled per default)
I do not have the time to write up a kernel compile FAQ for this, see http://www.linux.org for some howto's or so.

Thats the hard parts!

This was done with a Linksys Wireless Router, so the procedure is for that, it WILL vary per router manufacturer or perhaps even models.

Lets assume your router is 192.168.0.1, your linux machine is 192.168.0.2 and your windows (eq) machine is 192.168.0.3.

Both the linux and windows machines must be assigned static ip addresses (which address is irrelivant, but it must be static)

Execute the following command on your linux machine:

echo 200 EQ >> /etc/iproute2/rt_tables

You also need to have the following in a boot script somewhere (after net is initialized) (or type in manually for now):


ip rule add from 192.168.0.3 table EQ
ip route add default via 192.168.0.1 dev eth0 table EQ
ip route flush cache


Thats it for the linux machine configuration! (yay)

Now on to the router.

On my linksys router, it's under "Setup"->"Advanced Routing"
You can enter static routes, what you need to do, is setup a route for any traffic to 192.168.0.3, to be forwarded through 192.168.0.2

So for route name, enter whatever you want. Destination LAN IP should be 192.168.0.3. Subnet Mask should be 255.255.255.0. Default Gateway should be 192.168.0.2. And interface should be LAN & Wireless (or whathave you).

Click Save Settings and your done with the router config.

Now to the windows machine.

Open up the properties for your internet connection, and select the properties of: Internet Protocol (TCP/IP)

Select "Use the following IP Address:"
And enter in: 192.168.0.3 for the ip, 255.255.255.0 for the netmask, and 192.168.0.2 for the default gateway

Enter in DNS servers to your liking (may wish to cat /etc/resolve.conf on the linux machine to see which ones it uses)

Click ok, save yadda yadda.

You may or may not have to reboot the windows machine after this.

And your good to go!
All traffic will now be routed through 192.168.0.2 (linux machine) which leaves it well able to be viewed via tcpdump/seq

You could go a bit further into this as well if you wanted.
You could narrow down the routes, so all normal traffic is routed through 192.168.0.1 (the router), and only EQ traffic is actually routed through the linux machine. Though as I am unsure of all the IPs of the EQ servers, I don't want to put up a list of them :P

But it's pretty trivial, and if you can follow this to this point, getting it to be EQ specific should be trivial for you as well ;)

UnGod/Belith (happily fiddling with his new Linksys router)

fryfrog
01-12-2004, 09:39 PM
Another simple way would be to hook up the router/wap device to the hub, plugging the seq computer into the hub. From the hub you would uplink to your second switch and your second switch would have all of your computers on it.

In this manner, all your inter-computer communication (except to the seq box) is over 100mbit switch and the only traffic that is "slowed" by an extra hop past a hub then to a switch is outbound internet traffic... which is slow anyway and doesn't suffer any performance hit from it.

The picture:


{internet} -> {router + wap + switch device} -> {Hub with seq plugged into it} -> { Switch all other comptuers plugged into it}

S_B_R
01-12-2004, 11:20 PM
I'm not sure what this gets you that is somehow better than simple NAT? You could do a simple NAT setup with 2 lines in rc.local:
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o ethX -j MASQUERADE that's the entire linux portion... the windows portion would be just point it's default gateway to the linux box....

I must be missing something...

fryfrog
01-16-2004, 12:07 AM
What you are missing is that he is using his linux box as a gateway when it actually isn't a gateway. I believe that the outbound traffic hits the router and gets sent back to the linux box. The linux box sees the traffic, then re-routes it back through the router.

Would probably be easier to just call the linux box your default gateway on the eq computer...

But the truely easiest way is to put your seq, uplink to the switch and uplink to the internet onto a sniffable hub. Every "real" computer except the seq box gets "switch" performance, nothing depends on the seq computer being physically on (and working) and you don't add a bunch of retarded hops :)

S_B_R
01-16-2004, 08:56 AM
Yeah, I got that, it just seems like a lot of hoops to jump through, when both our solutions would seem easier. Then there's a that whole MAC table corruption "fix" that was discussed a few months back. I just thought maybe there was a reason he didn't want to use linux NAT, or he couldn't obtain hub for your solution...

/shrug

UnGod
01-17-2004, 03:13 PM
Well you see, this was more a concept of less equipment for the same result.
I had originally all my machines behind a linux box doing NAT.
I recently aquired a wireless router, and as I only have 6 computers (4 wired, 2 wireless) I could eliminate 2 of the 3 hubs, and use JUST the wireless router for everything.
(Seeing as how the wireless router runs linux, I don't loose anything that way anyway)

After a bit of rewiring, and upgrading the kernel on the linux machine used as the gateway in my example, it seems, source routing is not in fact required. All you must do is point the default gateway at the linux machine, and setup a static route on the router to pump everything through that machine. (ip_forward must be enabled though of course) (aka you can skip everything i mentioned about the setup on the linux machine, most distros should work fine out of the box)

Works like a charm for me, and it was only offered as a possible solution for those who feel like fiddling but not forking out $5 for a hub or whatever :)

landaile
01-28-2004, 05:24 PM
I have a much easier and less messy solution that doesnt mess with things when you arent playing EQ

I compiled and installed Ettercap.
Run Ettercap and select the default gateway as the source (192.168.0.1 in this example)
Select EQ machine as the Destination IP (192.168.0.3 in this example)
Press "a" to arp poison sniff and guess what you linux machine is now seeing.

Then when Im done using SEQ I close down Ettercap and i dont have some strange routing thing going on and I dont have a switch with a port out to a hub with linux and EQ box off the hub (which is good for me since linux is my fileserver and hubs just arent as fast as switches). It doesnt cost any extra money and it doesnt take any more knowledge of linux then is needed to compile SEQ

S_B_R
01-29-2004, 09:21 AM
Originally posted by landaile
I have a much easier and less messy solution that doesnt mess with things when you arent playing EQ

I compiled and installed Ettercap.
Run Ettercap and select the default gateway as the source (192.168.0.1 in this example)
Select EQ machine as the Destination IP (192.168.0.3 in this example)
Press "a" to arp poison sniff and guess what you linux machine is now seeing.

Then when Im done using SEQ I close down Ettercap and i dont have some strange routing thing going on and I dont have a switch with a port out to a hub with linux and EQ box off the hub (which is good for me since linux is my fileserver and hubs just arent as fast as switches). It doesnt cost any extra money and it doesnt take any more knowledge of linux then is needed to compile SEQ Yeah, there is a thread about that from several months back. I think they refered to it as ARP corruption as apposed to ARP poisoning, but it's the same thing. I mentioned it, in passing, in my post above.

I've never tried it but it seems to me you could end up with some packet loss on both machines (EQ and SEQ). I suppose it depends on the switch, how it handles ARP Table corruption...