Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 313
  • Last Modified:

interesting question - no gateway

Ok may sound weird , but here it goes...


Can i access and communicate with a machine in a different network if I have a router in my network , BUT my machine doesn't have a gateway ?

Is that possible ?
0
its_ns_04
Asked:
its_ns_04
  • 9
  • 8
  • 3
  • +1
2 Solutions
 
Surone1Commented:
yes. the gateway setting just determines how you reach the internet
0
 
B HCommented:
if your machines are on the same subnet, yes... they'll arp eachother and find eachother.

but if one is on the opposite side of a router, you need either a gateway entry on both machines, or a static route on both machines.

the gateway setting just says "and everything else goes to here"
a static route entry would say "for this guy, go to [some gateway]"
0
 
its_ns_04Author Commented:
In this scenario, there are two machines A and B, but on different subnets... B is well configured with its gateway, however, there is no static route or gateway configured in A.

There is a router D which connects both LANS of A & B . Now how about in this case, will A be able to communicate with B ?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
its_ns_04Author Commented:
is there any way which makes A be able to communicate with B (without configuring static route and gateway in A)
0
 
B HCommented:
we need ip addresses to say for sure... but...

if A is 192.168.0.5, 255.255.255.0
if D is 192.168.0.1, 255.255.255.0
if B is 192.168.1.5, 255.255.255.0
if the router for machine B is 192.168.1.1, 255.255.255.0

then you'll need a static route on both machines, like:
for machine A:  route add 192.168.1.0 MASK 255.255.255.0 192.168.0.1 METRIC 2
for machine B:  route add 192.168.0.0 MASK 255.255.255.0 192.168.1.1 METRIC 2

add a -p switch in there to make it stick forever

0
 
B HCommented:
this is assuming there's a vpn tunnel handled by the routers as you seemed to indicate
0
 
its_ns_04Author Commented:
ok it goes like this
A is 192.168.1.2, 255.255.255.0
 B is 192.168.2.2, 255.255.255.0
D is a router with two interfaces 192.168.1.5/32 and 192.168.2.5/32

A's gateway is not defined and there is no static route in A either. Can A still communicate with B somehow via D ?
0
 
B HCommented:
If they are different interfaces in the router, you'll need to create a firewall rule to allow them to talk, then set both subnets to 255.255.0.0
0
 
its_ns_04Author Commented:
where is again "firewall" coming here into the picture ?
0
 
its_ns_04Author Commented:
ok. I think still I can make A talk with B without configuring gateway of A.

I can enable "proxy ARP" in the router D and with this feature, I will be able to talk with B from A, even though A's gateway is not configured. This is what I was looking for.

0
 
B HCommented:
the router D ....  i mentioned firewall because you mentioned multiple lan interfaces...

usually, a router would have one wan interface and one lan interface (with 4 physical ports)

however, if your router has for example two different lan interfaces like lan1 and lan2 ... then that router would need to be configured to allow traffic between lan1 and lan2.  by default, lan1 could access wan1... lan2 could access wan1...but lan1 and lan2 wouldn't be able to see each other.

proxy arp would allow them to see eachother, but you might still need a firewall rule in the router to allow the actual traffic.

gateways still wouldn't be required on the network cards, as long as the router can handle the two interfaces properly
0
 
its_ns_04Author Commented:
router's job is to route traffic :)
0
 
B HCommented:
yeah but it's job is also to police the interfaces that it manages.

if your two lan networks are connected via a switch, OR the same interface of the router, then the router doesn't care.

but - if your networks have to traverse two different interfaces on the router, then the router has to be configured to allow or deny that
0
 
Fred MarshallPrincipalCommented:
It seems that nobody asked: Why no gateway entry on A?
0
 
its_ns_04Author Commented:
well, this is just a test scenario. And the main question here is, is it possible not to have gateway defined in A and still make things work
0
 
B HCommented:
router's job is to route traffic - across interfaces that ARP cannot traverse.

so - same subnet, same switch/interfce things will work without a gateway (locally).  but if they are on different interfaces in the router, the router needs to route (or allow ARP between the interfaces)
0
 
Fred MarshallPrincipalCommented:
The fundamental question to your original post and to this clarification "the main question here is, is it possible not to have gateway defined in A and still make things work" the answer is "no".
That's because in the original post you say:
"Can i access and communicate with a machine in a *different* network .. "
Not only does this require a router but it requires a gateway entry at both ends.

The details of how the router is interconnected with the computers, how the routers routing table is configured goes beyond this.

Or, you might put routes in all the computers that need to communicate so that the packets go out on the wire even though they aren't on the same subnet.

route -p add
[destination network IP] mask [destination network subnet mask] [gateway ip address]

The gateway IP address can be the NIC address and then the packets will just hit the wire as if there would be a destination connected to the wire.  You add this route at both ends....

0
 
its_ns_04Author Commented:
i can make it work without gateway defined in A and I have recently made it work :)
0
 
B HCommented:
thats great - did any of our comments help?
0
 
Fred MarshallPrincipalCommented:
*How* did you make it work?
0
 
its_ns_04Author Commented:
to some extent, it was correct
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 9
  • 8
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now