Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Bridge:Cannot connect across subnets.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Sat Oct 12, 2013 3:56 am    Post subject: Bridge:Cannot connect across subnets. Reply with quote

I got 2 networks, X on subnet 192.168.1.0 and Y on 192.168.1.0

The bridge has IP 192.168.1.9, and output of route -n says 192.168.1.0 has no gateway and goes through the bridge. I add the same for 192.168.2.0.

The result -- I cannot access the network Y from the box which runs as the bridge.

Nodes on X and Y can communicate to each other but only if they lie on the same subnet, i.e network Y should lie on the subnet 192.168.1.0 in order to communicate to network X. If I set the IP of one node on Y to 192.168.2.0 and add routes with no gateway, then Y cannot communicate to X and opposite.
_________________
My blog
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54097
Location: 56N 3W

PostPosted: Sat Oct 12, 2013 12:01 pm    Post subject: Reply with quote

dE_logics,

You need a static route in both directions or change the netmask on both subnets to be /22, rather than /24 but then 192.168.1.x and 192.168.2.x are in the same subnet as are 192.168.0.x and 192.168.3.x
Both ways work.

Oh there is a third way - run NAT between the two subnets but you probably don't want that.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Sat Oct 12, 2013 2:57 pm    Post subject: Reply with quote

Hi Neddy!

I added route on both ends (nodes on network Y and the box which's the bridge) as follows --

Gentoo box which works as a bridge --

Code:
0.0.0.0         192.168.1.1     0.0.0.0         UG    217    0        0 eth1_veth
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
192.168.1.0     0.0.0.0         255.255.255.0   U     217    0        0 eth1_veth
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1_veth


Routes on network Y --

Code:
192.168.1.0     0.0.0.0         255.255.255.0   U     0    0        0 eth0
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0


However it still doesn't work.

Changing network bits to 22 is not the point here -- I'm trying to bridge 2 separate networks.
_________________
My blog
Back to top
View user's profile Send private message
Carnildo
Guru
Guru


Joined: 17 Jun 2004
Posts: 594

PostPosted: Mon Oct 14, 2013 11:58 pm    Post subject: Reply with quote

dE_logics wrote:
Changing network bits to 22 is not the point here -- I'm trying to bridge 2 separate networks.

The first thing to do is get your terminology correct. A "bridge" connects two pieces of the same subnet. A "router" connects two subnets.

The second thing to do is to activate routing on your system:
Code:
echo "1" >> /proc/sys/net/ipv4/ip_forward


To make that change survive across reboots, add the line
Code:
net.ipv4.ip_forward = 1

to your /etc/sysctl.conf file.
Back to top
View user's profile Send private message
dE_logics
Advocate
Advocate


Joined: 02 Jan 2009
Posts: 2253
Location: $TERM

PostPosted: Tue Oct 15, 2013 5:01 am    Post subject: Reply with quote

Carnildo wrote:
dE_logics wrote:
Changing network bits to 22 is not the point here -- I'm trying to bridge 2 separate networks.

The first thing to do is get your terminology correct. A "bridge" connects two pieces of the same subnet. A "router" connects two subnets.


No, a router's task is to route packets across multiple (or single) route(s) which includes connecting networks, like subnets. However connecting subnets is the primary task of a bridge. Besides there's no reason why there should not be internetwork communication, or why subnets should not be able to communicate to each other.

The problem on my end, as Neddy pointed out, was that the node (on X) to which I was sending packets to did not have routes added for subnet 192.168.2.0/24, so it could not respond to network Y.
_________________
My blog
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum