Ok, instead of googling around quickly for different answers, I'd like to know if you guys can think of a good solution for my setup.
Setup:
I have a laptop which I connect to my ISP via a wireless router, which I have connected as a switch, so instead of plugging the cable from my ISP to my WAN port, I have connected it to one of my LAN ports. This way I will get an external IP-address directly from my ISP, instead of a local IP. This way I don't need to do any port forwarding etc, since I have 5 IP-address that I can use.
I also have a server connected, but with a regular TP-cable, to my router (or let's call it a switch from now on). This computer also get an external IP-address of course.
Since the wireless connection is quite slow, especially when transferring large files, I thought I might as well hook my laptop up with a LAN-cable, which I hid quite nicely so it's not showing at first glance in my living room. This is to get better speed between laptop and server.
This is where I need the help. I get an external IP-address to my LAN-device in my laptop, but I only want it to use the cable for my server, not anything else. I really need to be mobile in my home, and it is important that the connection does not get cut off when I disconnect my LAN-cable.
How can I route the traffic between laptop's LAN-cable and my server, without the use of the functions in my router?
I thought that maybe this is possible through 'arp' or something?
Maybe I could use some sort of network bonding (not sure what it is called in windows, but I'm suggesting what I read some time while configuring the Linux kernel).
One thing you should now is that laptop is running windows XP, and server is running Ubuntu.
I am thankful for any idea or thought on this.
Thank you!
I don't know anything about networking in windows, but it seems to me that the reason you are having problems is that your laptop uses your server as the default gateway when you plug in the cable. It probably does this because the server is running a dhcp server, which responds to the laptop's dhcp queries. Disabling the server's dhcp server, or changing its configuration, might help this.
I think you misunderstood it all. I WANT to route traffic between the server and laptop via LAN instead of wireless, because the speed is greater through cable than it is via air, BUT I also want to limit the connection so that nothing else uses that connection. Skype for example should always choose to go via wireless connection, because I need to move around some times while using it.
Go into the card's properties and select TCP/IPv4 and click on Properties, and select "Use the following IP address", then enter the IP address you want to use for the card. Then go into the command prompt and type:
netsh interface ipv4 show interface
This tells you the interface index of the network card where the cable is connected. Then type:
route -p add (Server's IP) mask 255.255.255.255 (Router's IP) if (Interface index)
If the server's IP changes, you can delete the old route using the following command and then add it again:
route -p delete (Server's IP)
I've messed with networking, but I'm no expert. However, I think I know the main problem you're experiencing since I've tried this before as well.
Since you're using your router as a switch, most of the routing capabilities I believe are disabled. When you try to upload to the server, your signal goes from the laptop, to the "switch," back to your isp, then to your server. This limits your transfer speeds to whatever your maximum upload speeds are.
In order to fix this issue, you need duel lan cards on the server. The one port should be act as your WAN, the other for your LAN. Hook the "switch" to the LAN port on the server, and your modem on your WAN port. All traffic has to go first through your server before it can get to the outside world if you want true LAN speeds. Unfortunately this also kills your idea of having each system grab an external address.
Another solution is to setup an actual LAN alongside the setup you have. Run a crossover cable from the server's second ethernet port to the laptop and create a two computer network there. Once that's done, you have to configure each program to bind to a certain adapter/address. This area I can't help you with though. You'll have to read up on each program you want. So long as the program supports it, it should be pretty easy with a shortcut.
I have a similar setup at my house, with my computer getting an external address and everything else (gf's comp, ps3, xbox, etc) grabbing a LAN address from the wireless router. To do any type of LAN transfers I have to enable my wireless, connect to the router, then disable it when I'm done.
Shouldn't the router remember the MAC address of each connected PC, and pass traffic to the correct PC automatically? I don't see why it would pass the traffic to the ISP unless the ISP is selected as the gateway.
But perhaps the server itself needs to be selected as the gateway instead of the router if it's routing capabilities have been disabled. I don't think you can add a route without specifying a gateway using the add route command.
the actual trick would be to totaly rewrite the routing table
basicaly the first route would go via the wireless adapter
route -p ADD 0.0.0.0 mask 255.255.255.255 (router's IP) if (wirless interface)
this will tell to forward everything to the wireless interface
then you add HHS route :
route -p add (Server's IP) mask 255.255.255.255 (Router's IP) if (LAN interface)
so if he ask to go to the server he'll use the LAN
also you should change the server IP adress, the best option for you would be to create a DMZ in the router and to place the server that DMZ
so internaly your router would have a 192.168.x.x. but since it's in the DMZ the router will automaticaly forward any packet to your server and become totaly transparent (no port forwarding needed for P2.....games \o/)
and i don't completly understand how you can get 5 public IP, is it feature from your ISP? if it's the case, then again better use the router as a DHCP server (but the port forwarding will be needed for all the computers that are not in the DMZ) it's a bit fastidious to set up but all your local trafic will stay local (if it use a public adress, it goes all thru the ISP network every time) and you would gain some speed...
Um... I won't be able to get an IP for my router since it is hooked up as a switch. Each computer get's IP from my ISP directly. Yes, it is a feature from my ISP so that I can get 5 IP-addresses. So in this case the examples you gave me are a bit off I think? "route -p add (Server's IP) mask 255.255.255.255 (Router's IP) if (LAN interface)" Router IP is unavailable since it is a switch now days.
It is true that I could hook up two LAN-devices with a cable, but I don't want to do that unless I really have to. There must be another way through software/OS to do this, right?
Thanks for the answers and ideas so far people. Keep em' coming! =)
Try putting the server's IP instead of the router's IP. It should then send data with the server's IP as destination to the server. I couldn't find a way to leave the gateway field blank.
route -p add (Server's IP) mask 255.255.255.255 (Server's IP) if (LAN interface)
The traffic should not go to the ISP if it's sent to the server's MAC address, I think, which should be the case here.
The other route command isn't needed, since the correct route exists by default. The route to the server overrides the default route, since it's metric is 1 (since it wasn't specified).
Try putting the server's IP instead of the router's IP. It should then send data with the server's IP as destination to the server. I couldn't find a way to leave the gateway field blank.
route -p add (Server's IP) mask 255.255.255.255 (Server's IP) if (LAN interface)
The traffic should not go to the ISP if it's sent to the server's MAC address, I think, which should be the case here.
The other route command isn't needed, since the correct route exists by default. The route to the server overrides the default route, since it's metric is 1 (since it wasn't specified).
actualy the moment you use your public ip adress, it will go to the ISP router to make the request
let's say that your server have the public adress and your laptop have a private one ,if your tracert the packet it will be something like that:
laptop>router>isprouter>server
the metric parameter is how much maximum jump the packet can do before selfdestruction, if you set it at 1, the packet will selfdestruct before the isprouter, the default metric is "always" 10 but again, the isp rerouting isn't counted in the "10" jumps
the 0.0.0.0 route is just to make sure that the lan is only used when the computer try to comunicate with the server, as the default 0.0.0.0 route may change when the lan cable is pluged ( i think it change to the fastest answer IE : the lan )
edit : i have a nice utility called NetworkActiveAUTAPF witch is a port forwarder, i use it to access my VM servers thru internet
so if it's only for file transfert, you can redirect all data going for the file transfert port directly to the LAN interface IP (must be a static ip of course)
but i don't know if it will work that way and also, all the data's will transit throught your isp network ( and the router fonction is not used :/)
as for the (ROUTER ADRESS) you will have to change it to your isp gateway
(since the DHCP/GATEWAY roles are done by the isp)
that's mean you have a good thrust into your ISP as all your "internal" trafic will go thru the isp, even your personal ones
actualy the moment you use your public ip adress, it will go to the ISP router to make the request
let's say that your server have the public adress and your laptop have a private one ,if your tracert the packet it will be something like that:
laptop>router>isprouter>server
That would be the case if the router was operating normally with the ISP connected to the WAN port, but if it's acting as a switch, it should just forward the data to the port that's connected to the device with the MAC address specified as the destination, regardless of the IP address.
As for the metric, I think you're talking about a different kind of metric. The metric parameter used with the route add command controls how it will select which route to use, it's not the TTL metric.
actualy the moment you use your public ip adress, it will go to the ISP router to make the request
let's say that your server have the public adress and your laptop have a private one ,if your tracert the packet it will be something like that:
laptop>router>isprouter>server
That would be the case if the router was operating normally with the ISP connected to the WAN port, but if it's acting as a switch, it should just forward the data to the port that's connected to the device with the MAC address specified as the destination, regardless of the IP address.
As for the metric, I think you're talking about a different kind of metric. The metric parameter used with the route add command controls how it will select which route to use, it's not the TTL metric.
it still goes thru a ISP equipement when it's not realy needed
as for the ROUTE metric, youre right , they are not talking about the TTL.
just create another regular network in private address space and you're done.
- assign a second IP to your server, some static LAN-only-IP (e.g. 192.168.1.1)
- assign a fitting static LAN IP to your laptop's wired NIC (i.e. 192.168.1.2)
voila, when you connect to 192.168.1.1 it'll connect to your server via LAN.