You are not logged in.

#1 2007-12-12 03:50:49

synthead
Member
Registered: 2006-05-09
Posts: 1,337

[solved] "Bridging" network connections

You know how in Windows, if you're short of a router, you can enable routing through a couple ports by "bridging" them together?  How do you do this in linux?

Last edited by synthead (2008-04-14 08:17:12)

Offline

#2 2007-12-12 08:26:39

samlt
Member
Registered: 2007-05-20
Posts: 18

Re: [solved] "Bridging" network connections

with brctl
e.g.:
brctl addbr mybridge
brctl addif mybridge eth0
brctl addif mybridge eth1

(you may also need to do this:
ifconfig eth0 0.0.0.0 promisc up
and the same for eth1)

then configure the bridge as you would configure a normal interface
ifconfig mybridge $ip netmask $netmask broadcast $broadcast

Last edited by samlt (2007-12-12 08:26:53)

Offline

#3 2007-12-12 13:24:32

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: [solved] "Bridging" network connections

Nice, seems very easy.  Which package in the repos has brctl?

Offline

#4 2007-12-12 20:45:14

fed359
Member
Registered: 2007-11-21
Posts: 46

Re: [solved] "Bridging" network connections

bridge-utils in core repo

Offline

#5 2008-03-29 19:10:21

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: [solved] "Bridging" network connections

I never got this to work quite right with DHCP.  How would I set this up if one interface needs to get an IP w/ DHCP while the other interface, that is bridged with the first one, has to host DHCP?  Basically the same effect as selecting two interfaces in XP, right clicking, and selecting "Bridge connections".

Offline

#6 2008-04-12 04:56:26

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: [solved] "Bridging" network connections

Any idea?

Offline

#7 2008-04-12 08:30:18

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [solved] "Bridging" network connections

Windows has confused you. tongue

samlt gave the correct answer to "how do you bridge interfaces in Linux?" but Windows is not doing that, even though it says it is. You're looking for a NAT (network Address Translation) setup, where you have one IP address on one side, a different IP address on the other side, and routing going on in between.

This page should be useful - if you need more, there's plenty out there for Google to find.

Offline

#8 2008-04-14 07:32:04

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: [solved] "Bridging" network connections

Okay, I am getting very close!  I installed dnsmasq and I'm messing around with it.  My home network is based off a Linksys router that serves DHCP on 192.168.1.100 to 192.168.1.150.  Its IP is 192.168.1.1.  What I'm trying to do is share my laptop's connected-by-wireless internet connection with a desktop computer via crossover cable.

On my laptop, if I set the IP of my ethernet connection I want to share to 192.168.1.20 and serve IP addresses with dnsmasq from 192.168.1.50 to 192.168.1.99, it doesn't work.  I would assume that's because there are two DHCP servers (my laptop and the router) on the subnet, right?  If I set my ethernet adapter to 192.168.0.1 and serve 192.168.0.50 to 192.168.0.99, it works!  My desktop can get an IP and ping my laptop.  However, it can't get online or ping anything on the 192.168.1.x side, which is what I'm trying to accomplish tongue

The real snarl that is confusing me right now is that my dnsmasq host's /etc/resolv.conf file has "nameserver 192.168.1.1" in it (my router), but when I look at resolv.conf on the client I'm trying to get online, it has "nameserver 192.168.0.1"  This is when serving IPs 192.168.0.50 through 192.168.0.99.  Why is dnsmasq ignoring my /etc/resolv.conf file?

Last edited by synthead (2008-04-14 07:36:24)

Offline

#9 2008-04-14 07:50:29

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: [solved] "Bridging" network connections

I'm still reading, and I found that dnsmasq just serves DHCP tongue  Oh the joys of learning something new ... hah!

So I setup shorewall the way I thought would work well for what I'm doing, but when I try to run it:

[root@pwn etc]# /etc/rc.d/shorewall start
:: Starting shorewall                                                    [FAIL]

It doesn't say what is wrong tongue  I'm looking through the configs and they look right, even though I'm pretty sure there's something off a little somewhere ... is there a log I can look at to see what the problem is?  If I tail /var/log/messages.log, there isn't anything in there for shorewall.

Offline

#10 2008-04-14 08:16:58

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: [solved] "Bridging" network connections

http://wiki.archlinux.org/index.php/Internet_Share

OUR WIKI IS THE BOMB

Yes, the internet works now.  Using iptables in conjunction with dnsmasq.  iptables was very daunting to me, ouch.  But I got it.  Oh man this is awesome.  It's funny, once you figure something complicated out in Linux, you feel like you've just upped a level like in an RPG or something big_smile

Offline

Board footer

Powered by FluxBB