Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Servers & Networking
FedoraForum Search

Forgot Password? Join Us!

Servers & Networking Discuss any Fedora server problems and Networking issues such as dhcp, IP numbers, wlan, modems, etc.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 4th October 2009, 09:19 PM
szymex Offline
Registered User
 
Join Date: Oct 2009
Posts: 1
linuxfedorafirefox
How to set up bridge? (wlan0-eth0)

I tried google but without success. I have a small home network and one computer has to work as a bridge (comp1), it connects to the internet through wlan and is connected with cable to other computer (comp2), I would like to to make that second computer member of a local network with internet access.
I was trying this:

Code:
ifconfig wlan0 0.0.0.0 
ifconfig eth0 0.0.0.0 
brctl addbr br0 
brctl addif br0 wlan0 
brctl addif br0 eth0
ifconfig br0 192.168.1.7 netmask 255.255.255.0 up
On comp1 I could ping a comp2 but I couldn't ping router and internet didn't work. In Network Manager wireless connection seemed to be connected.
Any idea how to solve that problem?
BTW I'm using Fedora 11.
Reply With Quote
  #2  
Old 5th October 2009, 09:20 AM
Dangermouse's Avatar
Dangermouse Offline
Administrator
 
Join Date: Aug 2007
Location: London Postbox (the red one)
Age: 47
Posts: 3,847
linuxfedorafirefox
Hi and Welcome,

This is something i have tried but without success, im not much good at Networking
So i hope someone can help you soon. (shameless bump)

Dave
Reply With Quote
  #3  
Old 5th October 2009, 12:20 PM
scottro's Avatar
scottro Offline
Retired Community Manager -- Banned from Texas by popular demand.
 
Join Date: Sep 2007
Location: NYC
Posts: 8,142
linuxopera
My way of doing it which has worked for me.

Code:
sudo brctl addbr br0
sudo ifconfig eth0 0.0.0.0
sudo brctl addif br0 eth0
sudo ifconfig br0 192.168.1.115 netmask 255.255.255.0 up
sudo route add -net 192.168.1.0 netmask 255.255.255.0 br0
sudo route add default gw 192.168.1.1 br0
__________________
--
http://home.roadrunner.com/~computertaijutsu

Do NOT PM forum members with requests for technical support. Ask your questions on the forum.


"I don't know why there is the constant push to break any semblance of compatibility" --anon
Reply With Quote
  #4  
Old 5th October 2009, 02:05 PM
Gödel's Avatar
Gödel Offline
Registered User
 
Join Date: Jul 2009
Location: London,England
Posts: 1,095
linuxfedorafirefox
There's no need to use a bridge, in Fedora 11 this is much easier.

Comp1 (Connected to internet via wlan0, connected to comp2 via cable from eth0)
================================================== ===

1. Open System -> Administration -> Firewall, and under 'Masquerading' select wlan0 (scroll down, if it's not there add it), then click 'Apply'

2. Set eth0 to ip 10.0.0.1, either via Network Manager or from the command line with

Code:
ifconfig eth0 10.0.0.1
(Assuming your wifi connection is in 192.168.*.* range)

Comp2 (Connected to Comp1 via cable from eth0)
=================================

1. Stop NetworkManager service since it's easier without:

Code:
service NetworkManager stop
2. Set eth0 ip address to 10.0.0.2 and default gateway to 10.0.0.1:

Code:
ifconfig eth0 10.0.0.2
route add default gw 10.0.0.1
Check you can ping 10.0.0.1, and an external ip such as 4.2.2.4

3. Now just set a DNS address in /etc/resolv.conf, eg if comp1 has dns address 192.168.1.1 then just put this line in /etc/resolv.conf

Code:
nameserver 192.168.1.1
(if unsure use a free external DNS like 4.2.2.x, x=1..6)

That's it, easy enough to script. I have to do this sometimes when I have no wifi connection on a portable machine and it's easier to plug into a internet connected laptop rather than the router, which is behind furniture.
Reply With Quote
  #5  
Old 5th October 2009, 02:14 PM
Gödel's Avatar
Gödel Offline
Registered User
 
Join Date: Jul 2009
Location: London,England
Posts: 1,095
linuxfedorafirefox
Note: if you have set up a bridge then remove it with 'brctl delbr br0'
Reply With Quote
  #6  
Old 5th October 2009, 03:42 PM
stevea's Avatar
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,300
linuxfedorafirefox
I'm with Godel - a bridge it's the ideal way to create forwarding.
I have no idea what
Quote:
1. Open System -> Administration -> Firewall, and under 'Masquerading' select wlan0 (scroll down, if it's not there add it), then click 'Apply'
Does, but something needs ot setup ip forwarding.
echo 1 > /proc/sys/net/ipv4/ip_forward


It's also a nice idea to use dnsmask to serve dhcp on the local net.

Code:
WAN=eth0
LAN=eth1
LANIP="192.168.133.1"
DHCPRANGE="192.168.133.2,192.168.133.253"

# setup forwarding and the dnsmasq service
fwd() {
    iptables -A FORWARD -i $LAN -j ACCEPT
    iptables -A FORWARD -o $LAN -j ACCEPT
    iptables -t nat -A POSTROUTING -o $WAN -j MASQUERADE
    echo 1 >  /proc/sys/net/ipv4/ip_forward
    ifconfig $LAN $LANIP/24 up

    /usr/sbin/dnsmasq -C /dev/null >/dev/null 2>&1 \
        --bind-interfaces \
        --listen-address=$LANIP \
        --dhcp-range=$DHCPRANGE,12h \
        
    echo "to disable: $0 -d WAN=$WAN LAN=$LAN"
}

# remove forwarding and the dnsmasq service
unfwd() {
    pkill -9 dnsmasq
    ifconfig $LAN down

    echo 0 >  /proc/sys/net/ipv4/ip_forward

    iptables -D FORWARD -i $LAN -j ACCEPT
    iptables -D FORWARD -o $LAN -j ACCEPT
    iptables -t nat -D POSTROUTING -o $WAN -j MASQUERADE
}
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
  #7  
Old 5th October 2009, 04:04 PM
Gödel's Avatar
Gödel Offline
Registered User
 
Join Date: Jul 2009
Location: London,England
Posts: 1,095
linuxfedorafirefox
Quote:
Originally Posted by stevea View Post
Does, but something needs ot setup ip forwarding.
echo 1 > /proc/sys/net/ipv4/ip_forward

when you apply the masquerade setting in the firewall it automagically enables ip_forwarding for you (ip4 only) so you don't have to do it manually.

Masquerading is a very useful but not so well known feature in fedora's firewall gui, perhaps they should call it something more friendly like Internet Sharing

btw, it's also a very useful way to connect a from a terminal session to a wpa protected wifi network, you basically use a netbook as a wifi dongle connected via the rj45 port.
Reply With Quote
  #8  
Old 2nd December 2010, 03:42 AM
jjcf89 Offline
Registered User
 
Join Date: Aug 2008
Posts: 35
linuxfedorafirefox
Re: How to set up bridge? (wlan0-eth0)

This can be simplified some since it appears network manager has a share option.
So replace step 2 with
2. Right click on Network Manager icon and select edit connections.
3. Under wired tab click add
4. Connection name: share
Under IPv4 Settings: Method: Shared to other computers
Check "Available to all users" and "Connect automatically" and click apply

eth0 will now be setup as a dhcp server and no configuration on Comp2 is needed.


Quote:
Originally Posted by Gödel View Post
There's no need to use a bridge, in Fedora 11 this is much easier.

Comp1 (Connected to internet via wlan0, connected to comp2 via cable from eth0)
================================================== ===

1. Open System -> Administration -> Firewall, and under 'Masquerading' select wlan0 (scroll down, if it's not there add it), then click 'Apply'

2. Set eth0 to ip 10.0.0.1, either via Network Manager or from the command line with

Code:
ifconfig eth0 10.0.0.1
(Assuming your wifi connection is in 192.168.*.* range)

Comp2 (Connected to Comp1 via cable from eth0)
=================================

1. Stop NetworkManager service since it's easier without:

Code:
service NetworkManager stop
2. Set eth0 ip address to 10.0.0.2 and default gateway to 10.0.0.1:

Code:
ifconfig eth0 10.0.0.2
route add default gw 10.0.0.1
Check you can ping 10.0.0.1, and an external ip such as 4.2.2.4

3. Now just set a DNS address in /etc/resolv.conf, eg if comp1 has dns address 192.168.1.1 then just put this line in /etc/resolv.conf

Code:
nameserver 192.168.1.1
(if unsure use a free external DNS like 4.2.2.x, x=1..6)

That's it, easy enough to script. I have to do this sometimes when I have no wifi connection on a portable machine and it's easier to plug into a internet connected laptop rather than the router, which is behind furniture.
Reply With Quote
  #9  
Old 14th June 2011, 10:03 PM
jozefk Offline
Registered User
 
Join Date: Jun 2011
Posts: 1
linuxchrome
Re: How to set up bridge? (wlan0-eth0)

How to do it in KDE?

---------- Post added at 01:03 AM ---------- Previous post was at 12:07 AM ----------

I got it working in KDE 4.6.3, f15 64bit
Just create a new wired connection and choose Shared method. That's all.
Reply With Quote
  #10  
Old 11th November 2011, 06:49 AM
nemesisvbk Offline
Registered User
 
Join Date: Nov 2011
Posts: 1
windows_7chrome
Re: How to set up bridge? (wlan0-eth0)

I used Godel's method and yes it's working fine .
But there is one problem.
My 10.0.0.0 network is able to access my 192.168.2.0 network.
Bu the reverse is not happening.
I checked firewalls on both the systems, but i couldn't find a solution?
Do I need to add any manual route?
Reply With Quote
  #11  
Old 11th November 2011, 09:04 AM
stevea's Avatar
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,300
linuxfedorafirefox
Re: How to set up bridge? (wlan0-eth0)

Yes, each system on the 192.168.2.* network has to route it's 10.0 addresses through "comp1"'s 192.168.2* wlan0 interface. So assuming comp1's wlan0 ip is 192.168.2.7 then every OTHER system on the 192.168.2* LAN should use:

sudo ip route add 10.0.0.0/16 via 192.168.2.7
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
  #12  
Old 11th November 2011, 10:43 AM
bart3005 Offline
Registered User
 
Join Date: May 2005
Posts: 77
linuxfirefox
Re: How to set up bridge? (wlan0-eth0)

Hi

This works well for a nailed up bridge.

http://acidborg.wordpress.com/2010/0...ed-hat-fedora/

Regards
Daniel
Reply With Quote
  #13  
Old 11th November 2011, 10:49 AM
stevea's Avatar
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,300
linuxfedorafirefox
Re: How to set up bridge? (wlan0-eth0)

Quote:
Originally Posted by bart3005 View Post
Hi

This works well for a nailed up bridge.

http://acidborg.wordpress.com/2010/0...ed-hat-fedora/

Regards
Daniel
Except everyone agreed that a bridge is NOT the was to address this problem.
The OP used a bridge and it was suggested all around that's not a good approach.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
  #14  
Old 16th December 2011, 08:08 PM
Dimon22 Offline
Registered User
 
Join Date: Dec 2011
Location: garage
Posts: 3
windows_7firefox
Re: How to set up bridge? (wlan0-eth0)

Quote:
Originally Posted by Gödel View Post
There's no need to use a bridge, in Fedora 11 this is much easier.
Check you can ping 10.0.0.1, and an external ip such as 4.2.2.4
That's where it stops working for me. I can ping 10.0.0.1 but not the external IPs. And ip_forward 1 or 0 doesn't help either...

Thanks.
Reply With Quote
  #15  
Old 16th December 2011, 11:07 PM
Gödel's Avatar
Gödel Offline
Registered User
 
Join Date: Jul 2009
Location: London,England
Posts: 1,095
linuxfirefox
Re: How to set up bridge? (wlan0-eth0)

Quote:
Originally Posted by Dimon22 View Post
That's where it stops working for me. I can ping 10.0.0.1 but not the external IPs. And ip_forward 1 or 0 doesn't help either...

Thanks.
So let's just check: the internet connected computer has wifi on wlan0 with an 192.168.*.* address and you have set masquerading for wlan0 in the firewall gui. Then you have set eth0 on the internet connected computer to 10.0.0.1.

Now, on the other computer you have disabled NetworkManager, set eth0 to 10.0.0.2 and added the gateway (route add default gw 10.0.0.1) and there were no errors?

Can you ping 4.2.2.4 from the internet connected computer?
Reply With Quote
Reply

Tags
bridge, network

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
NAT eth0 -> wlan0 Zero-Override Servers & Networking 3 7th February 2008 01:00 AM
trouble with eth0 and wlan0 widger Installation and Live Media 7 19th January 2008 06:12 PM
Trying to bridge wlan0 and eth0 Etanisla Servers & Networking 3 24th November 2006 07:56 PM
wlan0 doesn't work without eth0? LinuxHippy Servers & Networking 6 24th July 2005 11:50 PM
eth0 or wlan0 - which to use? essdeeay Servers & Networking 1 15th October 2004 11:28 PM


Current GMT-time: 01:58 (Monday, 20-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat