FedoraForum.org - Fedora Support Forums and Community
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 21
  1. #1
    Join Date
    Oct 2009
    Posts
    1

    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.

  2. #2
    Join Date
    Aug 2007
    Location
    London Postbox (the red one)
    Age
    52
    Posts
    3,868
    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

  3. #3
    scottro's Avatar
    scottro is offline Retired Community Manager -- Banned from Texas by popular demand.
    Join Date
    Sep 2007
    Location
    NYC
    Posts
    8,129
    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://srobb.net

  4. #4
    Join Date
    Jul 2009
    Location
    London,England
    Posts
    1,103
    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.

  5. #5
    Join Date
    Jul 2009
    Location
    London,England
    Posts
    1,103
    Note: if you have set up a bridge then remove it with 'brctl delbr br0'

  6. #6
    stevea Guest
    I'm with Godel - a bridge it's the ideal way to create forwarding.
    I have no idea what
    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
    }

  7. #7
    Join Date
    Jul 2009
    Location
    London,England
    Posts
    1,103
    Quote Originally Posted by stevea
    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.

  8. #8
    Join Date
    Aug 2008
    Posts
    35

    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
    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.

  9. #9
    Join Date
    Jun 2011
    Posts
    1

    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.

  10. #10
    Join Date
    Nov 2011
    Posts
    1

    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?

  11. #11
    stevea Guest

    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

  12. #12
    Join Date
    May 2005
    Posts
    80

    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

  13. #13
    stevea Guest

    Re: How to set up bridge? (wlan0-eth0)

    Quote Originally Posted by bart3005
    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.

  14. #14
    Join Date
    Dec 2011
    Location
    garage
    Posts
    3

    Re: How to set up bridge? (wlan0-eth0)

    Quote Originally Posted by Gödel
    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.

  15. #15
    Join Date
    Jul 2009
    Location
    London,England
    Posts
    1,103

    Re: How to set up bridge? (wlan0-eth0)

    Quote Originally Posted by Dimon22
    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?

Page 1 of 2 1 2 LastLast

Similar Threads

  1. NAT eth0 -> wlan0
    By Zero-Override in forum Servers & Networking
    Replies: 3
    Last Post: 7th February 2008, 02:00 AM
  2. trouble with eth0 and wlan0
    By widger in forum Installation, Upgrades and Live Media
    Replies: 7
    Last Post: 19th January 2008, 07:12 PM
  3. Trying to bridge wlan0 and eth0
    By Etanisla in forum Servers & Networking
    Replies: 3
    Last Post: 24th November 2006, 08:56 PM
  4. wlan0 doesn't work without eth0?
    By LinuxHippy in forum Servers & Networking
    Replies: 6
    Last Post: 24th July 2005, 11:50 PM
  5. eth0 or wlan0 - which to use?
    By essdeeay in forum Servers & Networking
    Replies: 1
    Last Post: 15th October 2004, 11:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •