Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two units (a computer and a nas) connected to the same switch, both with external ips. Why are connections between them routed through the external gateway? Shouldn't the switch route them directly?

share|improve this question
    
It's a bit annoying that I have gigabit on my network but since everything is routed via the ISP gateway it's wasted. –  henrik Feb 28 '11 at 9:51

2 Answers 2

up vote 4 down vote accepted

What are the IP addresses and netmasks? Are both hosts in the same subnet? Are the machines dual-homed

A switch does not route, it forwards packets. If the IP of one of the client interfaces is on the same IP as the IP of the NAS interface that you used to connect, then it should not touch your router/gateway. If your devices have multiple addresses you could be using an address that is not common to both hosts forcing it to go through the router. If the 2 hosts are not on the same subnet then the traffic will have to go through the router.

share|improve this answer
    
Not dual-homed. The IPs are: pc x.x.103.233 nas x.x.102.69 gateway x.x.102.1 mask 255.255.254.0 (same gateway and mask on both) –  henrik Feb 28 '11 at 9:03
    
How do you know they are being routed? Can you post the logs/captures? If you ping the NAS from your client what MAC address shows up for the NAS IP in your ARP table. The MAC of the NAS, or your router. –  Zoredache Feb 28 '11 at 9:28
    
The nas and the gateway share the same mac in the arp table. And it's not my router. It's my isp's gateway if that makes a difference. more info in my reply to dbasnett. To be honest I don't KNOW how it's routed but the speed suggests it. That and a trace root. –  henrik Feb 28 '11 at 10:07
    
Ok the switch routes based on the MAC and the ISP gateway gives its own MAC. Is there any way to work around this? Setting fixed entries in the arp table? Not great but could it work? –  henrik Feb 28 '11 at 11:44
1  
Looks like a static entry in the arp-table did the trick. While the nas retains it's ip at least. –  henrik Mar 3 '11 at 20:43

Assuming that the external gateway is a router and you have a setup like this

                 -------
--------         | S   |
|  PC  |---------| W   |     ---------
--------         | I   |    |         |
                 | T   |----|  Router |---> Internet
--------         | C   |    |         |
| NAS  |---------| H   |     ---------
--------         |     |
                 -------

the pc, nas, and router interface facing the switch will all need to be on the same subnet. When you say external IPs do you mean public IPs?

share|improve this answer
    
You assume correctly, or close enough, the router is a gateway belonging to my ISP. They are on the same subnet (look in my reply to Zoredache) and yes I mean that the IP's are public, supplied by the DHCP of my ISP. –  henrik Feb 28 '11 at 9:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.